feat(color): allow all UI controls for widgets when full screen (#5808)

This commit is contained in:
philmoz
2025-02-04 11:46:12 +10:00
committed by GitHub
parent a755afb314
commit 80d831832f
27 changed files with 981 additions and 164 deletions
+20 -13
View File
@@ -48,24 +48,34 @@ class LuaLvglManager
void setTempParent(LvglWidgetObjectBase *p) { tempParent = p; }
LvglWidgetObjectBase* getTempParent() const { return tempParent; }
int getContext() const { return luaScriptContextRef; }
virtual Window* getCurrentParent() const = 0;
virtual void clear() = 0;
virtual bool useLvglLayout() const = 0;
virtual bool isAppMode() const = 0;
virtual bool isWidget() = 0;
virtual bool isFullscreen() = 0;
virtual void exitFullscreen() {}
virtual void luaShowError() = 0;
virtual bool isWidget() = 0;
uint8_t refreshInstructionsPercent;
protected:
int luaScriptContextRef = 0;
std::vector<int> lvglObjectRefs;
LvglWidgetObjectBase* tempParent = nullptr;
};
class LuaEventHandler
{
public:
LuaEventHandler() = default;
void setupHandler(Window* w);
void removeHandler(Window* w);
protected:
#if defined(HARDWARE_TOUCH)
// "tap" handling
static uint32_t downTime;
@@ -79,15 +89,9 @@ class LuaEventHandler
#endif
static void event_cb(lv_event_t* e);
protected:
void onClicked();
void onCancel();
void onEvent(event_t event);
public:
LuaEventHandler() = default;
void setupHandler(Window* w);
void removeHandler(Window* w);
void onLuaEvent(event_t event);
};
class LuaWidget : public Widget, public LuaEventHandler, public LuaLvglManager
@@ -96,7 +100,7 @@ class LuaWidget : public Widget, public LuaEventHandler, public LuaLvglManager
public:
LuaWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
WidgetPersistentData* persistentData, int luaWidgetDataRef, int zoneRectDataRef,
WidgetPersistentData* persistentData, int luaScriptContextRef, int zoneRectDataRef,
int optionsDataRef);
~LuaWidget() override;
@@ -119,19 +123,22 @@ class LuaWidget : public Widget, public LuaEventHandler, public LuaLvglManager
bool useLvglLayout() const override;
bool isAppMode() const override;
bool isWidget() override { return !inSettings; }
bool isFullscreen() override { return Widget::isFullscreen(); }
void exitFullscreen() override { closeFullscreen(); }
// Should rotary encoder events be enabled when full screen
bool enableFullScreenRE() const override { return !useLvglLayout(); }
void luaShowError() override {}
void pushOptionsTable();
bool isWidget() override { return !inSettings; }
protected:
bool inSettings = false;
lv_obj_t* errorLabel = nullptr;
int zoneRectDataRef;
int optionsDataRef;
int luaWidgetDataRef = 0;
char* errorMessage;
bool refreshed = false;