1 /**
2 * @file lv_style.h
3 *
4 */
5
6 #ifndef LV_STYLE_H
7 #define LV_STYLE_H
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 /*********************
14 * INCLUDES
15 *********************/
16 #include <stdbool.h>
17 #include <stdint.h>
18 #include "../font/lv_font.h"
19 #include "lv_color.h"
20 #include "lv_area.h"
21 #include "lv_anim.h"
22 #include "lv_txt.h"
23 #include "lv_types.h"
24 #include "lv_assert.h"
25 #include "lv_bidi.h"
26
27 /*********************
28 * DEFINES
29 *********************/
30
31 #define LV_STYLE_SENTINEL_VALUE 0xAABBCCDD
32
33 /**
34 * Flags for style properties
35 */
36 #define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/
37 #define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/
38 #define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/
39 #define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 13) /*Requires layout update on parent when changed*/
40 #define LV_STYLE_PROP_FILTER (1 << 14) /*Apply color filter*/
41
42 /**
43 * Other constants
44 */
45 #define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/
46 LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE);
47
48 #if LV_USE_ASSERT_STYLE
49 #define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .sentinel = LV_STYLE_SENTINEL_VALUE, .v_p = { .const_props = prop_array }, .has_group = 0xFF, .is_const = 1 }
50 #else
51 #define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .v_p = { .const_props = prop_array }, .has_group = 0xFF, .is_const = 1 }
52 #endif
53
54 /** On simple system, don't waste resources on gradients */
55 #if !defined(LV_DRAW_COMPLEX) || !defined(LV_GRADIENT_MAX_STOPS)
56 #define LV_GRADIENT_MAX_STOPS 2
57 #endif
58
59
60 /**********************
61 * TYPEDEFS
62 **********************/
63
64 /**
65 * Possible options how to blend opaque drawings
66 */
67 enum {
68 LV_BLEND_MODE_NORMAL, /**< Simply mix according to the opacity value*/
69 LV_BLEND_MODE_ADDITIVE, /**< Add the respective color channels*/
70 LV_BLEND_MODE_SUBTRACTIVE,/**< Subtract the foreground from the background*/
71 LV_BLEND_MODE_MULTIPLY, /**< Multiply the foreground and background*/
72 LV_BLEND_MODE_REPLACE, /**< Replace background with foreground in the area*/
73 };
74
75 typedef uint8_t lv_blend_mode_t;
76
77 /**
78 * Some options to apply decorations on texts.
79 * 'OR'ed values can be used.
80 */
81 enum {
82 LV_TEXT_DECOR_NONE = 0x00,
83 LV_TEXT_DECOR_UNDERLINE = 0x01,
84 LV_TEXT_DECOR_STRIKETHROUGH = 0x02,
85 };
86
87 typedef uint8_t lv_text_decor_t;
88
89 /**
90 * Selects on which sides border should be drawn
91 * 'OR'ed values can be used.
92 */
93 enum {
94 LV_BORDER_SIDE_NONE = 0x00,
95 LV_BORDER_SIDE_BOTTOM = 0x01,
96 LV_BORDER_SIDE_TOP = 0x02,
97 LV_BORDER_SIDE_LEFT = 0x04,
98 LV_BORDER_SIDE_RIGHT = 0x08,
99 LV_BORDER_SIDE_FULL = 0x0F,
100 LV_BORDER_SIDE_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
101 };
102 typedef uint8_t lv_border_side_t;
103
104 /**
105 * The direction of the gradient.
106 */
107 enum {
108 LV_GRAD_DIR_NONE, /**< No gradient (the `grad_color` property is ignored)*/
109 LV_GRAD_DIR_VER, /**< Vertical (top to bottom) gradient*/
110 LV_GRAD_DIR_HOR, /**< Horizontal (left to right) gradient*/
111 };
112
113 typedef uint8_t lv_grad_dir_t;
114
115 /**
116 * The dithering algorithm for the gradient
117 * Depends on LV_DITHER_GRADIENT
118 */
119 enum {
120 LV_DITHER_NONE, /**< No dithering, colors are just quantized to the output resolution*/
121 LV_DITHER_ORDERED, /**< Ordered dithering. Faster to compute and use less memory but lower quality*/
122 LV_DITHER_ERR_DIFF, /**< Error diffusion mode. Slower to compute and use more memory but give highest dither quality*/
123 };
124
125 typedef uint8_t lv_dither_mode_t;
126
127 /** A gradient stop definition.
128 * This matches a color and a position in a virtual 0-255 scale.
129 */
130 typedef struct {
131 lv_color_t color; /**< The stop color */
132 uint8_t frac; /**< The stop position in 1/255 unit */
133 } lv_gradient_stop_t;
134
135 /** A descriptor of a gradient. */
136 typedef struct {
137 lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */
138 uint8_t stops_count; /**< The number of used stops in the array */
139 lv_grad_dir_t dir : 3; /**< The gradient direction.
140 * Any of LV_GRAD_DIR_HOR, LV_GRAD_DIR_VER, LV_GRAD_DIR_NONE */
141 lv_dither_mode_t dither : 3; /**< Whether to dither the gradient or not.
142 * Any of LV_DITHER_NONE, LV_DITHER_ORDERED, LV_DITHER_ERR_DIFF */
143 } lv_grad_dsc_t;
144
145 /**
146 * A common type to handle all the property types in the same way.
147 */
148 typedef union {
149 int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/
150 const void * ptr; /**< Constant pointers (font, cone text, etc)*/
151 lv_color_t color; /**< Colors*/
152 } lv_style_value_t;
153
154 /**
155 * Enumeration of all built in style properties
156 */
157 typedef enum {
158 LV_STYLE_PROP_INV = 0,
159
160 /*Group 0*/
161 LV_STYLE_WIDTH = 1 | LV_STYLE_PROP_LAYOUT_REFR,
162 LV_STYLE_MIN_WIDTH = 2 | LV_STYLE_PROP_LAYOUT_REFR,
163 LV_STYLE_MAX_WIDTH = 3 | LV_STYLE_PROP_LAYOUT_REFR,
164 LV_STYLE_HEIGHT = 4 | LV_STYLE_PROP_LAYOUT_REFR,
165 LV_STYLE_MIN_HEIGHT = 5 | LV_STYLE_PROP_LAYOUT_REFR,
166 LV_STYLE_MAX_HEIGHT = 6 | LV_STYLE_PROP_LAYOUT_REFR,
167 LV_STYLE_X = 7 | LV_STYLE_PROP_LAYOUT_REFR,
168 LV_STYLE_Y = 8 | LV_STYLE_PROP_LAYOUT_REFR,
169 LV_STYLE_ALIGN = 9 | LV_STYLE_PROP_LAYOUT_REFR,
170 LV_STYLE_TRANSFORM_WIDTH = 10 | LV_STYLE_PROP_EXT_DRAW,
171 LV_STYLE_TRANSFORM_HEIGHT = 11 | LV_STYLE_PROP_EXT_DRAW,
172 LV_STYLE_TRANSLATE_X = 12 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
173 LV_STYLE_TRANSLATE_Y = 13 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
174 LV_STYLE_TRANSFORM_ZOOM = 14 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
175 LV_STYLE_TRANSFORM_ANGLE = 15 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
176
177 /*Group 1*/
178 LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
179 LV_STYLE_PAD_BOTTOM = 17 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
180 LV_STYLE_PAD_LEFT = 18 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
181 LV_STYLE_PAD_RIGHT = 19 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
182 LV_STYLE_PAD_ROW = 20 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
183 LV_STYLE_PAD_COLUMN = 21 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
184
185 /*Group 2*/
186 LV_STYLE_BG_COLOR = 32,
187 LV_STYLE_BG_COLOR_FILTERED = 32 | LV_STYLE_PROP_FILTER,
188 LV_STYLE_BG_OPA = 33,
189 LV_STYLE_BG_GRAD_COLOR = 34,
190 LV_STYLE_BG_GRAD_COLOR_FILTERED = 34 | LV_STYLE_PROP_FILTER,
191 LV_STYLE_BG_GRAD_DIR = 35,
192 LV_STYLE_BG_MAIN_STOP = 36,
193 LV_STYLE_BG_GRAD_STOP = 37,
194 LV_STYLE_BG_GRAD = 38,
195 LV_STYLE_BG_DITHER_MODE = 39,
196
197
198 LV_STYLE_BG_IMG_SRC = 40 | LV_STYLE_PROP_EXT_DRAW,
199 LV_STYLE_BG_IMG_OPA = 41,
200 LV_STYLE_BG_IMG_RECOLOR = 42,
201 LV_STYLE_BG_IMG_RECOLOR_FILTERED = 42 | LV_STYLE_PROP_FILTER,
202 LV_STYLE_BG_IMG_RECOLOR_OPA = 43,
203 LV_STYLE_BG_IMG_TILED = 44,
204
205 /*Group 3*/
206 LV_STYLE_BORDER_COLOR = 48,
207 LV_STYLE_BORDER_COLOR_FILTERED = 48 | LV_STYLE_PROP_FILTER,
208 LV_STYLE_BORDER_OPA = 49,
209 LV_STYLE_BORDER_WIDTH = 50 | LV_STYLE_PROP_LAYOUT_REFR,
210 LV_STYLE_BORDER_SIDE = 51,
211 LV_STYLE_BORDER_POST = 52,
212
213 LV_STYLE_OUTLINE_WIDTH = 58 | LV_STYLE_PROP_EXT_DRAW,
214 LV_STYLE_OUTLINE_COLOR = 59,
215 LV_STYLE_OUTLINE_COLOR_FILTERED = 59 | LV_STYLE_PROP_FILTER,
216 LV_STYLE_OUTLINE_OPA = 60 | LV_STYLE_PROP_EXT_DRAW,
217 LV_STYLE_OUTLINE_PAD = 61 | LV_STYLE_PROP_EXT_DRAW,
218
219 /*Group 4*/
220 LV_STYLE_SHADOW_WIDTH = 64 | LV_STYLE_PROP_EXT_DRAW,
221 LV_STYLE_SHADOW_OFS_X = 65 | LV_STYLE_PROP_EXT_DRAW,
222 LV_STYLE_SHADOW_OFS_Y = 66 | LV_STYLE_PROP_EXT_DRAW,
223 LV_STYLE_SHADOW_SPREAD = 67 | LV_STYLE_PROP_EXT_DRAW,
224 LV_STYLE_SHADOW_COLOR = 68,
225 LV_STYLE_SHADOW_COLOR_FILTERED = 68 | LV_STYLE_PROP_FILTER,
226 LV_STYLE_SHADOW_OPA = 69 | LV_STYLE_PROP_EXT_DRAW,
227
228 LV_STYLE_IMG_OPA = 70,
229 LV_STYLE_IMG_RECOLOR = 71,
230 LV_STYLE_IMG_RECOLOR_FILTERED = 71 | LV_STYLE_PROP_FILTER,
231 LV_STYLE_IMG_RECOLOR_OPA = 72,
232
233 LV_STYLE_LINE_WIDTH = 73 | LV_STYLE_PROP_EXT_DRAW,
234 LV_STYLE_LINE_DASH_WIDTH = 74,
235 LV_STYLE_LINE_DASH_GAP = 75,
236 LV_STYLE_LINE_ROUNDED = 76,
237 LV_STYLE_LINE_COLOR = 77,
238 LV_STYLE_LINE_COLOR_FILTERED = 77 | LV_STYLE_PROP_FILTER,
239 LV_STYLE_LINE_OPA = 78,
240
241 /*Group 5*/
242 LV_STYLE_ARC_WIDTH = 80 | LV_STYLE_PROP_EXT_DRAW,
243 LV_STYLE_ARC_ROUNDED = 81,
244 LV_STYLE_ARC_COLOR = 82,
245 LV_STYLE_ARC_COLOR_FILTERED = 82 | LV_STYLE_PROP_FILTER,
246 LV_STYLE_ARC_OPA = 83,
247 LV_STYLE_ARC_IMG_SRC = 84,
248
249 LV_STYLE_TEXT_COLOR = 87 | LV_STYLE_PROP_INHERIT,
250 LV_STYLE_TEXT_COLOR_FILTERED = 87 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_FILTER,
251 LV_STYLE_TEXT_OPA = 88 | LV_STYLE_PROP_INHERIT,
252 LV_STYLE_TEXT_FONT = 89 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
253 LV_STYLE_TEXT_LETTER_SPACE = 90 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
254 LV_STYLE_TEXT_LINE_SPACE = 91 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
255 LV_STYLE_TEXT_DECOR = 92 | LV_STYLE_PROP_INHERIT,
256 LV_STYLE_TEXT_ALIGN = 93 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
257
258 /*Group 6*/
259 LV_STYLE_RADIUS = 96,
260 LV_STYLE_CLIP_CORNER = 97,
261 LV_STYLE_OPA = 98 | LV_STYLE_PROP_INHERIT,
262 LV_STYLE_COLOR_FILTER_DSC = 99,
263 LV_STYLE_COLOR_FILTER_OPA = 100,
264 LV_STYLE_ANIM_TIME = 101,
265 LV_STYLE_ANIM_SPEED = 102,
266 LV_STYLE_TRANSITION = 103,
267 LV_STYLE_BLEND_MODE = 104,
268 LV_STYLE_LAYOUT = 105 | LV_STYLE_PROP_LAYOUT_REFR,
269 LV_STYLE_BASE_DIR = 106 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
270
271 _LV_STYLE_LAST_BUILT_IN_PROP = 111,
272
273 LV_STYLE_PROP_ANY = 0xFFFF
274 } lv_style_prop_t;
275
276 /**
277 * Descriptor for style transitions
278 */
279 typedef struct {
280 const lv_style_prop_t * props; /**< An array with the properties to animate.*/
281 #if LV_USE_USER_DATA
282 void * user_data; /**< A custom user data that will be passed to the animation's user_data */
283 #endif
284 lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/
285 uint32_t time; /**< Duration of the transition in [ms]*/
286 uint32_t delay; /**< Delay before the transition in [ms]*/
287 } lv_style_transition_dsc_t;
288
289 /**
290 * Descriptor of a constant style property.
291 */
292 typedef struct {
293 lv_style_prop_t prop;
294 lv_style_value_t value;
295 } lv_style_const_prop_t;
296
297 /**
298 * Descriptor of a style (a collection of properties and values).
299 */
300 typedef struct {
301
302 #if LV_USE_ASSERT_STYLE
303 uint32_t sentinel;
304 #endif
305
306 /*If there is only one property store it directly.
307 *For more properties allocate an array*/
308 union {
309 lv_style_value_t value1;
310 uint8_t * values_and_props;
311 const lv_style_const_prop_t * const_props;
312 } v_p;
313
314 uint16_t prop1 : 15;
315 uint16_t is_const : 1;
316 uint8_t has_group;
317 uint8_t prop_cnt;
318 } lv_style_t;
319
320 /**********************
321 * GLOBAL PROTOTYPES
322 **********************/
323
324
325 /**
326 * Initialize a style
327 * @param style pointer to a style to initialize
328 * @note Do not call `lv_style_init` on styles that already have some properties
329 * because this function won't free the used memory, just sets a default state for the style.
330 * In other words be sure to initialize styles only once!
331 */
332 void lv_style_init(lv_style_t * style);
333
334 /**
335 * Clear all properties from a style and free all allocated memories.
336 * @param style pointer to a style
337 */
338 void lv_style_reset(lv_style_t * style);
339
340 /**
341 * Register a new style property for custom usage
342 * @return a new property ID.
343 * @example
344 * lv_style_prop_t MY_PROP;
345 * static inline void lv_style_set_my_prop(lv_style_t * style, lv_color_t value) {
346 * lv_style_value_t v = {.color = value}; lv_style_set_prop(style, MY_PROP, v); }
347 *
348 * ...
349 * MY_PROP = lv_style_register_prop();
350 * ...
351 * lv_style_set_my_prop(&style1, lv_palette_main(LV_PALETTE_RED));
352 */
353 lv_style_prop_t lv_style_register_prop(void);
354
355 /**
356 * Remove a property from a style
357 * @param style pointer to a style
358 * @param prop a style property ORed with a state.
359 * @return true: the property was found and removed; false: the property wasn't found
360 */
361 bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop);
362
363 /**
364 * Set the value of property in a style.
365 * This function shouldn't be used directly by the user.
366 * Instead use `lv_style_set_<prop_name>()`. E.g. `lv_style_set_bg_color()`
367 * @param style pointer to style
368 * @param prop the ID of a property (e.g. `LV_STYLE_BG_COLOR`)
369 * @param value `lv_style_value_t` variable in which a field is set according to the type of `prop`
370 */
371 void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value);
372
373 /**
374 * Get the value of a property
375 * @param style pointer to a style
376 * @param prop the ID of a property
377 * @param value pointer to a `lv_style_value_t` variable to store the value
378 * @return LV_RES_INV: the property wasn't found in the style (`value` is unchanged)
379 * LV_RES_OK: the property was fond, and `value` is set accordingly
380 * @note For performance reasons there are no sanity check on `style`
381 */
382 lv_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value);
383
384
385 /**
386 * Get the value of a property
387 * @param style pointer to a style
388 * @param prop the ID of a property
389 * @param value pointer to a `lv_style_value_t` variable to store the value
390 * @return LV_RES_INV: the property wasn't found in the style (`value` is unchanged)
391 * LV_RES_OK: the property was fond, and `value` is set accordingly
392 * @note For performance reasons there are no sanity check on `style`
393 * @note This function is the same as ::lv_style_get_prop but inlined. Use it only on performance critical places
394 */
lv_style_get_prop_inlined(const lv_style_t * style,lv_style_prop_t prop,lv_style_value_t * value)395 static inline lv_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop,
396 lv_style_value_t * value)
397 {
398 if(style->is_const) {
399 const lv_style_const_prop_t * const_prop;
400 for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) {
401 if(const_prop->prop == prop) {
402 *value = const_prop->value;
403 return LV_RES_OK;
404 }
405 }
406 return LV_RES_INV;
407 }
408
409 if(style->prop_cnt == 0) return LV_RES_INV;
410
411 if(style->prop_cnt > 1) {
412 uint8_t * tmp = style->v_p.values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
413 uint16_t * props = (uint16_t *)tmp;
414 uint32_t i;
415 for(i = 0; i < style->prop_cnt; i++) {
416 if(props[i] == prop) {
417 lv_style_value_t * values = (lv_style_value_t *)style->v_p.values_and_props;
418 *value = values[i];
419 return LV_RES_OK;
420 }
421 }
422 }
423 else if(style->prop1 == prop) {
424 *value = style->v_p.value1;
425 return LV_RES_OK;
426 }
427 return LV_RES_INV;
428 }
429
430 /**
431 * Initialize a transition descriptor.
432 * @param tr pointer to a transition descriptor to initialize
433 * @param props an array with the properties to transition. The last element must be zero.
434 * @param path_cb an animation path (ease) callback. If `NULL` liner path will be used.
435 * @param time duration of the transition in [ms]
436 * @param delay delay before the transition in [ms]
437 * @param user_data any custom data that will be saved in the transition animation and will be available when `path_cb` is called
438 * @example
439 * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 };
440 * static lv_style_transition_dsc_t trans1;
441 * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0, NULL);
442 */
443 void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[],
444 lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data);
445
446 /**
447 * Get the default value of a property
448 * @param prop the ID of a property
449 * @return the default value
450 */
451 lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop);
452
453 /**
454 * Checks if a style is empty (has no properties)
455 * @param style pointer to a style
456 * @return true if the style is empty
457 */
458 bool lv_style_is_empty(const lv_style_t * style);
459
460 /**
461 * Tell the group of a property. If the a property from a group is set in a style the (1 << group) bit of style->has_group is set.
462 * It allows early skipping the style if the property is not exists in the style at all.
463 * @param prop a style property
464 * @return the group [0..7] 7 means all the custom properties with index > 112
465 */
466 uint8_t _lv_style_get_prop_group(lv_style_prop_t prop);
467
468 #include "lv_style_gen.h"
469
lv_style_set_size(lv_style_t * style,lv_coord_t value)470 static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value)
471 {
472 lv_style_set_width(style, value);
473 lv_style_set_height(style, value);
474 }
475
lv_style_set_pad_all(lv_style_t * style,lv_coord_t value)476 static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
477 {
478 lv_style_set_pad_left(style, value);
479 lv_style_set_pad_right(style, value);
480 lv_style_set_pad_top(style, value);
481 lv_style_set_pad_bottom(style, value);
482 }
483
lv_style_set_pad_hor(lv_style_t * style,lv_coord_t value)484 static inline void lv_style_set_pad_hor(lv_style_t * style, lv_coord_t value)
485 {
486 lv_style_set_pad_left(style, value);
487 lv_style_set_pad_right(style, value);
488 }
489
lv_style_set_pad_ver(lv_style_t * style,lv_coord_t value)490 static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value)
491 {
492 lv_style_set_pad_top(style, value);
493 lv_style_set_pad_bottom(style, value);
494 }
495
lv_style_set_pad_gap(lv_style_t * style,lv_coord_t value)496 static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value)
497 {
498 lv_style_set_pad_row(style, value);
499 lv_style_set_pad_column(style, value);
500 }
501
502
503 /*************************
504 * GLOBAL VARIABLES
505 *************************/
506
507 /**********************
508 * MACROS
509 **********************/
510
511 #if LV_USE_ASSERT_STYLE
512 # define LV_ASSERT_STYLE(style_p) \
513 do { \
514 LV_ASSERT_MSG(style_p != NULL, "The style is NULL"); \
515 LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted"); \
516 } while(0)
517 #else
518 # define LV_ASSERT_STYLE(p) do{}while(0)
519 #endif
520
521 #ifdef __cplusplus
522 } /*extern "C"*/
523 #endif
524
525 #endif /*LV_STYLE_H*/
526