LittlevGL  3.20.00.19
lv_tabview.h
Go to the documentation of this file.
1 
6 #ifndef LV_TABVIEW_H
7 #define LV_TABVIEW_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  * INCLUDES
15  *********************/
16 #ifdef LV_CONF_INCLUDE_SIMPLE
17 #include "lv_conf.h"
18 #else
19 #include "../../../lv_conf.h"
20 #endif
21 
22 #if LV_USE_TABVIEW != 0
23 
24 /*Testing of dependencies*/
25 #if LV_USE_BTNM == 0
26 #error "lv_tabview: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNM 1) "
27 #endif
28 
29 #if LV_USE_PAGE == 0
30 #error "lv_tabview: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
31 #endif
32 
33 #include "../lv_core/lv_obj.h"
34 #include "../lv_objx/lv_win.h"
35 #include "../lv_objx/lv_page.h"
36 
37 /*********************
38  * DEFINES
39  *********************/
40 
41 /**********************
42  * TYPEDEFS
43  **********************/
44 
46 enum { LV_TABVIEW_BTNS_POS_TOP, LV_TABVIEW_BTNS_POS_BOTTOM, LV_TABVIEW_BTNS_POS_LEFT, LV_TABVIEW_BTNS_POS_RIGHT };
47 typedef uint8_t lv_tabview_btns_pos_t;
48 
49 /*Data of tab*/
50 typedef struct
51 {
52  /*Ext. of ancestor*/
53  /*New data for this type */
54  lv_obj_t * btns;
55  lv_obj_t * indic;
56  lv_obj_t * content; /*A rectangle to show the current tab*/
57  const char ** tab_name_ptr;
58  lv_point_t point_last;
59  uint16_t tab_cur;
60  uint16_t tab_cnt;
61 #if LV_USE_ANIMATION
62  uint16_t anim_time;
63 #endif
64  uint8_t slide_enable : 1; /*1: enable horizontal sliding by touch pad*/
65  uint8_t draging : 1;
66  uint8_t drag_hor : 1;
67  uint8_t scroll_ver : 1;
68  uint8_t btns_hide : 1;
69  lv_tabview_btns_pos_t btns_pos : 2;
70 } lv_tabview_ext_t;
71 
72 enum {
73  LV_TABVIEW_STYLE_BG,
74  LV_TABVIEW_STYLE_INDIC,
75  LV_TABVIEW_STYLE_BTN_BG,
76  LV_TABVIEW_STYLE_BTN_REL,
77  LV_TABVIEW_STYLE_BTN_PR,
78  LV_TABVIEW_STYLE_BTN_TGL_REL,
79  LV_TABVIEW_STYLE_BTN_TGL_PR,
80 };
81 typedef uint8_t lv_tabview_style_t;
82 
83 /**********************
84  * GLOBAL PROTOTYPES
85  **********************/
86 
93 lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy);
94 
99 void lv_tabview_clean(lv_obj_t * obj);
100 
101 /*======================
102  * Add/remove functions
103  *=====================*/
104 
111 lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name);
112 
113 /*=====================
114  * Setter functions
115  *====================*/
116 
123 void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
124 
130 void lv_tabview_set_sliding(lv_obj_t * tabview, bool en);
131 
137 void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time);
138 
145 void lv_tabview_set_style(lv_obj_t * tabview, lv_tabview_style_t type, const lv_style_t * style);
146 
152 void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos);
153 
159 void lv_tabview_set_btns_hidden(lv_obj_t * tabview, bool en);
160 
161 /*=====================
162  * Getter functions
163  *====================*/
164 
170 uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview);
171 
177 uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview);
184 lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id);
185 
191 bool lv_tabview_get_sliding(const lv_obj_t * tabview);
192 
198 uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview);
199 
206 const lv_style_t * lv_tabview_get_style(const lv_obj_t * tabview, lv_tabview_style_t type);
207 
212 lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview);
213 
219 bool lv_tabview_get_btns_hidden(const lv_obj_t * tabview);
220 
221 /**********************
222  * MACROS
223  **********************/
224 
225 #endif /*LV_USE_TABVIEW*/
226 
227 #ifdef __cplusplus
228 } /* extern "C" */
229 #endif
230 
231 #endif /*LV_TABVIEW_H*/
Definition: lv_area.h:39
Definition: lv_obj.h:184
uint8_t lv_anim_enable_t
Definition: lv_anim.h:40
struct _lv_obj_t * par
Definition: lv_obj.h:186
Definition: lv_style.h:57
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale