mikroSDK Reference Manual
lv_btnmatrix.h
Go to the documentation of this file.
1
6#ifndef LV_BTNMATRIX_H
7#define LV_BTNMATRIX_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_BTNMATRIX != 0
19
20#include "../core/lv_obj.h"
21
22/*********************
23 * DEFINES
24 *********************/
25#define LV_BTNMATRIX_BTN_NONE 0xFFFF
26LV_EXPORT_CONST_INT(LV_BTNMATRIX_BTN_NONE);
27
28/**********************
29 * TYPEDEFS
30 **********************/
31
34enum {
35 _LV_BTNMATRIX_WIDTH = 0x0007,
36 LV_BTNMATRIX_CTRL_HIDDEN = 0x0008,
37 LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0010,
38 LV_BTNMATRIX_CTRL_DISABLED = 0x0020,
39 LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040,
40 LV_BTNMATRIX_CTRL_CHECKED = 0x0080,
41 LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100,
42 LV_BTNMATRIX_CTRL_POPOVER = 0x0200,
43 LV_BTNMATRIX_CTRL_RECOLOR = 0x1000,
44 _LV_BTNMATRIX_CTRL_RESERVED = 0x2000,
45 LV_BTNMATRIX_CTRL_CUSTOM_1 = 0x4000,
46 LV_BTNMATRIX_CTRL_CUSTOM_2 = 0x8000,
47};
48
49typedef uint16_t lv_btnmatrix_ctrl_t;
50
51typedef bool (*lv_btnmatrix_btn_draw_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area,
52 const lv_area_t * clip_area);
53
54/*Data of button matrix*/
55typedef struct {
56 lv_obj_t obj;
57 const char ** map_p; /*Pointer to the current map*/
58 lv_area_t * button_areas; /*Array of areas of buttons*/
59 lv_btnmatrix_ctrl_t * ctrl_bits; /*Array of control bytes*/
60 uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
61 uint16_t row_cnt; /*Number of rows in 'map_p'(Handled by the library)*/
62 uint16_t btn_id_sel; /*Index of the active button (being pressed/released etc) or LV_BTNMATRIX_BTN_NONE*/
63 uint8_t one_check : 1; /*Single button toggled at once*/
64} lv_btnmatrix_t;
65
66extern const lv_obj_class_t lv_btnmatrix_class;
67
72typedef enum {
73 LV_BTNMATRIX_DRAW_PART_BTN,
74} lv_btnmatrix_draw_part_type_t;
75
76/**********************
77 * GLOBAL PROTOTYPES
78 **********************/
79
85lv_obj_t * lv_btnmatrix_create(lv_obj_t * parent);
86
87/*=====================
88 * Setter functions
89 *====================*/
90
98void lv_btnmatrix_set_map(lv_obj_t * obj, const char * map[]);
99
112void lv_btnmatrix_set_ctrl_map(lv_obj_t * obj, const lv_btnmatrix_ctrl_t ctrl_map[]);
113
119void lv_btnmatrix_set_selected_btn(lv_obj_t * obj, uint16_t btn_id);
120
127void lv_btnmatrix_set_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl);
128
135void lv_btnmatrix_clear_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl);
136
142void lv_btnmatrix_set_btn_ctrl_all(lv_obj_t * obj, lv_btnmatrix_ctrl_t ctrl);
143
150void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t * obj, lv_btnmatrix_ctrl_t ctrl);
151
161void lv_btnmatrix_set_btn_width(lv_obj_t * obj, uint16_t btn_id, uint8_t width);
162
170void lv_btnmatrix_set_one_checked(lv_obj_t * obj, bool en);
171
172/*=====================
173 * Getter functions
174 *====================*/
175
181const char ** lv_btnmatrix_get_map(const lv_obj_t * obj);
182
189uint16_t lv_btnmatrix_get_selected_btn(const lv_obj_t * obj);
190
197const char * lv_btnmatrix_get_btn_text(const lv_obj_t * obj, uint16_t btn_id);
198
206bool lv_btnmatrix_has_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl);
207
213bool lv_btnmatrix_get_one_checked(const lv_obj_t * obj);
214
215/**********************
216 * MACROS
217 **********************/
218
219#endif /*LV_USE_BTNMATRIX*/
220
221#ifdef __cplusplus
222} /*extern "C"*/
223#endif
224
225#endif /*LV_BTNMATRIX_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174
Definition lv_area.h:43