summaryrefslogtreecommitdiff
path: root/lib/luavgl/simulator/widgets/lv_pointer.h
blob: 76c273e4f8ea46f2542c6d4dc2529c8f88db1b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef LV_WIDGETS_POINTER_H_
#define LV_WIDGETS_POINTER_H_

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#include <lvgl.h>

#if LV_USE_POINTER

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

typedef struct {
    lv_img_t obj;
    int value;
    int value_start;
    int value_range;
    int angle_start;
    int angle_range;
} lv_pointer_t;

extern const lv_obj_class_t lv_pointer_class;

/**********************
 * GLOBAL PROTOTYPES
 **********************/

lv_obj_t* lv_pointer_create(lv_obj_t* parent);

/**
 * Set range parameters for pointer
 * @param value_start the value mapped to angle_start
 * @param value_range the value range, could be negative
 * @param angle_start the angle will be set then value equals to value_start
 * @param angle_range the angle range, could be negative
 */
void lv_pointer_set_range(lv_obj_t* obj, int value_start, int value_range,
                           int angle_start, int angle_range);

/**
 * Set current value pointer points to
 * @param value If value is out of range, then angle is also clampped to limits
 */
void lv_pointer_set_value(lv_obj_t* obj, int value);

/**********************
 *      MACROS
 **********************/

#endif /*  */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* LV_WIDGETS_POINTER_H_ */