From 4fb260d2650c8ab933b10da742b3e503db795fda Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 29 Nov 2018 09:46:37 -0300 Subject: [PATCH] lua: Add Dialog.bounds property --- src/app/script/dialog_class.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index 2500a8af7..9608d182f 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -583,6 +583,23 @@ int Dialog_set_data(lua_State* L) return 1; } +int Dialog_get_bounds(lua_State* L) +{ + auto dlg = get_obj(L, 1); + if (!dlg->window.isVisible()) + dlg->window.remapWindow(); + push_new(L, dlg->window.bounds()); + return 1; +} + +int Dialog_set_bounds(lua_State* L) +{ + auto dlg = get_obj(L, 1); + const auto rc = get_obj(L, 2); + dlg->window.setBounds(*rc); + return 0; +} + const luaL_Reg Dialog_methods[] = { { "__gc", Dialog_gc }, { "show", Dialog_show }, @@ -603,6 +620,7 @@ const luaL_Reg Dialog_methods[] = { const Property Dialog_properties[] = { { "data", Dialog_get_data, Dialog_set_data }, + { "bounds", Dialog_get_bounds, Dialog_set_bounds }, { nullptr, nullptr, nullptr } };