FormGroup::Line: split parent and form group
This commit is contained in:
committed by
Raphael Coeffic
parent
40268f8e52
commit
96d8022384
+21
-10
@@ -111,13 +111,25 @@ void FormField::setFocus(uint8_t flag, Window * from)
|
|||||||
|
|
||||||
FormGroup::Line::Line(FormGroup* parent, lv_obj_t* obj,
|
FormGroup::Line::Line(FormGroup* parent, lv_obj_t* obj,
|
||||||
FlexGridLayout* layout) :
|
FlexGridLayout* layout) :
|
||||||
Window(parent, obj), layout(layout)
|
Window(parent, obj), layout(layout), group(parent)
|
||||||
|
{
|
||||||
|
construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
FormGroup::Line::Line(Window* parent, lv_obj_t* obj, FlexGridLayout* layout,
|
||||||
|
FormGroup* group) :
|
||||||
|
Window(parent, obj), layout(layout), group(group)
|
||||||
|
{
|
||||||
|
construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormGroup::Line::construct()
|
||||||
{
|
{
|
||||||
// forward scroll and focus
|
// forward scroll and focus
|
||||||
windowFlags |= FORWARD_SCROLL | FORM_FORWARD_FOCUS;
|
windowFlags |= FORWARD_SCROLL | FORM_FORWARD_FOCUS;
|
||||||
|
|
||||||
if (layout) {
|
if (layout) {
|
||||||
layout->apply(obj);
|
layout->apply(lvobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_height(lvobj, LV_SIZE_CONTENT);
|
lv_obj_set_height(lvobj, LV_SIZE_CONTENT);
|
||||||
@@ -135,8 +147,7 @@ void FormGroup::Line::addChild(Window* window, bool front)
|
|||||||
|
|
||||||
void FormGroup::Line::addField(FormField *field, bool front)
|
void FormGroup::Line::addField(FormField *field, bool front)
|
||||||
{
|
{
|
||||||
auto form = static_cast<FormGroup*>(parent);
|
group->addField(field, front);
|
||||||
form->addField(field, front);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormGroup::Line::removeField(FormField *field)
|
void FormGroup::Line::removeField(FormField *field)
|
||||||
@@ -257,12 +268,12 @@ void FormGroup::addField(FormField * field, bool front)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!focusWindow && !(field->getWindowFlags() & FORM_FORWARD_FOCUS)) {
|
// if (!focusWindow && !(field->getWindowFlags() & FORM_FORWARD_FOCUS)) {
|
||||||
field->setFocus(SET_FOCUS_DEFAULT);
|
// field->setFocus(SET_FOCUS_DEFAULT);
|
||||||
}
|
// }
|
||||||
else if (focusWindow == this && (windowFlags & FORM_FORWARD_FOCUS)) {
|
// else if (focusWindow == this && (windowFlags & FORM_FORWARD_FOCUS)) {
|
||||||
field->setFocus(SET_FOCUS_DEFAULT);
|
// field->setFocus(SET_FOCUS_DEFAULT);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormGroup::setFocus(uint8_t flag, Window * from)
|
void FormGroup::setFocus(uint8_t flag, Window * from)
|
||||||
|
|||||||
+5
-1
@@ -128,9 +128,13 @@ class FormGroup : public FormField, public FieldContainer
|
|||||||
class Line : public Window, public FieldContainer
|
class Line : public Window, public FieldContainer
|
||||||
{
|
{
|
||||||
FlexGridLayout* layout;
|
FlexGridLayout* layout;
|
||||||
|
FormGroup* group;
|
||||||
|
|
||||||
|
void construct();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Line(FormGroup *parent, lv_obj_t *lvobj, FlexGridLayout* layout);
|
Line(FormGroup *parent, lv_obj_t *obj, FlexGridLayout* layout);
|
||||||
|
Line(Window *parent, lv_obj_t *obj, FlexGridLayout* layout, FormGroup* group);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addChild(Window* window, bool front = false) override;
|
void addChild(Window* window, bool front = false) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user