1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
26
27
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
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
/* ... */
#include <gui/custom_controls_screen/WheelSelectorExtra.hpp>
#include <touchgfx/Color.hpp>
#include <touchgfx/EasingEquations.hpp>
WheelSelectorExtra::WheelSelectorExtra() :
WheelSelector()
{
}{ ... }
WheelSelectorExtra::~WheelSelectorExtra()
{
}{ ... }
void WheelSelectorExtra::setupDatePickerWheelDay(int width, int height, int textXPosition, int textYPositionOfIndex0Selected, TEXTS wheelText, TEXTS wheelTextExtra0, TEXTS wheelTextExtra1, TEXTS wheelTextExtra2)
{
WheelSelector::setup(width, height, textXPosition, textYPositionOfIndex0Selected, wheelText);
textExtra[0].setTypedText(TypedText(wheelTextExtra0));
textExtra[1].setTypedText(TypedText(wheelTextExtra1));
textExtra[2].setTypedText(TypedText(wheelTextExtra2));
textExtra[0].setXY(text.getX(), text.getRect().bottom());
textExtra[1].setXY(text.getX(), textExtra[0].getRect().bottom());
textExtra[2].setXY(text.getX(), textExtra[1].getRect().bottom());
for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++)
{
textExtraIsVisible[i] = true;
textExtra[i].setMoveAnimationEndedAction(textMoveEndedCallback);
textContainer.add(textExtra[i]);
textExtraSelected[i].setTypedText(textExtra[i].getTypedText());
textExtraSelected[i].setX(textExtra[i].getX());
textExtraSelected[i].setMoveAnimationEndedAction(textMoveEndedCallback);
textSelectedContainer.add(textExtraSelected[i]);
}for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++) { ... }
adjustBottomCutOff();
reset();
}{ ... }
void WheelSelectorExtra::setTextColor(int16_t normalColor, int16_t selectedColor, uint16_t selectedBackgroundColor, int selectedYOffset , int selectedHeight )
{
WheelSelector::setTextColor(normalColor, selectedColor, selectedBackgroundColor, selectedYOffset, selectedHeight);
for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++)
{
textExtra[i].setColor(text.getColor());
textExtraSelected[i].setY(textExtra[i].getY() - selectedYOffset);
textExtraSelected[i].setColor(textSelected.getColor());
}for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++) { ... }
}{ ... }
void WheelSelectorExtra::moveText(int newYPosition)
{
adjustForBoundries(newYPosition);
text.moveTo(text.getX(), newYPosition);
textExtra[0].moveTo(text.getX(), newYPosition + text.getHeight());
textExtra[1].moveTo(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight());
textExtra[2].moveTo(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight() + textExtra[1].getHeight());
textSelected.moveTo(text.getX(), newYPosition - selectedAreaYOffset);
textExtraSelected[0].moveTo(text.getX(), textExtra[0].getY() - selectedAreaYOffset);
textExtraSelected[1].moveTo(text.getX(), textExtra[1].getY() - selectedAreaYOffset);
textExtraSelected[2].moveTo(text.getX(), textExtra[2].getY() - selectedAreaYOffset);
}{ ... }
void WheelSelectorExtra::animateMoveText(int newYPosition, int duration, EasingEquation equation)
{
text.startMoveAnimation(text.getX(), newYPosition, duration, EasingEquations::linearEaseNone, equation);
textExtra[0].startMoveAnimation(text.getX(), newYPosition + text.getHeight(), duration, EasingEquations::linearEaseNone, equation);
textExtra[1].startMoveAnimation(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight(), duration, EasingEquations::linearEaseNone, equation);
textExtra[2].startMoveAnimation(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight() + textExtra[1].getHeight(), duration, EasingEquations::linearEaseNone, equation);
textSelected.startMoveAnimation(text.getX(), newYPosition - selectedAreaYOffset, duration, EasingEquations::linearEaseNone, equation);
textExtraSelected[0].startMoveAnimation(text.getX(), newYPosition + text.getHeight() - selectedAreaYOffset, duration, EasingEquations::linearEaseNone, equation);
textExtraSelected[1].startMoveAnimation(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight() - selectedAreaYOffset, duration, EasingEquations::linearEaseNone, equation);
textExtraSelected[2].startMoveAnimation(text.getX(), newYPosition + text.getHeight() + textExtra[0].getHeight() + textExtra[1].getHeight() - selectedAreaYOffset, duration, EasingEquations::linearEaseNone, equation);
}{ ... }
void WheelSelectorExtra::fadeExtraText(int extraTextIndex, uint8_t endAlpha, uint16_t duration)
{
assert(extraTextIndex < NUMBER_OF_EXTRA_TEXTS);
textExtra[extraTextIndex].startFadeAnimation(endAlpha, duration);
textExtraSelected[extraTextIndex].startFadeAnimation(endAlpha, duration);
textExtraIsVisible[extraTextIndex] = (endAlpha != 0);
adjustBottomCutOff();
}{ ... }
void WheelSelectorExtra::adjustBottomCutOff()
{
bottomCutOff = topCutOff - (textExtra[2].getRect().bottom() - text.getY()) + - (spaceBetweenTextRows / 3);
for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++)
{
if (!textExtraIsVisible[i])
{
bottomCutOff = topCutOff - (textExtra[i].getY() - text.getY()) + - (spaceBetweenTextRows / 3);
break;
}if (!textExtraIsVisible[i]) { ... }
}for (int i = 0; i < NUMBER_OF_EXTRA_TEXTS; i++) { ... }
}{ ... }