diff --git a/examples/layouts/flex/lv_example_flex_3.c b/examples/layouts/flex/lv_example_flex_3.c index a608397a8..6195184b1 100644 --- a/examples/layouts/flex/lv_example_flex_3.c +++ b/examples/layouts/flex/lv_example_flex_3.c @@ -9,7 +9,7 @@ void lv_example_flex_3(void) lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_size(cont, 300, 220); lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_layout(cont, &lv_flex_queue); + lv_obj_set_layout(cont, &lv_flex_row_nowrap); lv_obj_t * obj; obj = lv_obj_create(cont, NULL); diff --git a/examples/layouts/flex/lv_example_flex_5.c b/examples/layouts/flex/lv_example_flex_5.c index 0c2e3c9db..2d2d58893 100644 --- a/examples/layouts/flex/lv_example_flex_5.c +++ b/examples/layouts/flex/lv_example_flex_5.c @@ -19,7 +19,7 @@ void lv_example_flex_5(void) lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_size(cont, 300, 220); lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_layout(cont, &lv_flex_inline); + lv_obj_set_layout(cont, &lv_flex_row_wrap); uint32_t i; for(i = 0; i < 9; i++) { diff --git a/examples/layouts/flex/lv_example_flex_6.c b/examples/layouts/flex/lv_example_flex_6.c index 474aa22fd..812380357 100644 --- a/examples/layouts/flex/lv_example_flex_6.c +++ b/examples/layouts/flex/lv_example_flex_6.c @@ -11,7 +11,7 @@ void lv_example_flex_6(void) lv_obj_set_base_dir(cont, LV_BIDI_DIR_RTL); lv_obj_set_size(cont, 300, 220); lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_layout(cont, &lv_flex_center_column); + lv_obj_set_layout(cont, &lv_flex_column_center); uint32_t i; for(i = 0; i < 20; i++) { diff --git a/examples/scroll/lv_example_scroll_2.c b/examples/scroll/lv_example_scroll_2.c index 5dde48f5d..5502c84fb 100644 --- a/examples/scroll/lv_example_scroll_2.c +++ b/examples/scroll/lv_example_scroll_2.c @@ -19,7 +19,7 @@ void lv_example_scroll_2(void) lv_obj_t * panel = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_size(panel, 280, 150); lv_obj_set_scroll_snap_x(panel, LV_SCROLL_SNAP_CENTER); - lv_obj_set_layout(panel, &lv_flex_queue); + lv_obj_set_layout(panel, &lv_flex_row_nowrap); lv_obj_center(panel); uint32_t i; diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index 26ecc20c7..8894ece23 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -10,7 +10,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) void lv_example_switch_1(void) { - lv_obj_set_layout(lv_scr_act(), &lv_flex_center_column); + lv_obj_set_layout(lv_scr_act(), &lv_flex_column_center); lv_obj_t * sw; diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index 826cf82ce..95b98d15f 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -42,17 +42,7 @@ static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id); * GLOBAL VARIABLES **********************/ -const lv_flex_t lv_flex_inline = { - .base.update_cb = flex_update, - .item_main_place = LV_FLEX_PLACE_START, - .item_cross_place = LV_FLEX_PLACE_CENTER, - .track_cross_place = LV_FLEX_PLACE_START, - .dir = LV_FLEX_FLOW_ROW, - .wrap = 1 -}; - - -const lv_flex_t lv_flex_center_row = { +const lv_flex_t lv_flex_row_center = { .base.update_cb = flex_update, .item_main_place = LV_FLEX_PLACE_CENTER, .item_cross_place = LV_FLEX_PLACE_CENTER, @@ -61,7 +51,7 @@ const lv_flex_t lv_flex_center_row = { .wrap = 1 }; -const lv_flex_t lv_flex_center_column = { +const lv_flex_t lv_flex_column_center = { .base.update_cb = flex_update, .item_main_place = LV_FLEX_PLACE_CENTER, .item_cross_place = LV_FLEX_PLACE_CENTER, @@ -70,23 +60,16 @@ const lv_flex_t lv_flex_center_column = { .wrap = 1 }; -const lv_flex_t lv_flex_stacked = { +const lv_flex_t lv_flex_row_wrap = { .base.update_cb = flex_update, .item_main_place = LV_FLEX_PLACE_START, .item_cross_place = LV_FLEX_PLACE_CENTER, .track_cross_place = LV_FLEX_PLACE_START, - .dir = LV_FLEX_FLOW_COLUMN + .dir = LV_FLEX_FLOW_ROW, + .wrap = 1 }; -const lv_flex_t lv_flex_queue = { - .base.update_cb = flex_update, - .item_main_place = LV_FLEX_PLACE_START, - .item_cross_place = LV_FLEX_PLACE_START, - .track_cross_place = LV_FLEX_PLACE_START, - .dir = LV_FLEX_FLOW_ROW -}; - -const lv_flex_t lv_flex_even = { +const lv_flex_t lv_flex_row_even = { .base.update_cb = flex_update, .item_main_place = LV_FLEX_PLACE_SPACE_EVENLY, .item_cross_place = LV_FLEX_PLACE_CENTER, @@ -95,6 +78,23 @@ const lv_flex_t lv_flex_even = { .wrap = 1 }; +const lv_flex_t lv_flex_column_nowrap = { + .base.update_cb = flex_update, + .item_main_place = LV_FLEX_PLACE_START, + .item_cross_place = LV_FLEX_PLACE_CENTER, + .track_cross_place = LV_FLEX_PLACE_START, + .dir = LV_FLEX_FLOW_COLUMN +}; + +const lv_flex_t lv_flex_row_nowrap = { + .base.update_cb = flex_update, + .item_main_place = LV_FLEX_PLACE_START, + .item_cross_place = LV_FLEX_PLACE_CENTER, + .track_cross_place = LV_FLEX_PLACE_START, + .dir = LV_FLEX_FLOW_ROW +}; + + /********************** * STATIC VARIABLES **********************/ diff --git a/src/extra/layouts/flex/lv_flex.h b/src/extra/layouts/flex/lv_flex.h index 11c0c7475..304d89c9e 100644 --- a/src/extra/layouts/flex/lv_flex.h +++ b/src/extra/layouts/flex/lv_flex.h @@ -102,12 +102,12 @@ void lv_obj_set_flex_grow(struct _lv_obj_t * obj, uint8_t grow); /** * Predefines flex layouts */ -extern const lv_flex_t lv_flex_inline; /**< Just put the items next to each other with wrap*/ -extern const lv_flex_t lv_flex_center_row; /**< Center in a row with wrap*/ -extern const lv_flex_t lv_flex_center_column; /**< Center in a column with wrap*/ -extern const lv_flex_t lv_flex_stacked; /**< Stack the items vertically without wrapping*/ -extern const lv_flex_t lv_flex_queue; /**< Put the items next to each other without wrap*/ -extern const lv_flex_t lv_flex_even; /**< Place the items evenly in row with wrapping and vertical centering*/ +extern const lv_flex_t lv_flex_row_wrap; /**< Just put the items next to each other with wrap*/ +extern const lv_flex_t lv_flex_row_center; /**< Center in a row with wrap*/ +extern const lv_flex_t lv_flex_column_center; /**< Center in a column with wrap*/ +extern const lv_flex_t lv_flex_column_nowrap; /**< Stack the items vertically without wrapping*/ +extern const lv_flex_t lv_flex_row_nowrap; /**< Put the items next to each other without wrap*/ +extern const lv_flex_t lv_flex_row_even; /**< Place the items evenly in row with wrapping and vertical centering*/ /********************** * MACROS diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index eadea9316..e7bb45a6c 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -56,7 +56,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); - lv_obj_set_layout(header, &lv_flex_center_row); + lv_obj_set_layout(header, &lv_flex_row_center); lv_obj_t * mo_prev = lv_btn_create(header, NULL); lv_obj_set_style_content_text(mo_prev, LV_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_LEFT); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index 21a36458e..e7a6d8161 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -65,7 +65,7 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); - lv_obj_set_layout(header, &lv_flex_center_row); + lv_obj_set_layout(header, &lv_flex_row_center); lv_obj_t * year_dd = lv_dropdown_create(header, NULL); lv_dropdown_set_options(year_dd, year_list); diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index 55635cb27..11342e476 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -55,7 +55,7 @@ lv_obj_t * lv_list_create(lv_obj_t * parent) { lv_obj_t * list = lv_obj_create_from_class(&lv_list_class, parent, NULL); lv_obj_set_size(list, LV_DPX(200), LV_DPX(300)); - lv_obj_set_layout(list, &lv_flex_stacked); + lv_obj_set_layout(list, &lv_flex_column_nowrap); return list; } @@ -74,7 +74,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const char * icon, const char * txt, lv_obj_t * btn = lv_obj_create_from_class(&lv_list_btn_class, list, NULL); lv_obj_set_size(btn, LV_SIZE_PCT(100), LV_SIZE_CONTENT); lv_obj_add_event_cb(btn, event_cb, NULL); - lv_obj_set_layout(btn, &lv_flex_inline); + lv_obj_set_layout(btn, &lv_flex_row_wrap); if(icon) { lv_obj_t * img = lv_img_create(btn, NULL); diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 50e1e6c9e..a312fc167 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -60,7 +60,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b if(w > 2 * LV_DPI_DEF) w = 2 * LV_DPI_DEF; lv_obj_set_size(mbox, w, LV_SIZE_CONTENT); - lv_obj_set_layout(mbox, &lv_flex_inline); + lv_obj_set_layout(mbox, &lv_flex_row_wrap); lv_obj_t * label; label = lv_label_create(mbox, NULL); diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index 348fb4464..0bb6fe96f 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -202,7 +202,7 @@ static void lv_tabview_constructor(lv_obj_t * obj, const lv_obj_t * copy) break; } - lv_obj_set_layout(cont, &lv_flex_queue); + lv_obj_set_layout(cont, &lv_flex_row_nowrap); lv_obj_set_scroll_snap_x(cont, LV_SCROLL_SNAP_CENTER); lv_obj_add_flag(cont, LV_OBJ_FLAG_SCROLL_ONE); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLL_ON_FOCUS); diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index ce48b05bb..ebef6c1f4 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -85,11 +85,11 @@ static void lv_win_constructor(lv_obj_t * obj, const lv_obj_t * copy) LV_UNUSED(copy); lv_obj_t * parent = lv_obj_get_parent(obj); lv_obj_set_size(obj, lv_obj_get_width(parent), lv_obj_get_height(parent)); - lv_obj_set_layout(obj, &lv_flex_stacked); + lv_obj_set_layout(obj, &lv_flex_column_nowrap); lv_obj_t * header = lv_obj_create(obj, NULL); lv_obj_set_size(header, LV_SIZE_PCT(100), create_header_height); - lv_obj_set_layout(header, &lv_flex_inline); + lv_obj_set_layout(header, &lv_flex_row_wrap); lv_obj_t * cont = lv_obj_create(obj, NULL); lv_obj_set_flex_grow(cont, 1);