lv_xml_component.h

Functions

lv_obj_t *lv_xml_component_process(lv_xml_parser_state_t *state, const char *name, const char **attrs)

Process a component during parsing an XML. It create a widget and apply all the attributes

Parameters:
  • state – the current parsing state

  • name – name of the component

  • attrs – attributes of the widget

Returns:

lv_result_t lv_xml_component_register_from_data(const char *name, const char *xml_def)

Load the styles, constants, another data of the component. It needs to be called only once for each component.

Parameters:
  • name – the name as the component will be referenced later in other components

  • xml_def – the XML definition of the component as a NULL terminated string

Returns:

LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise

lv_result_t lv_xml_component_register_from_file(const char *path)

Load the styles, constants, another data of the component. It needs to be called only once for each component.

Parameters:

path – path to an XML file

Returns:

LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise

lv_xml_component_ctx_t *lv_xml_component_get_ctx(const char *component_name)

Get the ctx of a component which was registered by lv_xml_component_register_from_data or lv_xml_component_register_from_file

Parameters:

component_name – name of the component

Returns:

pointer the ctx or NULL if not found

lv_result_t lv_xml_component_unregister(const char *name)

Remove a component from from the list.

Parameters:

name – the name of the component (used during registration)

Returns:

LV_RESULT_OK on successful unregistration, LV_RESULT_INVALID otherwise.