mikroSDK Reference Manual
lv_dropdown.h
Go to the documentation of this file.
1
6#ifndef LV_DROPDOWN_H
7#define LV_DROPDOWN_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include "../lv_conf_internal.h"
17
18#if LV_USE_DROPDOWN != 0
19
20/*Testing of dependencies*/
21
22#if LV_USE_LABEL == 0
23#error "lv_dropdown: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
24#endif
25
26#include "../widgets/lv_label.h"
27
28/*********************
29 * DEFINES
30 *********************/
31#define LV_DROPDOWN_POS_LAST 0xFFFF
32LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST);
33
34/**********************
35 * TYPEDEFS
36 **********************/
37
38typedef struct {
39 lv_obj_t obj;
40 lv_obj_t * list;
41 const char * text;
42 const void * symbol;
43 char * options;
44 uint16_t option_cnt;
45 uint16_t sel_opt_id;
46 uint16_t sel_opt_id_orig;
47 uint16_t pr_opt_id;
48 lv_dir_t dir : 4;
49 uint8_t static_txt : 1;
50 uint8_t selected_highlight: 1;
51} lv_dropdown_t;
52
53typedef struct {
54 lv_obj_t obj;
55 lv_obj_t * dropdown;
56} lv_dropdown_list_t;
57
58extern const lv_obj_class_t lv_dropdown_class;
59extern const lv_obj_class_t lv_dropdownlist_class;
60
61/**********************
62 * GLOBAL PROTOTYPES
63 **********************/
64
70lv_obj_t * lv_dropdown_create(lv_obj_t * parent);
71
72/*=====================
73 * Setter functions
74 *====================*/
75
83void lv_dropdown_set_text(lv_obj_t * obj, const char * txt);
84
91void lv_dropdown_set_options(lv_obj_t * obj, const char * options);
92
99void lv_dropdown_set_options_static(lv_obj_t * obj, const char * options);
100
107void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos);
108
113void lv_dropdown_clear_options(lv_obj_t * obj);
114
120void lv_dropdown_set_selected(lv_obj_t * obj, uint16_t sel_opt);
121
127void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir);
128
136void lv_dropdown_set_symbol(lv_obj_t * obj, const void * symbol);
137
143void lv_dropdown_set_selected_highlight(lv_obj_t * obj, bool en);
144
145/*=====================
146 * Getter functions
147 *====================*/
148
154lv_obj_t * lv_dropdown_get_list(lv_obj_t * obj);
155
161const char * lv_dropdown_get_text(lv_obj_t * obj);
162
168const char * lv_dropdown_get_options(const lv_obj_t * obj);
169
175uint16_t lv_dropdown_get_selected(const lv_obj_t * obj);
176
182uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * obj);
183
190void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size);
191
198int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option);
199
205const char * lv_dropdown_get_symbol(lv_obj_t * obj);
206
212bool lv_dropdown_get_selected_highlight(lv_obj_t * obj);
213
219lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj);
220
221/*=====================
222 * Other functions
223 *====================*/
224
229void lv_dropdown_open(lv_obj_t * dropdown_obj);
230
235void lv_dropdown_close(lv_obj_t * obj);
236
242bool lv_dropdown_is_open(lv_obj_t * obj);
243
244/**********************
245 * MACROS
246 **********************/
247
248#endif /*LV_USE_DROPDOWN*/
249
250#ifdef __cplusplus
251} /*extern "C"*/
252#endif
253
254#endif /*LV_DROPDOWN_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174