libopenui TextButtons are not opaque by default anymore

This commit is contained in:
Bertrand Songis
2021-02-25 15:57:27 +01:00
parent 8d8e7c395b
commit 549f4da051
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -87,8 +87,8 @@ class Button: public FormField
class TextButton: public Button class TextButton: public Button
{ {
public: public:
TextButton(FormGroup * parent, const rect_t & rect, std::string text, std::function<uint8_t(void)> pressHandler = nullptr, WindowFlags windowFlags = BUTTON_BACKGROUND, LcdFlags textFlags = 0): TextButton(FormGroup * parent, const rect_t & rect, std::string text, std::function<uint8_t(void)> pressHandler = nullptr, WindowFlags windowFlags = BUTTON_BACKGROUND | OPAQUE, LcdFlags textFlags = 0):
Button(parent, rect, std::move(pressHandler), windowFlags | OPAQUE, textFlags), Button(parent, rect, std::move(pressHandler), windowFlags, textFlags),
text(std::move(text)) text(std::move(text))
{ {
} }
+7 -7
View File
@@ -32,43 +32,43 @@ NumberKeyboard::NumberKeyboard() :
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_BACKWARD); putEvent(EVT_VIRTUAL_KEY_BACKWARD);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 - 55, 10, 50, 30}, "-", new TextButton(this, {LCD_W / 2 - 55, 10, 50, 30}, "-",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_MINUS); putEvent(EVT_VIRTUAL_KEY_MINUS);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 + 5, 10, 50, 30}, "+", new TextButton(this, {LCD_W / 2 + 5, 10, 50, 30}, "+",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_PLUS); putEvent(EVT_VIRTUAL_KEY_PLUS);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 + 65, 10, 50, 30}, ">>", new TextButton(this, {LCD_W / 2 + 65, 10, 50, 30}, ">>",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_FORWARD); putEvent(EVT_VIRTUAL_KEY_FORWARD);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 - 115, 50, 50, 30}, "MIN", new TextButton(this, {LCD_W / 2 - 115, 50, 50, 30}, "MIN",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_MIN); putEvent(EVT_VIRTUAL_KEY_MIN);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 + 65, 50, 50, 30}, "MAX", new TextButton(this, {LCD_W / 2 + 65, 50, 50, 30}, "MAX",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_MAX); putEvent(EVT_VIRTUAL_KEY_MAX);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 - 55, 50, 110, 30}, "DEFAULT", new TextButton(this, {LCD_W / 2 - 55, 50, 110, 30}, "DEFAULT",
[=]() -> uint8_t { [=]() -> uint8_t {
putEvent(EVT_VIRTUAL_KEY_DEFAULT); putEvent(EVT_VIRTUAL_KEY_DEFAULT);
return 0; return 0;
}, BUTTON_BACKGROUND | NO_FOCUS); }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
} }
NumberKeyboard::~NumberKeyboard() NumberKeyboard::~NumberKeyboard()
+1 -1
View File
@@ -51,7 +51,7 @@ class Theme {
virtual const BitmapBuffer * getIcon(uint8_t index, IconState state) const = 0; virtual const BitmapBuffer * getIcon(uint8_t index, IconState state) const = 0;
virtual const BitmapBuffer * getIconMask(uint8_t index) const = 0; virtual const BitmapBuffer * getIconMask(uint8_t index) const = 0;
virtual TextButton * createTextButton(FormGroup * parent, const rect_t & rect, std::string text, std::function<uint8_t(void)> pressHandler = nullptr, WindowFlags windowFlags = BUTTON_BACKGROUND) const virtual TextButton * createTextButton(FormGroup * parent, const rect_t & rect, std::string text, std::function<uint8_t(void)> pressHandler = nullptr, WindowFlags windowFlags = OPAQUE | BUTTON_BACKGROUND) const
{ {
return new TextButton(parent, rect, text, pressHandler, windowFlags); return new TextButton(parent, rect, text, pressHandler, windowFlags);
} }