1 /**
2  * @file lv_xml_component.h
3  *
4  */
5 
6 #ifndef LV_LABEL_XML_COMPONENT_H
7 #define LV_LABEL_XML_COMPONENT_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../misc/lv_types.h"
17 #if LV_USE_XML
18 
19 /**********************
20  *      TYPEDEFS
21  **********************/
22 
23 /**********************
24  * GLOBAL PROTOTYPES
25  **********************/
26 
27 /**
28  * Process a component during parsing an XML. It create a widget and apply all the attributes
29  * @param state     the current parsing state
30  * @param name      name of the component
31  * @param attrs     attributes of the widget
32  * @return
33  */
34 lv_obj_t * lv_xml_component_process(lv_xml_parser_state_t * state, const char * name, const char ** attrs);
35 
36 /**
37  * Load the styles, constants, another data of the component. It needs to be called only once for each component.
38  * @param name      the name as the component will be referenced later in other components
39  * @param xml_def   the XML definition of the component as a NULL terminated string
40  * @return          LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
41  */
42 lv_result_t lv_xml_component_register_from_data(const char * name, const char * xml_def);
43 
44 /**
45  * Load the styles, constants, another data of the component. It needs to be called only once for each component.
46  * @param path      path to an XML file
47  * @return          LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
48  */
49 lv_result_t lv_xml_component_register_from_file(const char * path);
50 
51 /**
52  * Get the ctx of a component which was registered by
53  * `lv_xml_component_register_from_data` or `lv_xml_component_register_from_file`
54  * @param component_name    name of the component
55  * @return                  pointer the ctx or NULL if not found
56  */
57 lv_xml_component_ctx_t * lv_xml_component_get_ctx(const char * component_name);
58 
59 /**
60  * Remove a component from from the list.
61  * @param name      the name of the component (used during registration)
62  * @return          LV_RESULT_OK on successful  unregistration, LV_RESULT_INVALID otherwise.
63  */
64 lv_result_t lv_xml_component_unregister(const char * name);
65 
66 /**********************
67  *      MACROS
68  **********************/
69 
70 #endif /* LV_USE_XML */
71 
72 #ifdef __cplusplus
73 } /*extern "C"*/
74 #endif
75 
76 #endif /*LV_XML_COMPONENT_H*/
77 
78 
79