1 /**
2 * @file lv_btn.c
3 *
4 */
5
6 /*********************
7 * INCLUDES
8 *********************/
9
10 #include "lv_btn.h"
11 #if LV_USE_BTN != 0
12
13 #include "../extra/layouts/flex/lv_flex.h"
14
15 /*********************
16 * DEFINES
17 *********************/
18 #define MY_CLASS &lv_btn_class
19
20 /**********************
21 * TYPEDEFS
22 **********************/
23
24 /**********************
25 * STATIC PROTOTYPES
26 **********************/
27 static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
28
29 /**********************
30 * STATIC VARIABLES
31 **********************/
32 const lv_obj_class_t lv_btn_class = {
33 .constructor_cb = lv_btn_constructor,
34 .width_def = LV_SIZE_CONTENT,
35 .height_def = LV_SIZE_CONTENT,
36 .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
37 .instance_size = sizeof(lv_btn_t),
38 .base_class = &lv_obj_class
39 };
40
41 /**********************
42 * MACROS
43 **********************/
44
45 /**********************
46 * GLOBAL FUNCTIONS
47 **********************/
48
lv_btn_create(lv_obj_t * parent)49 lv_obj_t * lv_btn_create(lv_obj_t * parent)
50 {
51 LV_LOG_INFO("begin");
52 lv_obj_t * obj = lv_obj_class_create_obj(MY_CLASS, parent);
53 lv_obj_class_init_obj(obj);
54 return obj;
55 }
56
57 /**********************
58 * STATIC FUNCTIONS
59 **********************/
60
lv_btn_constructor(const lv_obj_class_t * class_p,lv_obj_t * obj)61 static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
62 {
63 LV_UNUSED(class_p);
64 LV_TRACE_OBJ_CREATE("begin");
65
66 lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
67 lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
68
69 LV_TRACE_OBJ_CREATE("finished");
70 }
71
72 #endif
73