mikroSDK Reference Manual
lv_spinbox.h
Go to the documentation of this file.
1
6#ifndef LV_SPINBOX_H
7#define LV_SPINBOX_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include "../../../lvgl.h"
17
18#if LV_USE_SPINBOX
19
20/*Testing of dependencies*/
21#if LV_USE_TEXTAREA == 0
22#error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
23#endif
24
25/*********************
26 * DEFINES
27 *********************/
28#define LV_SPINBOX_MAX_DIGIT_COUNT 10
29
30/**********************
31 * TYPEDEFS
32 **********************/
33
34/*Data of spinbox*/
35typedef struct {
36 lv_textarea_t ta; /*Ext. of ancestor*/
37 /*New data for this type*/
38 int32_t value;
39 int32_t range_max;
40 int32_t range_min;
41 int32_t step;
42 uint16_t digit_count : 4;
43 uint16_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/
44 uint16_t rollover : 1; // Set to true for rollover functionality
45 uint16_t digit_step_dir : 2; // the direction the digit will step on encoder button press when editing
46} lv_spinbox_t;
47
48extern const lv_obj_class_t lv_spinbox_class;
49
50/**********************
51 * GLOBAL PROTOTYPES
52 **********************/
53
59lv_obj_t * lv_spinbox_create(lv_obj_t * parent);
60
61/*=====================
62 * Setter functions
63 *====================*/
64
70void lv_spinbox_set_value(lv_obj_t * obj, int32_t i);
71
77void lv_spinbox_set_rollover(lv_obj_t * obj, bool b);
78
86void lv_spinbox_set_digit_format(lv_obj_t * obj, uint8_t digit_count, uint8_t separator_position);
87
93void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step);
94
101void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max);
102
108void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint8_t pos);
109
115void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction);
116
117/*=====================
118 * Getter functions
119 *====================*/
120
125bool lv_spinbox_get_rollover(lv_obj_t * obj);
126
132int32_t lv_spinbox_get_value(lv_obj_t * obj);
133
139int32_t lv_spinbox_get_step(lv_obj_t * obj);
140
141/*=====================
142 * Other functions
143 *====================*/
144
149void lv_spinbox_step_next(lv_obj_t * obj);
150
155void lv_spinbox_step_prev(lv_obj_t * obj);
156
161void lv_spinbox_increment(lv_obj_t * obj);
162
167void lv_spinbox_decrement(lv_obj_t * obj);
168
169/**********************
170 * MACROS
171 **********************/
172
173/* It was ambiguous in MicroPython. See https://github.com/lvgl/lvgl/issues/3301
174 * TODO remove in v9*/
175#define lv_spinbox_set_pos lv_spinbox_set_cursor_pos
176
177#endif /*LV_USE_SPINBOX*/
178
179#ifdef __cplusplus
180} /*extern "C"*/
181#endif
182#endif /*LV_SPINBOX_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174