fix(color): Buttons on model setup page not showing active state (#3942)
This commit is contained in:
@@ -94,30 +94,32 @@ struct ModelBitmapEdit : public FileChoice {
|
|||||||
|
|
||||||
class SubScreenButton : public TextButton
|
class SubScreenButton : public TextButton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SubScreenButton(Window* parent, const char* text,
|
SubScreenButton(Window* parent, const char* text,
|
||||||
std::function<void(void)> pressHandler);
|
std::function<void(void)> pressHandler) :
|
||||||
|
TextButton(parent, rect_t{}, text, [=]() -> uint8_t {
|
||||||
|
pressHandler();
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
// Room for two lines of text
|
||||||
|
setHeight(62);
|
||||||
|
setWidth((LCD_W - 30) / 3);
|
||||||
|
|
||||||
protected:
|
lv_obj_set_width(label, lv_pct(100));
|
||||||
virtual bool isActive() { return false; }
|
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
|
||||||
|
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
check(isActive());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool isActive() { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
SubScreenButton::SubScreenButton(Window* parent, const char* text,
|
|
||||||
std::function<void(void)> pressHandler) :
|
|
||||||
TextButton(parent, rect_t{}, text, [=]() -> uint8_t {
|
|
||||||
pressHandler();
|
|
||||||
return 0;
|
|
||||||
})
|
|
||||||
{
|
|
||||||
// Room for two lines of text
|
|
||||||
setHeight(62);
|
|
||||||
setWidth((LCD_W - 30) / 3);
|
|
||||||
|
|
||||||
lv_obj_set_width(label, lv_pct(100));
|
|
||||||
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
|
|
||||||
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct IntmoduleButton : public SubScreenButton {
|
struct IntmoduleButton : public SubScreenButton {
|
||||||
IntmoduleButton(Window* parent) :
|
IntmoduleButton(Window* parent) :
|
||||||
SubScreenButton(parent, STR_INTERNALRF,
|
SubScreenButton(parent, STR_INTERNALRF,
|
||||||
|
|||||||
Reference in New Issue
Block a user