mikroSDK Reference Manual
lv_grid.h
Go to the documentation of this file.
1
6#ifndef LV_GRID_H
7#define LV_GRID_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
17#if LV_USE_GRID
18
19/*********************
20 * DEFINES
21 *********************/
27#define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x)
28
29#define LV_GRID_CONTENT (LV_COORD_MAX - 101)
30LV_EXPORT_CONST_INT(LV_GRID_CONTENT);
31
32#define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX)
33LV_EXPORT_CONST_INT(LV_GRID_TEMPLATE_LAST);
34
35/**********************
36 * TYPEDEFS
37 **********************/
38
39/*Can't include lv_obj.h because it includes this header file*/
40struct _lv_obj_t;
41
42typedef enum {
43 LV_GRID_ALIGN_START,
44 LV_GRID_ALIGN_CENTER,
45 LV_GRID_ALIGN_END,
46 LV_GRID_ALIGN_STRETCH,
47 LV_GRID_ALIGN_SPACE_EVENLY,
48 LV_GRID_ALIGN_SPACE_AROUND,
49 LV_GRID_ALIGN_SPACE_BETWEEN,
50} lv_grid_align_t;
51
52/**********************
53 * GLOBAL VARIABLES
54 **********************/
55
56extern uint16_t LV_LAYOUT_GRID;
57extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
58extern lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN;
59extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
60extern lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN;
61extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_POS;
62extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_SPAN;
63extern lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN;
64extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS;
65extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN;
66extern lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN;
67
68/**********************
69 * GLOBAL PROTOTYPES
70 **********************/
71
72void lv_grid_init(void);
73
74void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]);
75
76void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align);
77
88void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span,
89 lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span);
90
94static inline lv_coord_t lv_grid_fr(uint8_t x)
95{
96 return LV_GRID_FR(x);
97}
98
99void lv_style_set_grid_row_dsc_array(lv_style_t * style, const lv_coord_t value[]);
100void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_coord_t value[]);
101void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value);
102void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value);
103void lv_style_set_grid_cell_column_pos(lv_style_t * style, lv_coord_t value);
104void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value);
105void lv_style_set_grid_cell_row_pos(lv_style_t * style, lv_coord_t value);
106void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_t value);
107void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_coord_t value);
108void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_coord_t value);
109
110void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector);
111void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector);
112void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);
113void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);
114void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
115void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
116void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
117void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
118void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
119void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
120
121static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part)
122{
123 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY);
124 return (const lv_coord_t *)v.ptr;
125}
126
127static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part)
128{
129 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY);
130 return (const lv_coord_t *)v.ptr;
131}
132
133static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, uint32_t part)
134{
135 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN);
136 return (lv_grid_align_t)v.num;
137}
138
139static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, uint32_t part)
140{
141 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN);
142 return (lv_grid_align_t)v.num;
143}
144
145static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part)
146{
147 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS);
148 return (lv_coord_t)v.num;
149}
150
151static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part)
152{
153 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN);
154 return (lv_coord_t)v.num;
155}
156
157static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part)
158{
159 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS);
160 return (lv_coord_t)v.num;
161}
162
163static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part)
164{
165 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN);
166 return (lv_coord_t)v.num;
167}
168
169static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part)
170{
171 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN);
172 return (lv_coord_t)v.num;
173}
174
175static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part)
176{
177 lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN);
178 return (lv_coord_t)v.num;
179}
180
181/**********************
182 * GLOBAL VARIABLES
183 **********************/
184
185/**********************
186 * MACROS
187 **********************/
188#endif /*LV_USE_GRID*/
189
190#ifdef __cplusplus
191} /*extern "C"*/
192#endif
193
194#endif /*LV_GRID_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
const void * ptr
Definition lv_style.h:169
int32_t num
Definition lv_style.h:168