mikroSDK Reference Manual
lv_keyboard.h
Go to the documentation of this file.
1
6#ifndef LV_KEYBOARD_H
7#define LV_KEYBOARD_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
17
18#if LV_USE_KEYBOARD
19
20/*Testing of dependencies*/
21#if LV_USE_BTNMATRIX == 0
22#error "lv_kb: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
23#endif
24
25#if LV_USE_TEXTAREA == 0
26#error "lv_kb: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
27#endif
28
29/*********************
30 * DEFINES
31 *********************/
32#define LV_KEYBOARD_CTRL_BTN_FLAGS (LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_CHECKED)
33
34/**********************
35 * TYPEDEFS
36 **********************/
37
39enum {
40 LV_KEYBOARD_MODE_TEXT_LOWER,
41 LV_KEYBOARD_MODE_TEXT_UPPER,
42 LV_KEYBOARD_MODE_SPECIAL,
43 LV_KEYBOARD_MODE_NUMBER,
44 LV_KEYBOARD_MODE_USER_1,
45 LV_KEYBOARD_MODE_USER_2,
46 LV_KEYBOARD_MODE_USER_3,
47 LV_KEYBOARD_MODE_USER_4,
48};
49typedef uint8_t lv_keyboard_mode_t;
50
51/*Data of keyboard*/
52typedef struct {
53 lv_btnmatrix_t btnm;
54 lv_obj_t * ta; /*Pointer to the assigned text area*/
55 lv_keyboard_mode_t mode; /*Key map type*/
56 uint8_t popovers : 1; /*Show button titles in popovers on press*/
57} lv_keyboard_t;
58
59extern const lv_obj_class_t lv_keyboard_class;
60
61/**********************
62 * GLOBAL PROTOTYPES
63 **********************/
64
70lv_obj_t * lv_keyboard_create(lv_obj_t * parent);
71
72/*=====================
73 * Setter functions
74 *====================*/
75
81void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta);
82
88void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
89
95void lv_keyboard_set_popovers(lv_obj_t * kb, bool en);
96
104void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[],
105 const lv_btnmatrix_ctrl_t ctrl_map[]);
106
107/*=====================
108 * Getter functions
109 *====================*/
110
116lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb);
117
123lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb);
124
130bool lv_btnmatrix_get_popovers(const lv_obj_t * obj);
131
137static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb)
138{
139 return lv_btnmatrix_get_map(kb);
140}
141
148static inline uint16_t lv_keyboard_get_selected_btn(const lv_obj_t * obj)
149{
150 return lv_btnmatrix_get_selected_btn(obj);
151}
152
159static inline const char * lv_keyboard_get_btn_text(const lv_obj_t * obj, uint16_t btn_id)
160{
161 return lv_btnmatrix_get_btn_text(obj, btn_id);
162}
163
164/*=====================
165 * Other functions
166 *====================*/
167
175void lv_keyboard_def_event_cb(lv_event_t * e);
176
177/**********************
178 * MACROS
179 **********************/
180
181#endif /*LV_USE_KEYBOARD*/
182
183#ifdef __cplusplus
184} /*extern "C"*/
185#endif
186
187#endif /*LV_KEYBOARD_H*/
Definition lv_event.h:94
Definition lv_obj_class.h:49
Definition lv_obj.h:174