flex layout: add fields switches automatically to next row
This commit is contained in:
committed by
Raphael Coeffic
parent
9529151bea
commit
2caea0eb53
+12
-3
@@ -61,11 +61,20 @@ class FlexGridLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nextColumn() { col_pos++; }
|
|
||||||
void nextRow() { row_pos++; }
|
|
||||||
|
|
||||||
void resetPos() { col_pos = 0; row_pos = 0; }
|
void resetPos() { col_pos = 0; row_pos = 0; }
|
||||||
|
|
||||||
|
void nextColumn() { col_pos += col_span; }
|
||||||
|
void nextRow() { row_pos += row_span; }
|
||||||
|
|
||||||
|
void nextCell()
|
||||||
|
{
|
||||||
|
nextColumn();
|
||||||
|
if (col_dsc[col_pos] == LV_GRID_TEMPLATE_LAST) {
|
||||||
|
nextRow();
|
||||||
|
col_pos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setColSpan(uint8_t span) { col_span = span; }
|
void setColSpan(uint8_t span) { col_span = span; }
|
||||||
void setRowSpan(uint8_t span) { row_span = span; }
|
void setRowSpan(uint8_t span) { row_span = span; }
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -141,7 +141,7 @@ void FormGroup::Line::addChild(Window* window, bool front)
|
|||||||
Window::addChild(window, front);
|
Window::addChild(window, front);
|
||||||
if (layout) {
|
if (layout) {
|
||||||
layout->add(window->getLvObj());
|
layout->add(window->getLvObj());
|
||||||
layout->nextColumn();
|
layout->nextCell();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ void FormGroup::setFlexLayout(lv_flex_flow_t flow, lv_coord_t padding)
|
|||||||
|
|
||||||
FormGroup::Line* FormGroup::newLine(FlexGridLayout* layout)
|
FormGroup::Line* FormGroup::newLine(FlexGridLayout* layout)
|
||||||
{
|
{
|
||||||
layout->resetPos();
|
if (layout) layout->resetPos();
|
||||||
auto lv_line = lv_obj_create(lvobj);
|
auto lv_line = lv_obj_create(lvobj);
|
||||||
return new Line(this, lv_line, layout);
|
return new Line(this, lv_line, layout);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -152,7 +152,7 @@ class FormGroup : public FormField, public FieldContainer
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void setFlexLayout(lv_flex_flow_t flow = LV_FLEX_FLOW_COLUMN, lv_coord_t padding = 0);
|
void setFlexLayout(lv_flex_flow_t flow = LV_FLEX_FLOW_COLUMN, lv_coord_t padding = 0);
|
||||||
Line* newLine(FlexGridLayout* layout);
|
Line* newLine(FlexGridLayout* layout = nullptr);
|
||||||
|
|
||||||
void setFocus(uint8_t flag = SET_FOCUS_DEFAULT,
|
void setFocus(uint8_t flag = SET_FOCUS_DEFAULT,
|
||||||
Window *from = nullptr) override;
|
Window *from = nullptr) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user