lv_obj_style.h
Typedefs
-
typedef uint32_t lv_style_selector_t
Enums
Functions
-
void lv_obj_add_style(lv_obj_t *obj, const lv_style_t *style, lv_style_selector_t selector)
-
bool lv_obj_replace_style(lv_obj_t *obj, const lv_style_t *old_style, const lv_style_t *new_style, lv_style_selector_t selector)
-
void lv_obj_remove_style(lv_obj_t *obj, const lv_style_t *style, lv_style_selector_t selector)
-
void lv_obj_remove_style_all(lv_obj_t *obj)
Remove all styles from an object
- 参数:
obj -- pointer to an object
-
void lv_obj_report_style_change(lv_style_t *style)
Notify all object if a style is modified
- 参数:
style -- pointer to a style. Only the objects with this style will be notified (NULL to notify all objects)
-
void lv_obj_refresh_style(lv_obj_t *obj, lv_part_t part, lv_style_prop_t prop)
Notify an object and its children about its style is modified.
- 参数:
obj -- pointer to an object
part -- the part whose style was changed. E.g.
LV_PART_ANY
,LV_PART_MAIN
prop --
LV_STYLE_PROP_ANY
or anLV_STYLE_...
property. It is used to optimize what needs to be refreshed.LV_STYLE_PROP_INV
to perform only a style cache update
-
void lv_obj_enable_style_refresh(bool en)
Enable or disable automatic style refreshing when a new style is added/removed to/from an object or any other style change happens.
- 参数:
en -- true: enable refreshing; false: disable refreshing
-
lv_style_value_t lv_obj_get_style_prop(const lv_obj_t *obj, lv_part_t part, lv_style_prop_t prop)
Get the value of a style property. The current state of the object will be considered. Inherited properties will be inherited. If a property is not set a default value will be returned.
- 参数:
obj -- pointer to an object
part -- a part from which the property should be get
prop -- the property to get
- 返回:
the value of the property. Should be read from the correct field of the
lv_style_value_t
according to the type of the property.
-
bool lv_obj_has_style_prop(const lv_obj_t *obj, lv_style_selector_t selector, lv_style_prop_t prop)
Check if an object has a specified style property for a given style selector.
- 参数:
obj -- pointer to an object
selector -- the style selector to be checked, defining the scope of the style to be examined.
prop -- the property to be checked.
- 返回:
true if the object has the specified selector and property, false otherwise.
-
void lv_obj_set_local_style_prop(lv_obj_t *obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector)
Set local style property on an object's part and state.
- 参数:
obj -- pointer to an object
prop -- the property
value -- value of the property. The correct element should be set according to the type of the property
selector -- OR-ed value of parts and state for which the style should be set
-
lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t *obj, lv_style_prop_t prop, lv_style_value_t *value, lv_style_selector_t selector)
-
bool lv_obj_remove_local_style_prop(lv_obj_t *obj, lv_style_prop_t prop, lv_style_selector_t selector)
Remove a local style property from a part of an object with a given state.
- 参数:
obj -- pointer to an object
prop -- a style property to remove.
selector -- OR-ed value of parts and state for which the style should be removed
- 返回:
true the property was found and removed; false: the property was not found
-
lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t *obj, lv_part_t part, lv_style_value_t v)
Used internally for color filtering
-
void lv_obj_fade_in(lv_obj_t *obj, uint32_t time, uint32_t delay)
Fade in an an object and all its children.
- 参数:
obj -- the object to fade in
time -- time of fade
delay -- delay to start the animation
-
void lv_obj_fade_out(lv_obj_t *obj, uint32_t time, uint32_t delay)
Fade out an an object and all its children.
- 参数:
obj -- the object to fade out
time -- time of fade
delay -- delay to start the animation
-
static inline lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector)
-
static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector)
-
static inline void lv_obj_set_style_pad_all(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_pad_hor(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_pad_ver(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_margin_all(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_margin_hor(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_margin_ver(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_pad_gap(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_size(lv_obj_t *obj, int32_t width, int32_t height, lv_style_selector_t selector)
-
static inline void lv_obj_set_style_transform_scale(lv_obj_t *obj, int32_t value, lv_style_selector_t selector)
-
lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t *obj, lv_part_t part, const char *txt)
-
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t *obj, lv_part_t part)
Get the
opa
style property from all parents and multiply and>> 8
them.- 参数:
obj -- the object whose opacity should be get
part -- the part whose opacity should be get. Non-MAIN parts will consider the
opa
of the MAIN part too
- 返回:
the final opacity considering the parents' opacity too