mikroSDK Reference Manual
lv_obj_style.h
Go to the documentation of this file.
1
6#ifndef LV_OBJ_STYLE_H
7#define LV_OBJ_STYLE_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include <stdint.h>
17#include <stdbool.h>
18#include "../misc/lv_bidi.h"
19
20/*********************
21 * DEFINES
22 *********************/
23
24/**********************
25 * TYPEDEFS
26 **********************/
27/*Can't include lv_obj.h because it includes this header file*/
28struct _lv_obj_t;
29
30typedef enum {
31 _LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
32 _LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/
33 _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/
34 _LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/
35} _lv_style_state_cmp_t;
36
37typedef uint32_t lv_style_selector_t;
38
39typedef struct {
40 lv_style_t * style;
41 uint32_t selector : 24;
42 uint32_t is_local : 1;
43 uint32_t is_trans : 1;
45
46typedef struct {
47 uint16_t time;
48 uint16_t delay;
49 lv_style_selector_t selector;
50 lv_style_prop_t prop;
51 lv_anim_path_cb_t path_cb;
52#if LV_USE_USER_DATA
53 void * user_data;
54#endif
56
57/**********************
58 * GLOBAL PROTOTYPES
59 **********************/
60
66
75void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
76
86void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
87
92static inline void lv_obj_remove_style_all(struct _lv_obj_t * obj)
93{
94 lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY);
95}
96
103
112void lv_obj_refresh_style(struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
113
120
131lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
132
141 lv_style_selector_t selector);
142
143void lv_obj_set_local_style_prop_meta(struct _lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta,
144 lv_style_selector_t selector);
145
146lv_style_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
147 lv_style_selector_t selector);
148
156bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
157
162
171void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_state_t prev_state,
172 lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr);
173
181_lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
182
189void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
190
197void lv_obj_fade_out(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
198
199lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector);
200
201lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector);
202
203#include "lv_obj_style_gen.h"
204
205static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
206{
207 lv_obj_set_style_pad_left(obj, value, selector);
208 lv_obj_set_style_pad_right(obj, value, selector);
209 lv_obj_set_style_pad_top(obj, value, selector);
210 lv_obj_set_style_pad_bottom(obj, value, selector);
211}
212
213static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
214{
215 lv_obj_set_style_pad_left(obj, value, selector);
216 lv_obj_set_style_pad_right(obj, value, selector);
217}
218
219static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
220{
221 lv_obj_set_style_pad_top(obj, value, selector);
222 lv_obj_set_style_pad_bottom(obj, value, selector);
223}
224
225static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
226{
227 lv_obj_set_style_pad_row(obj, value, selector);
228 lv_obj_set_style_pad_column(obj, value, selector);
229}
230
231static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
232{
233 lv_obj_set_style_width(obj, value, selector);
234 lv_obj_set_style_height(obj, value, selector);
235}
236
237lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
238
239
240/**********************
241 * MACROS
242 **********************/
243
244#ifdef __cplusplus
245} /*extern "C"*/
246#endif
247
248#endif /*LV_OBJ_STYLE_H*/
int32_t(* lv_anim_path_cb_t)(const struct _lv_anim_t *)
Definition lv_anim.h:46
@ LV_STATE_ANY
Definition lv_obj.h:57
@ LV_PART_ANY
Definition lv_obj.h:80
void _lv_obj_style_init(void)
void lv_obj_refresh_style(struct _lv_obj_t *obj, lv_part_t part, lv_style_prop_t prop)
void lv_obj_fade_in(struct _lv_obj_t *obj, uint32_t time, uint32_t delay)
void lv_obj_fade_out(struct _lv_obj_t *obj, uint32_t time, uint32_t delay)
bool lv_obj_remove_local_style_prop(struct _lv_obj_t *obj, lv_style_prop_t prop, lv_style_selector_t selector)
lv_style_value_t _lv_obj_style_apply_color_filter(const struct _lv_obj_t *obj, uint32_t part, lv_style_value_t v)
void lv_obj_set_local_style_prop(struct _lv_obj_t *obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector)
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_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t *obj, lv_state_t state1, lv_state_t state2)
void lv_obj_report_style_change(lv_style_t *style)
void _lv_obj_style_create_transition(struct _lv_obj_t *obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t *tr)
void lv_obj_enable_style_refresh(bool en)
lv_style_prop_t
Definition lv_style.h:178
Definition lv_obj_style.h:39
Definition lv_obj_style.h:46
Definition lv_obj.h:174
Definition lv_style.h:318
Definition lv_style.h:167