Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_preload.h
1476 views
1
/**
2
* @file lv_preload.h
3
*
4
*/
5
6
#ifndef LV_PRELOAD_H
7
#define LV_PRELOAD_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_PRELOAD != 0
23
24
/*Testing of dependencies*/
25
#if USE_LV_ARC == 0
26
#error "lv_preload: lv_arc is required. Enable it in lv_conf.h (USE_LV_ARC 1) "
27
#endif
28
29
#if USE_LV_ANIMATION == 0
30
#error "lv_preload: animations are required. Enable it in lv_conf.h (USE_LV_ANIMATION 1) "
31
#endif
32
33
#include "../lv_core/lv_obj.h"
34
#include "lv_arc.h"
35
36
/*********************
37
* DEFINES
38
*********************/
39
40
/**********************
41
* TYPEDEFS
42
**********************/
43
44
enum {
45
LV_PRELOAD_TYPE_SPINNING_ARC,
46
LV_PRELOAD_TYPE_FILLSPIN_ARC,
47
};
48
typedef uint8_t lv_preloader_type_t;
49
50
/*Data of pre loader*/
51
typedef struct {
52
lv_arc_ext_t arc; /*Ext. of ancestor*/
53
/*New data for this type */
54
uint16_t arc_length; /*Length of the spinning indicator in degree*/
55
uint16_t time; /*Time of one round*/
56
lv_preloader_type_t anim_type; /*Type of the arc animation*/
57
} lv_preload_ext_t;
58
59
60
/*Styles*/
61
enum {
62
LV_PRELOAD_STYLE_MAIN,
63
};
64
typedef uint8_t lv_preload_style_t;
65
66
/**********************
67
* GLOBAL PROTOTYPES
68
**********************/
69
70
/**
71
* Create a pre loader objects
72
* @param par pointer to an object, it will be the parent of the new pre loader
73
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from it
74
* @return pointer to the created pre loader
75
*/
76
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy);
77
78
/*======================
79
* Add/remove functions
80
*=====================*/
81
82
/**
83
* Set the length of the spinning arc in degrees
84
* @param preload pointer to a preload object
85
* @param deg length of the arc
86
*/
87
void lv_preload_set_arc_length(lv_obj_t * preload, uint16_t deg);
88
89
/**
90
* Set the spin time of the arc
91
* @param preload pointer to a preload object
92
* @param time time of one round in milliseconds
93
*/
94
void lv_preload_set_spin_time(lv_obj_t * preload, uint16_t time);
95
96
/*=====================
97
* Setter functions
98
*====================*/
99
100
/**
101
* Set a style of a pre loader.
102
* @param preload pointer to pre loader object
103
* @param type which style should be set
104
* @param style pointer to a style
105
* */
106
void lv_preload_set_style(lv_obj_t * preload, lv_preload_style_t type, lv_style_t *style);
107
108
/**
109
* Set the animation type of a preloadeer.
110
* @param preload pointer to pre loader object
111
* @param type animation type of the preload
112
* */
113
void lv_preload_set_animation_type(lv_obj_t * preload, lv_preloader_type_t type);
114
115
/*=====================
116
* Getter functions
117
*====================*/
118
119
/**
120
* Get the arc length [degree] of the a pre loader
121
* @param preload pointer to a pre loader object
122
*/
123
uint16_t lv_preload_get_arc_length(const lv_obj_t * preload);
124
125
/**
126
* Get the spin time of the arc
127
* @param preload pointer to a pre loader object [milliseconds]
128
*/
129
uint16_t lv_preload_get_spin_time(const lv_obj_t * preload);
130
131
/**
132
* Get style of a pre loader.
133
* @param preload pointer to pre loader object
134
* @param type which style should be get
135
* @return style pointer to the style
136
* */
137
lv_style_t * lv_preload_get_style(const lv_obj_t * preload, lv_preload_style_t type);
138
139
/**
140
* Get the animation type of a preloadeer.
141
* @param preload pointer to pre loader object
142
* @return animation type
143
* */
144
lv_preloader_type_t lv_preload_get_animation_type(lv_obj_t * preload);
145
146
/*=====================
147
* Other functions
148
*====================*/
149
150
/**
151
* Get style of a pre loader.
152
* @param preload pointer to pre loader object
153
* @param type which style should be get
154
* @return style pointer to the style
155
* */
156
void lv_preload_spinner_animation(void * ptr, int32_t val);
157
158
/**********************
159
* MACROS
160
**********************/
161
162
#endif /*USE_LV_PRELOAD*/
163
164
#ifdef __cplusplus
165
} /* extern "C" */
166
#endif
167
168
#endif /*LV_PRELOAD_H*/
169
170