lv_xml_style.h
Typedefs
-
typedef struct _lv_xml_style_t lv_xml_style_t
Functions
-
void lv_xml_style_register(lv_xml_component_ctx_t *ctx, const char **attrs)
Add a style to
ctx
and set the style properties fromattrs
- Parameters:
ctx – add styles here. (Constants should be already added as style properties might use them)
attrs – list of attribute names and values
-
void lv_xml_style_add_to_obj(lv_xml_parser_state_t *state, lv_obj_t *obj, const char *text)
Add the styles to an object. Handles multiple styles and selectors too.
- Parameters:
state – the parser state
obj – the target widget
text – the styles' string, e.g. "blue red:pressed:knob"
-
lv_state_t lv_xml_style_state_to_enum(const char *txt)
Convert a style state to enum
- Parameters:
txt – e.g. "pressed"
- Returns:
the enum
LV_STATE_PRESSED
-
lv_part_t lv_xml_style_part_to_enum(const char *txt)
Convert a style part to enum
- Parameters:
txt – e.g. "knob"
- Returns:
the enum
LV_PART_KNOB
-
const char *lv_xml_style_string_process(char *txt, lv_style_selector_t *selector)
Decompose a string like
"style1:pressed:checked:knob"
to style name and selector- Parameters:
txt – the input string
selector – store the selectors here
- Returns:
the style name or
NULL
on any error
-
lv_xml_style_t *lv_xml_get_style_by_name(lv_xml_component_ctx_t *ctx, const char *name)
Find a style by name which was added by
lv_xml_style_register
- Parameters:
ctx – the default context to search in
name – the name of the style. Can start with a component name prefix (e.g.
my_button.blue
) to overwrite the ctx
- Returns:
the style structure
-
lv_grad_dsc_t *lv_xml_component_get_grad(lv_xml_component_ctx_t *ctx, const char *name)
Get a gradient descriptor defined for a component
- Parameters:
ctx – component context where the gradient should be found
name – name of the gradient
- Returns:
a gradient descriptor
-
struct _lv_xml_style_t