Select one of the symbols to view example projects that use it.
 
Outline
#define DATE_PICKER_WHEEL_HPP
#include <touchgfx/containers/Container.hpp>
#include <touchgfx/widgets/Image.hpp>
#include <touchgfx/widgets/Box.hpp>
#include <touchgfx/widgets/TextArea.hpp>
#include <BitmapDatabase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/mixins/MoveAnimator.hpp>
WheelSelector
Files
loading...
CodeScopeSTM32 Libraries and SamplesTouchGFXGui/gui/include/gui/custom_controls_screen/WheelSelector.hpp
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * This file is part of the TouchGFX 4.10.0 distribution. * * @attention * * Copyright (c) 2018 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #ifndef DATE_PICKER_WHEEL_HPP #define DATE_PICKER_WHEEL_HPP #include <touchgfx/containers/Container.hpp> #include <touchgfx/widgets/Image.hpp> #include <touchgfx/widgets/Box.hpp> #include <touchgfx/widgets/TextArea.hpp> #include <BitmapDatabase.hpp> #include <texts/TextKeysAndLanguages.hpp> #include <touchgfx/mixins/MoveAnimator.hpp> 7 includes using namespace touchgfx; /** * @class WheelSelector WheelSelector.hpp gui/custom_controls_screen/WheelSelector.hpp * * @brief A wheel selector. Displays a text in a scrollable wheel. * * A wheel selector. Displays a text in a scrollable wheel. Option to display the * text in a different color near the selected element. Snaps to the nearest element * after movement. * * @note This widget is part of the TouchGFX Open Repository. * https://github.com/draupnergraphics/touchgfx-open-repository * * @sa Container *//* ... */ class WheelSelector : public Container { public: /** * @fn WheelSelector::WheelSelector(); * * @brief Default constructor. * * Default constructor. *//* ... */ WheelSelector(); /** * @fn virtual WheelSelector::~WheelSelector(); * * @brief Destructor. * * Destructor. *//* ... */ virtual ~WheelSelector(); virtual void handleDragEvent(const DragEvent& evt); /** * @fn virtual void WheelSelector::setup(int width, int height, int textXPosition, int textYPosition, int spaceBetweenTextRows, int selectedYOffset, TEXTS wheelText); * * @brief Setup method. * * @param width The width of the container. * @param height The height of the container. * @param textXPosition The text x coordinate position. * @param textYPosition The text y coordinate position. * @param wheelText The wheel text. *//* ... */ virtual void setup(int width, int height, int textXPosition, int textYPosition, TEXTS wheelText); /** * @fn void WheelSelector::setTextColor(int16_t normalColor, int16_t selectedColor, uint16_t selectedBackgroundColor, int selectedYOffset = 0, int selectedHeight = 0); * * @brief Sets text color of normal/selected text. * * Sets text color of normal/selected text. If the colors are the same, the overlays * for showing selected text is hidden, otherwise it is setup with the given y * coordinate offset. * * @param normalColor The color of normal text. * @param selectedColor The color of selected text. * @param selectedBackgroundColor The selected background color. * @param selectedYOffset The selected area (where the text changes color) y coordinate * offset. * @param selectedHeight The selected height. *//* ... */ void setTextColor(int16_t normalColor, int16_t selectedColor, uint16_t selectedBackgroundColor, int selectedYOffset = 0, int selectedHeight = 0); virtual void handleClickEvent(const ClickEvent& evt); virtual void handleGestureEvent(const GestureEvent& evt); /** * @fn int WheelSelector::getSelectedIndex(); * * @brief Gets selected index. * * Gets selected index calculated from what is on screen. * * @return The selected index. *//* ... */ int getSelectedIndex(); /** * @fn void WheelSelector::setSelectedIndex(int index, int duration, EasingEquation equation = EasingEquations::backEaseInOut); * * @brief Sets selected index. * * Sets selected index by moving the wheel selector using the given easing equation. * * @param index Zero-based index of the. * @param duration The duration. * @param equation The equation. *//* ... */ void setSelectedIndex(int index, int duration, EasingEquation equation = EasingEquations::backEaseInOut); /** * @fn void WheelSelector::reset(); * * @brief Resets this object to show first element. * * Resets this object to show first element. *//* ... */ void reset(); void setElementSelectedCallback(touchgfx::GenericCallback<const WheelSelector&, const int&>& callback) { elementSelectedAction = &callback; } public: protected: enum AnimationState { ANIMATING_GESTURE, ///< Animating a gesture ANIMATING_SNAP, ///< Animating a 'snap' after a drag/gesture to align index ANIMATING_DRAG, ///< Animating a click+drag NO_ANIMATION ///< No animation ...}; AnimationState currentAnimationState; Container textContainer; ///< Container for wheel text MoveAnimator<TextArea> text; ///< Wheel text Container textSelectedContainer; ///< Container for selected text when selection has a different color MoveAnimator<TextArea> textSelected; ///< Box textSelectedBackground; int selectedAreaYOffset; int selectedTextYPosition; int spaceBetweenTextRows; int topCutOff; int bottomCutOff; GenericCallback<const WheelSelector&, const int&>* elementSelectedAction; Callback<WheelSelector, const MoveAnimator<TextArea>& > textMoveEndedCallback; void textMoveEndedHandler(const MoveAnimator<TextArea>& textArea); virtual void moveText(int newYPosition); virtual void animateMoveText(int newYPosition, int duration, EasingEquation equation); void snap(); void adjustForBoundries(int& newYValue);protected: ...}; /* ... */ #endif /* DATE_PICKER_WHEEL_HPP */