1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
47
48
56
57
62
63
68
69
/* ... */
#include <gui/custom_controls_screen/ThreeWayProgressBarCircle.hpp>
#include <BitmapDatabase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Color.hpp>
#include <assert.h>
5 includes
ThreeWayProgressBarCircle::ThreeWayProgressBarCircle()
{
background.setBitmap(Bitmap(BITMAP_CONTROLS_THREE_WAY_SMALL_CIRCLE_ID));
background.setXY(0, 0);
add(background);
add(icon);
text.setTypedText(TypedText(T_THREE_WAY_PROGRESS_BAR_PERCENTAGE));
text.setWildcard(textBuffer);
text.setColor(Color::getColorFrom24BitRGB(0xFF, 0xFF, 0xFF));
text.setPosition(30, 50, 40, 18);
add(text);
setPercentage(0);
setWidth(background.getWidth());
setHeight(background.getHeight());
}{ ... }
ThreeWayProgressBarCircle::~ThreeWayProgressBarCircle()
{
}{ ... }
void ThreeWayProgressBarCircle::setIcon(BitmapId newIconBmp, BitmapId newIconActiveBmp)
{
iconBmp = newIconBmp;
iconActiveBmp = newIconActiveBmp;
setActive(false);
icon.setXY((background.getWidth() - icon.getWidth())/2, 15);
}{ ... }
void ThreeWayProgressBarCircle::setActive(bool active)
{
active ? icon.setBitmap(Bitmap(iconActiveBmp)) : icon.setBitmap(Bitmap(iconBmp));
icon.invalidate();
}{ ... }
void ThreeWayProgressBarCircle::setPercentage(int percentage)
{
Unicode::snprintf(textBuffer, 5, "%d", percentage);
text.invalidate();
}{ ... }