From 11a12a9cac84b7a4c2a15cd3db99113e7e4ca82f Mon Sep 17 00:00:00 2001 From: Christian Kaiser Date: Thu, 31 Jul 2025 20:52:33 -0300 Subject: [PATCH] [lua] Add `resizeable` property to Dialog constructor (fix #5177) --- src/app/script/dialog_class.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index 635f301eb..e0c692169 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -127,12 +127,13 @@ struct Dialog { int showRef = LUA_REFNIL; lua_State* L = nullptr; - Dialog(const ui::Window::Type windowType, const std::string& title) + Dialog(const ui::Window::Type windowType, const std::string& title, bool sizeable) : window(windowType, title) , grid(2, false) , currentGrid(&grid) { window.addChild(&grid); + window.setSizeable(sizeable); all_dialogs.push_back(this); } @@ -365,6 +366,7 @@ int Dialog_new(lua_State* L) // Get the title and the type of window (with or without title bar) ui::Window::Type windowType = ui::Window::WithTitleBar; std::string title = "Script"; + bool sizeable = true; if (lua_isstring(L, 1)) { title = lua_tostring(L, 1); } @@ -378,9 +380,14 @@ int Dialog_new(lua_State* L) if (type != LUA_TNIL && lua_toboolean(L, -1)) windowType = ui::Window::WithoutTitleBar; lua_pop(L, 1); + + type = lua_getfield(L, 1, "resizeable"); + if (type != LUA_TNIL && !lua_toboolean(L, -1)) + sizeable = false; + lua_pop(L, 1); } - auto dlg = push_new(L, windowType, title); + auto dlg = push_new(L, windowType, title, sizeable); // The uservalue of the dialog userdata will contain a table that // stores all the callbacks to handle events. As these callbacks can