mikroSDK Reference Manual
lv_flex.h
Go to the documentation of this file.
1
6#ifndef LV_FLEX_H
7#define LV_FLEX_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
17#if LV_USE_FLEX
18
19/*********************
20 * DEFINES
21 *********************/
22
23#define LV_OBJ_FLAG_FLEX_IN_NEW_TRACK LV_OBJ_FLAG_LAYOUT_1
24LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
25
26#define _LV_FLEX_COLUMN (1 << 0)
27#define _LV_FLEX_WRAP (1 << 2)
28#define _LV_FLEX_REVERSE (1 << 3)
29
30/**********************
31 * TYPEDEFS
32 **********************/
33
34/*Can't include lv_obj.h because it includes this header file*/
35struct _lv_obj_t;
36
37typedef enum {
38 LV_FLEX_ALIGN_START,
39 LV_FLEX_ALIGN_END,
40 LV_FLEX_ALIGN_CENTER,
41 LV_FLEX_ALIGN_SPACE_EVENLY,
42 LV_FLEX_ALIGN_SPACE_AROUND,
43 LV_FLEX_ALIGN_SPACE_BETWEEN,
44} lv_flex_align_t;
45
46typedef enum {
47 LV_FLEX_FLOW_ROW = 0x00,
48 LV_FLEX_FLOW_COLUMN = _LV_FLEX_COLUMN,
49 LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP,
50 LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_REVERSE,
51 LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP | _LV_FLEX_REVERSE,
52 LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP,
53 LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_REVERSE,
54 LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP | _LV_FLEX_REVERSE,
55} lv_flex_flow_t;
56
57/**********************
58 * GLOBAL VARIABLES
59 **********************/
60extern uint16_t LV_LAYOUT_FLEX;
61extern lv_style_prop_t LV_STYLE_FLEX_FLOW;
62extern lv_style_prop_t LV_STYLE_FLEX_MAIN_PLACE;
63extern lv_style_prop_t LV_STYLE_FLEX_CROSS_PLACE;
64extern lv_style_prop_t LV_STYLE_FLEX_TRACK_PLACE;
65extern lv_style_prop_t LV_STYLE_FLEX_GROW;
66
67/**********************
68 * GLOBAL PROTOTYPES
69 **********************/
70
75void lv_flex_init(void);
76
82void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow);
83
91void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
92 lv_flex_align_t track_cross_place);
93
99void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow);
100
101void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value);
102void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value);
103void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value);
104void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value);
105void lv_style_set_flex_grow(lv_style_t * style, uint8_t value);
106void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector);
107void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
108void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
109void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
110void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector);
111
112static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part)
113{
114 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW);
115 return (lv_flex_flow_t)v.num;
116}
117
118static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part)
119{
120 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE);
121 return (lv_flex_align_t)v.num;
122}
123
124static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part)
125{
126 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE);
127 return (lv_flex_align_t)v.num;
128}
129
130static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part)
131{
132 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE);
133 return (lv_flex_align_t)v.num;
134}
135
136static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part)
137{
138 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW);
139 return (uint8_t)v.num;
140}
141
142/**********************
143 * MACROS
144 **********************/
145
146#endif /*LV_USE_FLEX*/
147
148#ifdef __cplusplus
149} /*extern "C"*/
150#endif
151
152#endif /*LV_FLEX_H*/
lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t *obj, lv_part_t part, lv_style_prop_t prop)
lv_style_prop_t
Definition lv_style.h:178
Definition lv_obj.h:174
Definition lv_style.h:318
Definition lv_style.h:167
int32_t num
Definition lv_style.h:168