fix(lua): Store and update the 'zone' rectangle for Lua widgets. (#3060)

* Store 'zone' rectangle dat in Lua registry and update it when the screen layout changes or full screen mode changes. Allows Lua widgets to adjust to layout changes.

* Call widget 'update' function is layout has changed.
This commit is contained in:
philmoz
2023-02-20 11:46:27 +10:00
committed by GitHub
parent c3516b54c1
commit 1df8fe86a8
6 changed files with 73 additions and 9 deletions
+6 -1
View File
@@ -60,6 +60,7 @@ class LuaWidget : public Widget, public LuaEventHandler
friend class LuaWidgetFactory;
int luaWidgetDataRef;
int zoneRectDataRef;
char* errorMessage;
bool refreshed = false;
@@ -73,9 +74,13 @@ class LuaWidget : public Widget, public LuaEventHandler
void setErrorMessage(const char* funcName);
// Update 'zone' data
void updateZoneRect(rect_t rect) override;
bool updateTable(const char* idx, int val);
public:
LuaWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
WidgetPersistentData* persistentData, int luaWidgetDataRef);
WidgetPersistentData* persistentData, int luaWidgetDataRef, int zoneRectDataRef);
~LuaWidget() override;
#if defined(DEBUG_WINDOWS)