button: Window parent instead of FormGroup

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent fc705d5d0b
commit 40268f8e52
2 changed files with 8 additions and 9 deletions
+2 -4
View File
@@ -31,7 +31,7 @@ static void lvglEvent(lv_event_t* e)
btn->onEvent(e); btn->onEvent(e);
} }
Button::Button(FormGroup* parent, const rect_t& rect, Button::Button(Window* parent, const rect_t& rect,
std::function<uint8_t(void)> pressHandler, std::function<uint8_t(void)> pressHandler,
WindowFlags windowFlag, LcdFlags textFlags, WindowFlags windowFlag, LcdFlags textFlags,
LvglCreate objConstruct) : LvglCreate objConstruct) :
@@ -101,9 +101,7 @@ void Button::checkEvents()
checkHandler(); checkHandler();
} }
lv_style_t style_btn; TextButton::TextButton(Window* parent, const rect_t& rect, std::string text,
TextButton::TextButton(FormGroup* parent, const rect_t& rect, std::string text,
std::function<uint8_t(void)> pressHandler, std::function<uint8_t(void)> pressHandler,
WindowFlags windowFlags, LcdFlags textFlags) : WindowFlags windowFlags, LcdFlags textFlags) :
Button(parent, rect, std::move(pressHandler), windowFlags, textFlags, Button(parent, rect, std::move(pressHandler), windowFlags, textFlags,
+6 -5
View File
@@ -28,7 +28,7 @@ constexpr WindowFlags BUTTON_CHECKED_ON_FOCUS = FORM_FLAGS_LAST << 3u;
class Button: public FormField class Button: public FormField
{ {
public: public:
Button(FormGroup* parent, const rect_t& rect, Button(Window* parent, const rect_t& rect,
std::function<uint8_t(void)> pressHandler = nullptr, std::function<uint8_t(void)> pressHandler = nullptr,
WindowFlags windowFlags = 0, LcdFlags textFlags = 0, WindowFlags windowFlags = 0, LcdFlags textFlags = 0,
LvglCreate objConstruct = nullptr); LvglCreate objConstruct = nullptr);
@@ -88,7 +88,7 @@ class Button: public FormField
class TextButton: public Button class TextButton: public Button
{ {
public: public:
TextButton(FormGroup* parent, const rect_t& rect, std::string text, TextButton(Window* parent, const rect_t& rect, std::string text,
std::function<uint8_t(void)> pressHandler = nullptr, std::function<uint8_t(void)> pressHandler = nullptr,
WindowFlags windowFlags = BUTTON_BACKGROUND | OPAQUE, WindowFlags windowFlags = BUTTON_BACKGROUND | OPAQUE,
LcdFlags textFlags = 0); LcdFlags textFlags = 0);
@@ -123,9 +123,10 @@ class TextButton: public Button
class IconButton: public Button class IconButton: public Button
{ {
public: public:
IconButton(FormGroup * parent, const rect_t & rect, uint8_t icon, std::function<uint8_t(void)> pressHandler, WindowFlags flags = 0): IconButton(Window* parent, const rect_t& rect, uint8_t icon,
Button(parent, rect, std::move(pressHandler), flags), std::function<uint8_t(void)> pressHandler,
icon(icon) WindowFlags flags = 0) :
Button(parent, rect, std::move(pressHandler), flags), icon(icon)
{ {
} }