Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_bar.h
1476 views
1
/**
2
* @file lv_bar.h
3
*
4
*/
5
6
#ifndef LV_BAR_H
7
#define LV_BAR_H
8
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
13
/*********************
14
* INCLUDES
15
*********************/
16
#ifdef LV_CONF_INCLUDE_SIMPLE
17
#include "lv_conf.h"
18
#else
19
#include "../../lv_conf.h"
20
#endif
21
22
#if USE_LV_BAR != 0
23
24
#include "../lv_core/lv_obj.h"
25
#include "lv_cont.h"
26
#include "lv_btn.h"
27
#include "lv_label.h"
28
29
/*********************
30
* DEFINES
31
*********************/
32
33
/**********************
34
* TYPEDEFS
35
**********************/
36
37
/*Data of bar*/
38
typedef struct
39
{
40
/*No inherited ext*/ /*Ext. of ancestor*/
41
/*New data for this type */
42
int16_t cur_value; /*Current value of the bar*/
43
int16_t min_value; /*Minimum value of the bar*/
44
int16_t max_value; /*Maximum value of the bar*/
45
uint8_t sym :1; /*Symmetric: means the center is around zero value*/
46
lv_style_t *style_indic; /*Style of the indicator*/
47
} lv_bar_ext_t;
48
49
enum {
50
LV_BAR_STYLE_BG,
51
LV_BAR_STYLE_INDIC,
52
};
53
typedef uint8_t lv_bar_style_t;
54
55
/**********************
56
* GLOBAL PROTOTYPES
57
**********************/
58
59
/**
60
* Create a bar objects
61
* @param par pointer to an object, it will be the parent of the new bar
62
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
63
* @return pointer to the created bar
64
*/
65
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy);
66
67
/*=====================
68
* Setter functions
69
*====================*/
70
71
/**
72
* Set a new value on the bar
73
* @param bar pointer to a bar object
74
* @param value new value
75
*/
76
void lv_bar_set_value(lv_obj_t * bar, int16_t value);
77
78
/**
79
* Set a new value with animation on the bar
80
* @param bar pointer to a bar object
81
* @param value new value
82
* @param anim_time animation time in milliseconds
83
*/
84
void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time);
85
86
87
/**
88
* Set minimum and the maximum values of a bar
89
* @param bar pointer to the bar object
90
* @param min minimum value
91
* @param max maximum value
92
*/
93
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
94
95
/**
96
* Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum position.
97
* @param bar pointer to a bar object
98
* @param en true: enable disable symmetric behavior; false: disable
99
*/
100
void lv_bar_set_sym(lv_obj_t * bar, bool en);
101
102
/**
103
* Set a style of a bar
104
* @param bar pointer to a bar object
105
* @param type which style should be set
106
* @param style pointer to a style
107
*/
108
void lv_bar_set_style(lv_obj_t *bar, lv_bar_style_t type, lv_style_t *style);
109
110
/*=====================
111
* Getter functions
112
*====================*/
113
114
/**
115
* Get the value of a bar
116
* @param bar pointer to a bar object
117
* @return the value of the bar
118
*/
119
int16_t lv_bar_get_value(const lv_obj_t * bar);
120
121
/**
122
* Get the minimum value of a bar
123
* @param bar pointer to a bar object
124
* @return the minimum value of the bar
125
*/
126
int16_t lv_bar_get_min_value(const lv_obj_t * bar);
127
128
/**
129
* Get the maximum value of a bar
130
* @param bar pointer to a bar object
131
* @return the maximum value of the bar
132
*/
133
int16_t lv_bar_get_max_value(const lv_obj_t * bar);
134
135
/**
136
* Get whether the bar is symmetric or not.
137
* @param bar pointer to a bar object
138
* @return true: symmetric is enabled; false: disable
139
*/
140
bool lv_bar_get_sym(lv_obj_t * bar);
141
142
/**
143
* Get a style of a bar
144
* @param bar pointer to a bar object
145
* @param type which style should be get
146
* @return style pointer to a style
147
*/
148
lv_style_t * lv_bar_get_style(const lv_obj_t *bar, lv_bar_style_t type);
149
150
/**********************
151
* MACROS
152
**********************/
153
154
#endif /*USE_LV_BAR*/
155
156
#ifdef __cplusplus
157
} /* extern "C" */
158
#endif
159
160
#endif /*LV_BAR_H*/
161
162