fix(color): Buttons on model setup page not showing active state (#3942)

This commit is contained in:
philmoz
2023-08-26 20:52:32 +10:00
committed by GitHub
parent 019b4308ac
commit c1e83c2026
+11 -9
View File
@@ -96,19 +96,12 @@ class SubScreenButton : public TextButton
{ {
public: public:
SubScreenButton(Window* parent, const char* text, SubScreenButton(Window* parent, const char* text,
std::function<void(void)> pressHandler);
protected:
virtual bool isActive() { return false; }
};
SubScreenButton::SubScreenButton(Window* parent, const char* text,
std::function<void(void)> pressHandler) : std::function<void(void)> pressHandler) :
TextButton(parent, rect_t{}, text, [=]() -> uint8_t { TextButton(parent, rect_t{}, text, [=]() -> uint8_t {
pressHandler(); pressHandler();
return 0; return 0;
}) })
{ {
// Room for two lines of text // Room for two lines of text
setHeight(62); setHeight(62);
setWidth((LCD_W - 30) / 3); setWidth((LCD_W - 30) / 3);
@@ -116,7 +109,16 @@ SubScreenButton::SubScreenButton(Window* parent, const char* text,
lv_obj_set_width(label, lv_pct(100)); lv_obj_set_width(label, lv_pct(100));
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
} }
void checkEvents() override
{
check(isActive());
}
protected:
virtual bool isActive() { return false; }
};
struct IntmoduleButton : public SubScreenButton { struct IntmoduleButton : public SubScreenButton {
IntmoduleButton(Window* parent) : IntmoduleButton(Window* parent) :