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 "layer.h"
|
||||
|
||||
LvglWidgetFactory modalFactory = LvglWidgetFactory([] (lv_obj_t *parent) {
|
||||
return lv_obj_create(nullptr);
|
||||
});
|
||||
|
||||
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)
|
||||
{
|
||||
Layer::push(this);
|
||||
|
||||
+8
-8
@@ -118,20 +118,20 @@ LvglWidgetFactory windowFactory = LvglWidgetFactory(
|
||||
lv_style_set_radius(&factory->style, 0);
|
||||
});
|
||||
|
||||
Window::Window(Window * parent, const rect_t & rect, WindowFlags windowFlags, LcdFlags textFlags, LvglWidgetFactory *factory) :
|
||||
parent(parent),
|
||||
rect(rect),
|
||||
innerWidth(rect.w),
|
||||
innerHeight(rect.h),
|
||||
windowFlags(windowFlags),
|
||||
textFlags(textFlags)
|
||||
Window::Window(Window *parent, const rect_t &rect, WindowFlags windowFlags,
|
||||
LcdFlags textFlags, LvglWidgetFactory *factory) :
|
||||
parent(parent),
|
||||
rect(rect),
|
||||
innerWidth(rect.w),
|
||||
innerHeight(rect.h),
|
||||
windowFlags(windowFlags),
|
||||
textFlags(textFlags)
|
||||
{
|
||||
lv_obj_t *lvParent = parent != nullptr ? parent->lvobj : nullptr;
|
||||
lvobj = (factory == nullptr) ?
|
||||
windowFactory.construct(lvParent) :
|
||||
factory->construct(lvParent);
|
||||
|
||||
|
||||
lv_obj_add_style(lvobj, &windowFactory.style, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lvobj, rect.x, rect.y);
|
||||
lv_obj_set_size(lvobj, rect.w, rect.h);
|
||||
|
||||
Reference in New Issue
Block a user