Do not use lv_obj_create(nullptr)
This commit is contained in:
committed by
Raphael Coeffic
parent
64a834d584
commit
ca5b6a121c
+1
-5
@@ -22,12 +22,8 @@
|
|||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
|
|
||||||
LvglWidgetFactory modalFactory = LvglWidgetFactory([] (lv_obj_t *parent) {
|
|
||||||
return lv_obj_create(nullptr);
|
|
||||||
});
|
|
||||||
|
|
||||||
ModalWindow::ModalWindow(Window * parent, bool closeWhenClickOutside):
|
ModalWindow::ModalWindow(Window * parent, bool closeWhenClickOutside):
|
||||||
Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H}, 0, 0, &modalFactory),
|
Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H}),
|
||||||
closeWhenClickOutside(closeWhenClickOutside)
|
closeWhenClickOutside(closeWhenClickOutside)
|
||||||
{
|
{
|
||||||
Layer::push(this);
|
Layer::push(this);
|
||||||
|
|||||||
+8
-8
@@ -118,20 +118,20 @@ LvglWidgetFactory windowFactory = LvglWidgetFactory(
|
|||||||
lv_style_set_radius(&factory->style, 0);
|
lv_style_set_radius(&factory->style, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
Window::Window(Window * parent, const rect_t & rect, WindowFlags windowFlags, LcdFlags textFlags, LvglWidgetFactory *factory) :
|
Window::Window(Window *parent, const rect_t &rect, WindowFlags windowFlags,
|
||||||
parent(parent),
|
LcdFlags textFlags, LvglWidgetFactory *factory) :
|
||||||
rect(rect),
|
parent(parent),
|
||||||
innerWidth(rect.w),
|
rect(rect),
|
||||||
innerHeight(rect.h),
|
innerWidth(rect.w),
|
||||||
windowFlags(windowFlags),
|
innerHeight(rect.h),
|
||||||
textFlags(textFlags)
|
windowFlags(windowFlags),
|
||||||
|
textFlags(textFlags)
|
||||||
{
|
{
|
||||||
lv_obj_t *lvParent = parent != nullptr ? parent->lvobj : nullptr;
|
lv_obj_t *lvParent = parent != nullptr ? parent->lvobj : nullptr;
|
||||||
lvobj = (factory == nullptr) ?
|
lvobj = (factory == nullptr) ?
|
||||||
windowFactory.construct(lvParent) :
|
windowFactory.construct(lvParent) :
|
||||||
factory->construct(lvParent);
|
factory->construct(lvParent);
|
||||||
|
|
||||||
|
|
||||||
lv_obj_add_style(lvobj, &windowFactory.style, LV_PART_MAIN);
|
lv_obj_add_style(lvobj, &windowFactory.style, LV_PART_MAIN);
|
||||||
lv_obj_set_pos(lvobj, rect.x, rect.y);
|
lv_obj_set_pos(lvobj, rect.x, rect.y);
|
||||||
lv_obj_set_size(lvobj, rect.w, rect.h);
|
lv_obj_set_size(lvobj, rect.w, rect.h);
|
||||||
|
|||||||
Reference in New Issue
Block a user