mikroSDK Reference Manual
lv_menu.h
Go to the documentation of this file.
1
6#ifndef LV_MENU_H
7#define LV_MENU_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
17
18#if LV_USE_MENU
19
20/*********************
21 * DEFINES
22 *********************/
23
24/**********************
25 * TYPEDEFS
26 **********************/
27
28enum {
29 LV_MENU_HEADER_TOP_FIXED, /* Header is positioned at the top */
30 LV_MENU_HEADER_TOP_UNFIXED, /* Header is positioned at the top and can be scrolled out of view*/
31 LV_MENU_HEADER_BOTTOM_FIXED /* Header is positioned at the bottom */
32};
33typedef uint8_t lv_menu_mode_header_t;
34
35enum {
36 LV_MENU_ROOT_BACK_BTN_DISABLED,
37 LV_MENU_ROOT_BACK_BTN_ENABLED
38};
39typedef uint8_t lv_menu_mode_root_back_btn_t;
40
41typedef struct lv_menu_load_page_event_data_t {
42 lv_obj_t * menu;
43 lv_obj_t * page;
44} lv_menu_load_page_event_data_t;
45
46typedef struct {
47 lv_obj_t * page;
48} lv_menu_history_t;
49
50typedef struct {
51 lv_obj_t obj;
52 lv_obj_t * storage; /* a pointer to obj that is the parent of all pages not displayed */
53 lv_obj_t * main;
54 lv_obj_t * main_page;
55 lv_obj_t * main_header;
56 lv_obj_t *
57 main_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'main_header' */
58 lv_obj_t * main_header_title;
59 lv_obj_t * sidebar;
60 lv_obj_t * sidebar_page;
61 lv_obj_t * sidebar_header;
62 lv_obj_t *
63 sidebar_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'sidebar_header' */
64 lv_obj_t * sidebar_header_title;
65 lv_obj_t * selected_tab;
66 lv_ll_t history_ll;
67 uint8_t cur_depth;
68 uint8_t prev_depth;
69 uint8_t sidebar_generated : 1;
70 lv_menu_mode_header_t mode_header : 2;
71 lv_menu_mode_root_back_btn_t mode_root_back_btn : 1;
72} lv_menu_t;
73
74typedef struct {
75 lv_obj_t obj;
76 char * title;
77} lv_menu_page_t;
78
79extern const lv_obj_class_t lv_menu_class;
80extern const lv_obj_class_t lv_menu_page_class;
81extern const lv_obj_class_t lv_menu_cont_class;
82extern const lv_obj_class_t lv_menu_section_class;
83extern const lv_obj_class_t lv_menu_separator_class;
84extern const lv_obj_class_t lv_menu_sidebar_cont_class;
85extern const lv_obj_class_t lv_menu_main_cont_class;
86extern const lv_obj_class_t lv_menu_sidebar_header_cont_class;
87extern const lv_obj_class_t lv_menu_main_header_cont_class;
88/**********************
89 * GLOBAL PROTOTYPES
90 **********************/
91
97lv_obj_t * lv_menu_create(lv_obj_t * parent);
98
105lv_obj_t * lv_menu_page_create(lv_obj_t * parent, char * title);
106
112lv_obj_t * lv_menu_cont_create(lv_obj_t * parent);
113
119lv_obj_t * lv_menu_section_create(lv_obj_t * parent);
120
126lv_obj_t * lv_menu_separator_create(lv_obj_t * parent);
127/*=====================
128 * Setter functions
129 *====================*/
135void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page);
136
142void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page);
143
149void lv_menu_set_mode_header(lv_obj_t * obj, lv_menu_mode_header_t mode_header);
150
156void lv_menu_set_mode_root_back_btn(lv_obj_t * obj, lv_menu_mode_root_back_btn_t mode_root_back_btn);
157
164void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * page);
165
166/*=====================
167 * Getter functions
168 *====================*/
174lv_obj_t * lv_menu_get_cur_main_page(lv_obj_t * obj);
175
181lv_obj_t * lv_menu_get_cur_sidebar_page(lv_obj_t * obj);
182
188lv_obj_t * lv_menu_get_main_header(lv_obj_t * obj);
189
195lv_obj_t * lv_menu_get_main_header_back_btn(lv_obj_t * obj);
196
202lv_obj_t * lv_menu_get_sidebar_header(lv_obj_t * obj);
203
209lv_obj_t * lv_menu_get_sidebar_header_back_btn(lv_obj_t * obj);
210
216bool lv_menu_back_btn_is_root(lv_obj_t * menu, lv_obj_t * obj);
217
222void lv_menu_clear_history(lv_obj_t * obj);
223/**********************
224 * MACROS
225 **********************/
226
227#endif /*LV_USE_MENU*/
228
229#ifdef __cplusplus
230} /*extern "C"*/
231#endif
232
233#endif /*LV_MENU_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174
Definition lv_ll.h:32