From 8df95aaf4b5b4fe0ed5dc089de38935417d25a45 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 12 Jan 2024 03:41:14 +0100 Subject: [PATCH] fix(grid,flex): fix compile errors when grid or flex is disabled (#5289) --- demos/benchmark/lv_demo_benchmark.c | 4 ++ demos/multilang/lv_demo_multilang.h | 12 ++++ demos/music/lv_demo_music_main.h | 5 ++ demos/render/lv_demo_render.c | 1 + demos/render/lv_demo_render.h | 4 ++ demos/transform/lv_demo_transform.c | 4 -- demos/transform/lv_demo_transform.h | 12 ++++ demos/widgets/lv_demo_widgets.h | 12 ++++ .../others/fragment/lv_example_fragment_2.c | 2 +- scripts/style_api_gen.py | 42 +++++++++-- src/core/lv_obj_style_gen.c | 8 ++- src/core/lv_obj_style_gen.h | 52 ++++++++------ src/misc/lv_style.c | 4 ++ src/misc/lv_style_gen.c | 5 ++ src/misc/lv_style_gen.h | 72 +++++++++++-------- src/widgets/menu/lv_menu.h | 4 ++ 16 files changed, 180 insertions(+), 63 deletions(-) diff --git a/demos/benchmark/lv_demo_benchmark.c b/demos/benchmark/lv_demo_benchmark.c index 47db62764..7072c7fbc 100644 --- a/demos/benchmark/lv_demo_benchmark.c +++ b/demos/benchmark/lv_demo_benchmark.c @@ -18,6 +18,10 @@ #error "LV_FONT_MONTSERRAT_24 is required for lv_demo_benchmark. Enable it in lv_conf.h." #endif +#if LV_USE_DEMO_WIDGETS == 0 + #error "LV_USE_DEMO_WIDGETS needs to be enabled" +#endif + #include "../../src/display/lv_display_private.h" #include "../../src/core/lv_global.h" diff --git a/demos/multilang/lv_demo_multilang.h b/demos/multilang/lv_demo_multilang.h index 572487b38..75ecd62e0 100644 --- a/demos/multilang/lv_demo_multilang.h +++ b/demos/multilang/lv_demo_multilang.h @@ -15,6 +15,16 @@ extern "C" { *********************/ #include "../lv_demos.h" +#if LV_USE_DEMO_MULTILANG + +#if LV_USE_GRID == 0 +#error "LV_USE_GRID needs to be enabled" +#endif + +#if LV_USE_FLEX == 0 +#error "LV_USE_FLEX needs to be enabled" +#endif + /********************* * DEFINES *********************/ @@ -32,6 +42,8 @@ void lv_demo_multilang(void); * MACROS **********************/ +#endif /*LV_USE_DEMO_MULTILANG*/ + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/demos/music/lv_demo_music_main.h b/demos/music/lv_demo_music_main.h index 7a225736f..8a2fe9ffc 100644 --- a/demos/music/lv_demo_music_main.h +++ b/demos/music/lv_demo_music_main.h @@ -14,8 +14,13 @@ extern "C" { * INCLUDES *********************/ #include "lv_demo_music.h" + #if LV_USE_DEMO_MUSIC +#if LV_USE_GRID == 0 +#error "LV_USE_GRID needs to be enabled" +#endif + /********************* * DEFINES *********************/ diff --git a/demos/render/lv_demo_render.c b/demos/render/lv_demo_render.c index 0da7c3f0d..cca3c79e7 100644 --- a/demos/render/lv_demo_render.c +++ b/demos/render/lv_demo_render.c @@ -9,6 +9,7 @@ #include "lv_demo_render.h" #if LV_USE_DEMO_RENDER + #include "../../src/display/lv_display_private.h" #include "../../src/core/lv_global.h" diff --git a/demos/render/lv_demo_render.h b/demos/render/lv_demo_render.h index 76c668679..9ae1fe415 100644 --- a/demos/render/lv_demo_render.h +++ b/demos/render/lv_demo_render.h @@ -17,6 +17,10 @@ extern "C" { #if LV_USE_DEMO_RENDER +#if LV_USE_GRID == 0 +#error "LV_USE_GRID needs to be enabled" +#endif + /********************* * DEFINES *********************/ diff --git a/demos/transform/lv_demo_transform.c b/demos/transform/lv_demo_transform.c index fddc0dfdd..4ecce6d65 100644 --- a/demos/transform/lv_demo_transform.c +++ b/demos/transform/lv_demo_transform.c @@ -10,10 +10,6 @@ #if LV_USE_DEMO_TRANSFORM -#if LV_FONT_MONTSERRAT_18 == 0 - #error "LV_FONT_MONTSERRAT_18 is required for lv_demo_transform. Enable it in lv_conf.h." -#endif - /********************* * DEFINES *********************/ diff --git a/demos/transform/lv_demo_transform.h b/demos/transform/lv_demo_transform.h index 844e40d0c..dbe25d05a 100644 --- a/demos/transform/lv_demo_transform.h +++ b/demos/transform/lv_demo_transform.h @@ -15,6 +15,16 @@ extern "C" { *********************/ #include "../lv_demos.h" +#if LV_USE_DEMO_TRANSFORM + +#if LV_FONT_MONTSERRAT_18 == 0 +#error "LV_FONT_MONTSERRAT_18 is required for lv_demo_transform. Enable it in lv_conf.h." +#endif + +#if LV_USE_GRID == 0 +#error "LV_USE_GRID needs to be enabled" +#endif + /********************* * DEFINES *********************/ @@ -32,6 +42,8 @@ void lv_demo_transform(void); * MACROS **********************/ +#endif /*LV_USE_DEMO_TRANSFORM*/ + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/demos/widgets/lv_demo_widgets.h b/demos/widgets/lv_demo_widgets.h index 3d1375ef8..c8d382a08 100644 --- a/demos/widgets/lv_demo_widgets.h +++ b/demos/widgets/lv_demo_widgets.h @@ -15,6 +15,16 @@ extern "C" { *********************/ #include "../lv_demos.h" +#if LV_USE_DEMO_WIDGETS + +#if LV_USE_GRID == 0 +#error "LV_USE_GRID needs to be enabled" +#endif + +#if LV_USE_FLEX == 0 +#error "LV_USE_FLEX needs to be enabled" +#endif + /********************* * DEFINES *********************/ @@ -33,6 +43,8 @@ void lv_demo_widgets_start_slideshow(void); * MACROS **********************/ +#endif /*LV_USE_DEMO_WIDGETS*/ + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/examples/others/fragment/lv_example_fragment_2.c b/examples/others/fragment/lv_example_fragment_2.c index 5ec5f44a6..39f0956e7 100644 --- a/examples/others/fragment/lv_example_fragment_2.c +++ b/examples/others/fragment/lv_example_fragment_2.c @@ -4,7 +4,7 @@ */ #include "../../lv_examples.h" -#if LV_USE_FRAGMENT && LV_USE_WIN && LV_BUILD_EXAMPLES +#if LV_USE_FRAGMENT && LV_USE_WIN && LV_USE_GRID && LV_BUILD_EXAMPLES static void sample_fragment_ctor(lv_fragment_t * self, void * args); diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 33120a2a2..037adec2c 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -390,8 +390,7 @@ props = [ 'dsc': "Set the base direction of the object. The possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`."}, - -{'section': 'Flex', 'dsc':'Flex layout properties.' }, +{'section': 'Flex', 'dsc':'Flex layout properties.', 'guard':'LV_USE_FLEX'}, {'name': 'FLEX_FLOW', @@ -419,7 +418,7 @@ props = [ -{'section': 'Grid', 'dsc':'Grid layout properties.' }, +{'section': 'Grid', 'dsc':'Grid layout properties.', 'guard':'LV_USE_GRID'}, {'name': 'GRID_COLUMN_DSC_ARRAY', @@ -588,6 +587,20 @@ def docs(p): print("
  • Ext. draw " + e + "
  • ") print("") +def guard_proc(p): + global guard + if 'section' in p: + if guard: + guard_close() + if 'guard' in p: + guard = p['guard'] + print(f"#if {guard}\n") + +def guard_close(): + global guard + if guard: + print(f"#endif /*{guard}*/\n") + guard = "" base_dir = os.path.abspath(os.path.dirname(__file__)) sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w') @@ -611,11 +624,17 @@ print("#include \"../misc/lv_area.h\"") print("#include \"../misc/lv_style.h\"") print("#include \"../core/lv_obj_style.h\"") print() + +guard = "" for p in props: + guard_proc(p) obj_style_get(p) +guard_close() for p in props: + guard_proc(p) local_style_set_h(p) +guard_close() print() print('#endif /* LV_OBJ_STYLE_GEN_H */') @@ -625,16 +644,22 @@ sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w') print(HEADING) print("#include \"lv_obj.h\"") print() + for p in props: + guard_proc(p) local_style_set_c(p) +guard_close() sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w') print(HEADING) print("#include \"lv_style.h\"") print() + for p in props: + guard_proc(p) style_set_c(p) +guard_close() sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w') @@ -642,15 +667,20 @@ print(HEADING) print('#ifndef LV_STYLE_GEN_H') print('#define LV_STYLE_GEN_H') print() -for p in props: - style_set_h(p) for p in props: + guard_proc(p) + style_set_h(p) +guard_close() + +for p in props: + guard_proc(p) style_const_set(p) +guard_close() + print() print('#endif /* LV_STYLE_GEN_H */') - sys.stdout = open(base_dir + '/../docs/overview/style-props.md', 'w') print('# Style properties') diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c index 6b1f5ba96..71c6f76e7 100644 --- a/src/core/lv_obj_style_gen.c +++ b/src/core/lv_obj_style_gen.c @@ -721,8 +721,7 @@ void lv_obj_set_style_anim_time(lv_obj_t * obj, uint32_t value, lv_style_selecto lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_TIME, v, selector); } -void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, - lv_style_selector_t selector) +void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector) { lv_style_value_t v = { .ptr = value @@ -753,6 +752,7 @@ void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_sel }; lv_obj_set_local_style_prop(obj, LV_STYLE_BASE_DIR, v, selector); } +#if LV_USE_FLEX void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector) { @@ -793,6 +793,9 @@ void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector }; lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_GROW, v, selector); } +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector) { @@ -873,3 +876,4 @@ void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, int32_t value, lv_style }; lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_SPAN, v, selector); } +#endif /*LV_USE_GRID*/ diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 59a5197f8..72989430e 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -589,8 +589,7 @@ static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, uint32 return (lv_opa_t)v.num; } -static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, - uint32_t part) +static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC); return (const lv_color_filter_dsc_t *)v.ptr; @@ -638,6 +637,8 @@ static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, uint return (lv_base_dir_t)v.num; } +#if LV_USE_FLEX + static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW); @@ -668,6 +669,10 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t return (uint8_t)v.num; } +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID + static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY); @@ -728,6 +733,8 @@ static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, return (int32_t)v.num; } +#endif /*LV_USE_GRID*/ + void lv_obj_set_style_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_min_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_max_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); @@ -818,26 +825,31 @@ void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc void lv_obj_set_style_color_filter_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector); void lv_obj_set_style_anim_time(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); -void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, - lv_style_selector_t selector); +void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector); void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector); void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector); void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector); -void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector); -void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const int32_t * value, - lv_style_selector_t selector); -void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); -void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +#if LV_USE_FLEX + + void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector); + void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector); +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID + + void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); + void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); + void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +#endif /*LV_USE_GRID*/ #endif /* LV_OBJ_STYLE_GEN_H */ diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index f6e560f70..da844106f 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -137,12 +137,15 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR [LV_STYLE_LAYOUT] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_BASE_DIR] = LV_STYLE_PROP_FLAG_INHERITABLE | LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, +#if LV_USE_FLEX [LV_STYLE_FLEX_FLOW] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_FLEX_MAIN_PLACE] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_FLEX_CROSS_PLACE] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_FLEX_TRACK_PLACE] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_FLEX_GROW] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, +#endif +#if LV_USE_GRID [LV_STYLE_GRID_COLUMN_DSC_ARRAY] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_GRID_ROW_DSC_ARRAY] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_GRID_COLUMN_ALIGN] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, @@ -153,6 +156,7 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR [LV_STYLE_GRID_CELL_COLUMN_POS] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_GRID_CELL_X_ALIGN] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_GRID_CELL_Y_ALIGN] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, +#endif }; diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c index 380a8d7ae..6abca8b1d 100644 --- a/src/misc/lv_style_gen.c +++ b/src/misc/lv_style_gen.c @@ -937,6 +937,7 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value) } const lv_style_prop_t _lv_style_const_prop_id_BASE_DIR = LV_STYLE_BASE_DIR; +#if LV_USE_FLEX void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value) { @@ -987,6 +988,9 @@ void lv_style_set_flex_grow(lv_style_t * style, uint8_t value) } const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW = LV_STYLE_FLEX_GROW; +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value) { @@ -1087,3 +1091,4 @@ void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value) } const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN = LV_STYLE_GRID_CELL_ROW_SPAN; +#endif /*LV_USE_GRID*/ diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index af6060220..f855017d0 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -195,36 +195,43 @@ void lv_style_set_layout(lv_style_t * style, uint16_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LAYOUT; void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BASE_DIR; -void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_FLOW; -void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_MAIN_PLACE; -void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_CROSS_PLACE; -void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_TRACK_PLACE; -void lv_style_set_flex_grow(lv_style_t * style, uint8_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW; -void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_DSC_ARRAY; -void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_ALIGN; -void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_DSC_ARRAY; -void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_ALIGN; -void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_POS; -void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_X_ALIGN; -void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_SPAN; -void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_POS; -void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_Y_ALIGN; -void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value); -extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; +#if LV_USE_FLEX + + void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_FLOW; + void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_MAIN_PLACE; + void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_CROSS_PLACE; + void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_TRACK_PLACE; + void lv_style_set_flex_grow(lv_style_t * style, uint8_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW; +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID + + void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_DSC_ARRAY; + void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_ALIGN; + void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_DSC_ARRAY; + void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_ALIGN; + void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_POS; + void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_X_ALIGN; + void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_SPAN; + void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_POS; + void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_Y_ALIGN; + void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value); + extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; +#endif /*LV_USE_GRID*/ #define LV_STYLE_CONST_WIDTH(val) \ { \ @@ -690,6 +697,7 @@ extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; { \ .prop_ptr = &_lv_style_const_prop_id_BASE_DIR, .value = { .num = (int32_t)val } \ } +#if LV_USE_FLEX #define LV_STYLE_CONST_FLEX_FLOW(val) \ { \ @@ -715,6 +723,9 @@ extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; { \ .prop_ptr = &_lv_style_const_prop_id_FLEX_GROW, .value = { .num = (int32_t)val } \ } +#endif /*LV_USE_FLEX*/ + +#if LV_USE_GRID #define LV_STYLE_CONST_GRID_COLUMN_DSC_ARRAY(val) \ { \ @@ -765,5 +776,6 @@ extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; { \ .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_ROW_SPAN, .value = { .num = (int32_t)val } \ } +#endif /*LV_USE_GRID*/ #endif /* LV_STYLE_GEN_H */ diff --git a/src/widgets/menu/lv_menu.h b/src/widgets/menu/lv_menu.h index f5b7e3400..c187ff134 100644 --- a/src/widgets/menu/lv_menu.h +++ b/src/widgets/menu/lv_menu.h @@ -17,6 +17,10 @@ extern "C" { #if LV_USE_MENU +#if LV_USE_FLEX == 0 +#error "LV_USE_FLEX needs to be enabled" +#endif + /********************* * DEFINES *********************/