-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgui_progressbar.h
227 lines (201 loc) · 7.9 KB
/
gui_progressbar.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/**
\internal
*****************************************************************************************
* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved.
*****************************************************************************************
* @file gui_progressbar.h
* @brief progressbar widget header file
* @details progressbar widget
* @author [email protected]
* @date 2023/11/07
* @version 1.0
***************************************************************************************
* @attention
* <h2><center>© COPYRIGHT 2017 Realtek Semiconductor Corporation</center></h2>
***************************************************************************************
\endinternal
*/
/*============================================================================*
* Define to prevent recursive inclusion
*============================================================================*/
#ifndef __GUI_progressBAR_H__
#define __GUI_progressBAR_H__
#ifdef __cplusplus
extern "C" {
#endif
/*============================================================================*
* Header Files
*============================================================================*/
#include "guidef.h"
#include "gui_fb.h"
#include "gui_img_scope.h"
#include "gui_canvas.h"
/*============================================================================*
* Types
*============================================================================*/
/** @brief ... */
/* gui_progressbar_t start*/
typedef struct gui_progressbar
{
gui_obj_t base;
gui_canvas_t *c;
uint32_t color;
uint32_t color_hl;
size_t max;
float per, per_history;
void (*ctor)(struct gui_progressbar *_this, gui_obj_t *parent, const char *name, int16_t x,
int16_t y,
int16_t w, int16_t h);
IMG_SOURCE_MODE_TYPE src_mode; // scroll_bar
uint8_t image_type;
uint16_t thumb_width;
} gui_progressbar_t;
/* gui_progressbar_t end*/
/*============================================================================*
* Constants
*============================================================================*/
/*============================================================================*
* Macros
*============================================================================*/
/*============================================================================*
* Variables
*============================================================================*/
/*============================================================================*
* Functions
*============================================================================*/
/**
* @brief create a horizontal progressbar based on picture.
*
* @param parent parent widget.
* @param picture the picture background.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_img_h_create(void *parent,
void *picture,
int16_t x,
int16_t y);
/**
* @brief create a horizontal progressbar based on picture.
*
* @param parent parent widget.
* @param picture the picture background, should be ftl addr.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_img_h_create_from_ftl(void *parent,
void *picture,
int16_t x,
int16_t y);
/**
* @brief create a vertical progressbar based on picture.
*
* @param parent parent widget.
* @param picture the picture background.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_img_v_create(void *parent,
void *picture,
int16_t x,
int16_t y);
/**
* @brief create a vertical progressbar based on picture.
*
* @param parent parent widget.
* @param picture the picture background, should be ftl addr.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_img_v_create_from_ftl(void *parent,
void *picture,
int16_t x,
int16_t y);
/**
* @brief create a frame progressbar based on pictures, file source is memory address.
*
* @param parent parent widget.
* @param picture_array the pictures frame memory address.
* @param array_length picture_array length.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_movie_create(void *parent,
void **picture_array,
uint16_t array_length,
int16_t x,
int16_t y);
/**
* @brief create a frame progressbar based on pictures, file source is filesystem.
*
* @param parent parent widget.
* @param picture_array the pictures frame filepath.
* @param array_length picture_array length.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_movie_create_from_fs(void *parent,
void **picture_array,
uint16_t array_length,
int16_t x,
int16_t y);
/**
* @brief set progress.
*
* @param _this widget object pointer.
* @param progress the progress of widget.
*/
void gui_progressbar_set_progress(gui_progressbar_t *_this, size_t progress);
/**
* @brief get_progress.
*
* @param _this widget object pointer.
* @return size_t
*/
size_t gui_progressbar_get_progress(gui_progressbar_t *_this);
/**
* @brief set_percentage.
*
* @param _this widget object pointer.
* @param percentage the percentage of widget.
*/
void gui_progressbar_set_percentage(gui_progressbar_t *_this, float percentage);
/**
* @brief get_percentage.
*
* @param _this widget object pointer.
* @return float.
*/
float gui_progressbar_get_percentage(gui_progressbar_t *_this);
/**
* @brief get_max.
*
* @param _this widget object pointer.
* @return size_t.
*/
size_t gui_progressbar_get_max(gui_progressbar_t *_this);
/**
* @brief create a horizontal progressbar based on picture with thumb.
*
* @param parent parent widget.
* @param picture_pointer the picture background.
* @param x the X-axis coordinate of the widget.
* @param y the Y-axis coordinate of the widget.
* @param bar_width the bar width.
* @return gui_progressbar_t*.
*/
gui_progressbar_t *gui_progressbar_thumb_h_create(void *parent,
void *picture_pointer,
int16_t x,
int16_t y,
uint16_t bar_width);
#ifdef __cplusplus
}
#endif
#endif