diff --git a/radio/src/lua/lua_lvgl_widget.cpp b/radio/src/lua/lua_lvgl_widget.cpp index 64757df37..7741ec20b 100644 --- a/radio/src/lua/lua_lvgl_widget.cpp +++ b/radio/src/lua/lua_lvgl_widget.cpp @@ -1791,19 +1791,6 @@ void LvglWidgetTextButtonBase::clearRefs(lua_State *L) LvglWidgetObject::clearRefs(L); } -void LvglWidgetTextButtonBase::setText(const char *s) -{ - if (window && txt.changedText(s)) { - ((TextButton *)window)->setText(s); - } -} - -void LvglWidgetTextButtonBase::setFont(LcdFlags newFont) -{ - if (window && font.changedFont(newFont)) - ((TextButton*)window)->setFont(FONT_INDEX(font.flags)); -} - void LvglWidgetTextButtonBase::setSize(coord_t w, coord_t h) { if (w == LV_SIZE_CONTENT || w == 0) w = lv_obj_get_width(window->getLvObj()); @@ -1859,6 +1846,19 @@ void LvglWidgetTextButton::setChecked(bool checked) ((TextButton*)window)->check(checked); } +void LvglWidgetTextButton::setText(const char *s) +{ + if (window && txt.changedText(s)) { + ((TextButton *)window)->setText(s); + } +} + +void LvglWidgetTextButton::setFont(LcdFlags newFont) +{ + if (window && font.changedFont(newFont)) + ((TextButton*)window)->setFont(FONT_INDEX(font.flags)); +} + void LvglWidgetTextButton::build(lua_State *L) { if (h == LV_SIZE_CONTENT) h = 0; @@ -1896,6 +1896,19 @@ void LvglWidgetMomentaryButton::clearRefs(lua_State *L) LvglWidgetTextButtonBase::clearRefs(L); } +void LvglWidgetMomentaryButton::setText(const char *s) +{ + if (window && txt.changedText(s)) { + ((MomentaryButton *)window)->setText(s); + } +} + +void LvglWidgetMomentaryButton::setFont(LcdFlags newFont) +{ + if (window && font.changedFont(newFont)) + ((MomentaryButton*)window)->setFont(FONT_INDEX(font.flags)); +} + void LvglWidgetMomentaryButton::build(lua_State *L) { if (h == LV_SIZE_CONTENT) h = 0; diff --git a/radio/src/lua/lua_lvgl_widget.h b/radio/src/lua/lua_lvgl_widget.h index 5f410a743..deca35d03 100644 --- a/radio/src/lua/lua_lvgl_widget.h +++ b/radio/src/lua/lua_lvgl_widget.h @@ -618,8 +618,8 @@ class LvglWidgetTextButtonBase : public LvglWidgetObject, public LvglTextParams color.flags = -1; // ignore unless overridden } - void setText(const char *s); - void setFont(LcdFlags font); + virtual void setText(const char *s) = 0; + virtual void setFont(LcdFlags font) = 0; void setSize(coord_t w, coord_t h) override; void setColor(LcdFlags newColor) override; void setTextColor(LcdFlags newColor); @@ -651,6 +651,8 @@ class LvglWidgetTextButton : public LvglWidgetTextButtonBase LvglWidgetTextButton() : LvglWidgetTextButtonBase() {} void setChecked(bool check); + void setText(const char *s) override; + void setFont(LcdFlags font) override; void clearRefs(lua_State *L) override; @@ -674,6 +676,9 @@ class LvglWidgetMomentaryButton : public LvglWidgetTextButtonBase public: LvglWidgetMomentaryButton() : LvglWidgetTextButtonBase() {} + void setText(const char *s) override; + void setFont(LcdFlags font) override; + void clearRefs(lua_State *L) override; protected: