mikroSDK Reference Manual
lv_table.h
Go to the documentation of this file.
1
6#ifndef LV_TABLE_H
7#define LV_TABLE_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_TABLE != 0
19
20/*Testing of dependencies*/
21#if LV_USE_LABEL == 0
22#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
23#endif
24
25#include "../core/lv_obj.h"
26#include "lv_label.h"
27
28/*********************
29 * DEFINES
30 *********************/
31#define LV_TABLE_CELL_NONE 0XFFFF
32LV_EXPORT_CONST_INT(LV_TABLE_CELL_NONE);
33
34/**********************
35 * TYPEDEFS
36 **********************/
37
38enum {
39 LV_TABLE_CELL_CTRL_MERGE_RIGHT = 1 << 0,
40 LV_TABLE_CELL_CTRL_TEXT_CROP = 1 << 1,
41 LV_TABLE_CELL_CTRL_CUSTOM_1 = 1 << 4,
42 LV_TABLE_CELL_CTRL_CUSTOM_2 = 1 << 5,
43 LV_TABLE_CELL_CTRL_CUSTOM_3 = 1 << 6,
44 LV_TABLE_CELL_CTRL_CUSTOM_4 = 1 << 7,
45};
46
47typedef uint8_t lv_table_cell_ctrl_t;
48
49/*Data of table*/
50typedef struct {
51 lv_obj_t obj;
52 uint16_t col_cnt;
53 uint16_t row_cnt;
54 char ** cell_data;
55 lv_coord_t * row_h;
56 lv_coord_t * col_w;
57 uint16_t col_act;
58 uint16_t row_act;
59} lv_table_t;
60
61extern const lv_obj_class_t lv_table_class;
62
67typedef enum {
68 LV_TABLE_DRAW_PART_CELL,
69} lv_table_draw_part_type_t;
70
71/**********************
72 * GLOBAL PROTOTYPES
73 **********************/
74
80lv_obj_t * lv_table_create(lv_obj_t * parent);
81
82/*=====================
83 * Setter functions
84 *====================*/
85
94void lv_table_set_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col, const char * txt);
95
104void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, const char * fmt, ...);
105
111void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt);
112
118void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt);
119
126void lv_table_set_col_width(lv_obj_t * obj, uint16_t col_id, lv_coord_t w);
127
135void lv_table_add_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl);
136
137
145void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl);
146
147/*=====================
148 * Getter functions
149 *====================*/
150
158const char * lv_table_get_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col);
159
165uint16_t lv_table_get_row_cnt(lv_obj_t * obj);
166
172uint16_t lv_table_get_col_cnt(lv_obj_t * obj);
173
180lv_coord_t lv_table_get_col_width(lv_obj_t * obj, uint16_t col);
181
190bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl);
191
198void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col);
199
200/**********************
201 * MACROS
202 **********************/
203
204#endif /*LV_USE_TABLE*/
205
206#ifdef __cplusplus
207} /*extern "C"*/
208#endif
209
210#endif /*LV_TABLE_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174