1 /**
2 * @file lv_templ.c
3 *
4 */
5
6 /**
7 * TODO Remove these instructions
8 * Search and replace: templ -> object short name with lower case(e.g. btn, label etc)
9 * TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.)
10 *
11 * You can remove the defined() clause from the #if statement below. This exists because
12 * LV_USE_TEMPL is not in lv_conf.h or lv_conf_template.h by default.
13 */
14
15 /*********************
16 * INCLUDES
17 *********************/
18 //#include "lv_templ.h" /*TODO uncomment this*/
19
20 #if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0
21
22 /*********************
23 * DEFINES
24 *********************/
25 #define MY_CLASS &lv_templ_class
26
27 /**********************
28 * TYPEDEFS
29 **********************/
30
31 /**********************
32 * STATIC PROTOTYPES
33 **********************/
34 static void lv_templ_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
35 static void lv_templ_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
36 static void lv_templ_event(const lv_obj_class_t * class_p, lv_event_t * e);
37
38 /**********************
39 * STATIC VARIABLES
40 **********************/
41 const lv_obj_class_t lv_templ_class = {
42 .constructor_cb = lv_templ_constructor,
43 .destructor_cb = lv_templ_destructor,
44 .event_cb = lv_templ_event,
45 .width_def = LV_DPI_DEF,
46 .height_def = LV_DPI_DEF,
47 .instance_size = sizeof(lv_templ_t),
48 .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT,
49 .editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
50 .base_class = &lv_templ_class
51 };
52
53 /**********************
54 * MACROS
55 **********************/
56
57 /**********************
58 * GLOBAL FUNCTIONS
59 **********************/
60
lv_templ_create(lv_obj_t * parent)61 lv_obj_t * lv_templ_create(lv_obj_t * parent)
62 {
63
64 LV_LOG_INFO("begin");
65 lv_obj_t * obj = lv_obj_class_create_obj(MY_CLASS, parent);
66 lv_obj_class_init_obj(obj);
67 return obj;
68 }
69
70 /*======================
71 * Add/remove functions
72 *=====================*/
73
74 /*
75 * New object specific "add" or "remove" functions come here
76 */
77
78 /*=====================
79 * Setter functions
80 *====================*/
81
82 /*
83 * New object specific "set" functions come here
84 */
85
86 /*=====================
87 * Getter functions
88 *====================*/
89
90 /*
91 * New object specific "get" functions come here
92 */
93
94 /*=====================
95 * Other functions
96 *====================*/
97
98 /*
99 * New object specific "other" functions come here
100 */
101
102 /**********************
103 * STATIC FUNCTIONS
104 **********************/
105
lv_templ_constructor(const lv_obj_class_t * class_p,lv_obj_t * obj)106 static void lv_templ_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
107 {
108 LV_UNUSED(class_p);
109 LV_TRACE_OBJ_CREATE("begin");
110
111 lv_templ_t * templ = (lv_templ_t *)obj;
112 /*Initialize the widget's data*/
113
114 LV_TRACE_OBJ_CREATE("finished");
115 }
116
lv_templ_destructor(const lv_obj_class_t * class_p,lv_obj_t * obj)117 static void lv_templ_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
118 {
119 lv_templ_t * templ = (lv_templ_t *)obj;
120 /*Free the widget specific data*/
121 }
122
lv_templ_event(const lv_obj_class_t * class_p,lv_event_t * e)123 static void lv_templ_event(const lv_obj_class_t * class_p, lv_event_t * e)
124 {
125 LV_UNUSED(class_p);
126
127 lv_res_t res;
128
129 /*Call the ancestor's event handler*/
130 res = lv_obj_event_base(MY_CLASS, e);
131 if(res != LV_RES_OK) return;
132
133 /*Add the widget specific event handling here*/
134 }
135
136 #else /*Enable this file at the top*/
137
138 /*This dummy typedef exists purely to silence -Wpedantic.*/
139 typedef int keep_pedantic_happy;
140 #endif
141