refactor(layout) rename place keywords to align
This commit is contained in:
@@ -9,7 +9,7 @@ void lv_example_flex_2(void)
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_flex_flow(&style, LV_FLEX_FLOW_ROW_WRAP);
|
||||
lv_style_set_flex_main_place(&style, LV_FLEX_PLACE_SPACE_EVENLY);
|
||||
lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY);
|
||||
lv_style_set_layout(&style, LV_LAYOUT_FLEX);
|
||||
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
|
||||
@@ -28,8 +28,8 @@ void lv_example_grid_1(void)
|
||||
obj = lv_btn_create(cont);
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "c%d, r%d", col, row);
|
||||
|
||||
@@ -22,40 +22,40 @@ void lv_example_grid_2(void)
|
||||
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1,
|
||||
LV_GRID_START, 0, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 0, 1,
|
||||
LV_GRID_ALIGN_START, 0, 1);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "c0, r0");
|
||||
|
||||
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1,
|
||||
LV_GRID_CENTER, 0, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 1, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "c1, r0");
|
||||
|
||||
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1,
|
||||
LV_GRID_END, 0, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 2, 1,
|
||||
LV_GRID_ALIGN_END, 0, 1);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "c2, r0");
|
||||
|
||||
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2,
|
||||
LV_GRID_STRETCH, 1, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 1, 2,
|
||||
LV_GRID_ALIGN_STRETCH, 1, 1);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "c1-2, r1");
|
||||
|
||||
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1,
|
||||
LV_GRID_STRETCH, 1, 2);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1,
|
||||
LV_GRID_ALIGN_STRETCH, 1, 2);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "c0\nr1-2");
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ void lv_example_grid_3(void)
|
||||
obj = lv_obj_create(cont);
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||
|
||||
@@ -14,7 +14,7 @@ void lv_example_grid_4(void)
|
||||
|
||||
/*Create a container with grid*/
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_grid_place(cont, LV_GRID_SPACE_BETWEEN, LV_GRID_END);
|
||||
lv_obj_set_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
@@ -29,8 +29,8 @@ void lv_example_grid_4(void)
|
||||
obj = lv_obj_create(cont);
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||
|
||||
@@ -35,8 +35,8 @@ void lv_example_grid_5(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||
lv_obj_center(label);
|
||||
|
||||
@@ -27,8 +27,8 @@ void lv_example_grid_6(void)
|
||||
obj = lv_obj_create(cont);
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||
|
||||
@@ -15,7 +15,7 @@ static void event_handler(lv_event_t * e)
|
||||
void lv_example_checkbox_1(void)
|
||||
{
|
||||
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER);
|
||||
lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * cb;
|
||||
cb = lv_checkbox_create(lv_scr_act());
|
||||
|
||||
@@ -13,7 +13,7 @@ static void event_handler(lv_event_t * e)
|
||||
void lv_example_switch_1(void)
|
||||
{
|
||||
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER);
|
||||
lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * sw;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user