1 /**
2  * @file lv_switch.h
3  *
4  */
5 
6 #ifndef LV_SWITCH_H
7 #define LV_SWITCH_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../lv_conf_internal.h"
17 
18 #if LV_USE_SWITCH != 0
19 
20 #include "../../core/lv_obj.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 
26 /** Switch knob extra area correction factor */
27 #define LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2
28 
29 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class;
30 
31 /**********************
32  *      TYPEDEFS
33  **********************/
34 
35 typedef enum {
36     LV_SWITCH_ORIENTATION_AUTO,
37     LV_SWITCH_ORIENTATION_HORIZONTAL,
38     LV_SWITCH_ORIENTATION_VERTICAL
39 } lv_switch_orientation_t;
40 
41 /**********************
42  * GLOBAL PROTOTYPES
43  **********************/
44 
45 /**
46  * Create a switch object
47  * @param parent    pointer to an object, it will be the parent of the new switch
48  * @return          pointer to the created switch
49  */
50 lv_obj_t * lv_switch_create(lv_obj_t * parent);
51 
52 /*=====================
53  * Setter functions
54  *====================*/
55 
56 /**
57  * Set the orientation of switch.
58  * @param obj           pointer to switch object
59  * @param orientation   switch orientation from `lv_switch_orientation_t`
60  */
61 void lv_switch_set_orientation(lv_obj_t * obj, lv_switch_orientation_t orientation);
62 
63 /*=====================
64  * Getter functions
65  *====================*/
66 
67 /**
68  * Get the orientation of switch.
69  * @param obj       pointer to switch object
70  * @return          switch orientation from ::lv_switch_orientation_t
71  */
72 lv_switch_orientation_t lv_switch_get_orientation(lv_obj_t * obj);
73 
74 /**********************
75  *      MACROS
76  **********************/
77 
78 #endif /*LV_USE_SWITCH*/
79 
80 #ifdef __cplusplus
81 } /*extern "C"*/
82 #endif
83 
84 #endif /*LV_SWITCH_H*/
85