WebRadioApp  0.1
_WidgetSetToggleButton.h
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * E M B E D D E D W I Z A R D P R O J E C T
4 *
5 * Copyright (c) TARA Systems GmbH
6 * written by Paul Banach and Manfred Schweyer
7 *
8 ********************************************************************************
9 *
10 * This file was generated automatically by Embedded Wizard Studio.
11 *
12 * Please do not make any modifications of this file! The modifications are lost
13 * when the file is generated again by Embedded Wizard Studio!
14 *
15 * The template of this heading text can be found in the file 'head.ewt' in the
16 * directory 'Platforms' of your Embedded Wizard installation directory. If you
17 * wish to adapt this text, please copy the template file 'head.ewt' into your
18 * project directory and edit the copy only. Please avoid any modifications of
19 * the original template file!
20 *
21 * Version : 10.00
22 * Profile : STM32H747
23 * Platform : STM.STM32.RGB565
24 *
25 *******************************************************************************/
26 
27 #ifndef _WidgetSetToggleButton_H
28 #define _WidgetSetToggleButton_H
29 
30 #ifdef __cplusplus
31  extern "C"
32  {
33 #endif
34 
35 #include "ewrte.h"
36 #if EW_RTE_VERSION != 0x000A0000
37  #error Wrong version of Embedded Wizard Runtime Environment.
38 #endif
39 
40 #include "ewgfx.h"
41 #if EW_GFX_VERSION != 0x000A0000
42  #error Wrong version of Embedded Wizard Graphics Engine.
43 #endif
44 
45 #include "_CoreGroup.h"
46 #include "_CoreKeyPressHandler.h"
48 #include "_CoreTimer.h"
49 
50 /* Forward declaration of the class Core::DialogContext */
51 #ifndef _CoreDialogContext_
52  EW_DECLARE_CLASS( CoreDialogContext )
53 #define _CoreDialogContext_
54 #endif
55 
56 /* Forward declaration of the class Core::LayoutContext */
57 #ifndef _CoreLayoutContext_
58  EW_DECLARE_CLASS( CoreLayoutContext )
59 #define _CoreLayoutContext_
60 #endif
61 
62 /* Forward declaration of the class Core::TaskQueue */
63 #ifndef _CoreTaskQueue_
64  EW_DECLARE_CLASS( CoreTaskQueue )
65 #define _CoreTaskQueue_
66 #endif
67 
68 /* Forward declaration of the class Core::View */
69 #ifndef _CoreView_
70  EW_DECLARE_CLASS( CoreView )
71 #define _CoreView_
72 #endif
73 
74 /* Forward declaration of the class Effects::Fader */
75 #ifndef _EffectsFader_
77 #define _EffectsFader_
78 #endif
79 
80 /* Forward declaration of the class Graphics::Canvas */
81 #ifndef _GraphicsCanvas_
82  EW_DECLARE_CLASS( GraphicsCanvas )
83 #define _GraphicsCanvas_
84 #endif
85 
86 /* Forward declaration of the class Resources::Bitmap */
87 #ifndef _ResourcesBitmap_
88  EW_DECLARE_CLASS( ResourcesBitmap )
89 #define _ResourcesBitmap_
90 #endif
91 
92 /* Forward declaration of the class Views::Frame */
93 #ifndef _ViewsFrame_
94  EW_DECLARE_CLASS( ViewsFrame )
95 #define _ViewsFrame_
96 #endif
97 
98 /* Forward declaration of the class Views::Image */
99 #ifndef _ViewsImage_
100  EW_DECLARE_CLASS( ViewsImage )
101 #define _ViewsImage_
102 #endif
103 
104 /* Forward declaration of the class Views::Text */
105 #ifndef _ViewsText_
106  EW_DECLARE_CLASS( ViewsText )
107 #define _ViewsText_
108 #endif
109 
110 /* Forward declaration of the class WidgetSet::ToggleButton */
111 #ifndef _WidgetSetToggleButton_
112  EW_DECLARE_CLASS( WidgetSetToggleButton )
113 #define _WidgetSetToggleButton_
114 #endif
115 
116 /* Forward declaration of the class WidgetSet::ToggleButtonConfig */
117 #ifndef _WidgetSetToggleButtonConfig_
118  EW_DECLARE_CLASS( WidgetSetToggleButtonConfig )
119 #define _WidgetSetToggleButtonConfig_
120 #endif
121 
122 
123 /* This class implements a bistable 'toggle button' widget (a switch). When the
124  user taps the button, the current state of the button represented by the boolean
125  property @Checked is toggled and signal is sent to one of the slot methods stored
126  in the properties @OnSwitchOff or @OnSwitchOn. By connecting further slot methods
127  to the properties @OnPress, @OnRelease, @OnEnter and @OnLeave you can react to
128  other events triggered while the user interacts with the button.
129  Alternatively the property @Outlet can refer to any other 'bool' property the
130  widget should remain synchronized with. When the user toggles the button, the
131  affected property is automatically updated to reflect the button's current state.
132  On the other hand, when the referred property is modified by another one, the
133  toggle button is automatically notified to remain in sync with the property.
134  This approach follows the Controller-View programming paradigm. Here the toggle
135  button represents the 'View' and the property referred via 'Outlet' can be seen
136  as a part of the 'Controller'.
137  During its lifetime the button remains always in one of the four states: 'disabled',
138  'default', 'focused' and 'active'. The state 'disabled' is true for every not
139  available button (the property @Enabled of the button is 'false'). Such buttons
140  will ignore all user inputs. The state 'default' determines a button, which is
141  ready to be touched by the user or ready to become focused. As soon as the button
142  becomes focused, it switches in the state 'focused'. In this state the user can
143  activate the button by pressing a key on the keyboard. Finally, the state 'active'
144  is true, if the user actually interacts with the button (the button is pressed).
145  The exact look and feel of the toggle button is determined by the 'Toggle Button
146  Configuration' object assigned to the property @Appearance. The configuration
147  object provides bitmaps, colors, fonts and other configuration parameters needed
148  to construct and display the toggle button. Usually, you will manage in your
149  project your own configuration objects and customize the toggle buttons according
150  to your design expectations. Depending on the information provided in the associated
151  configuration object, the toggle button will be composed of following views:
152  - 'Face' is a bitmap frame view (Views::Frame) filling per default the entire
153  background of the button. In the configuration object you can individually specify
154  for every button state the desired bitmap, its opacity, frame number (if the
155  bitmap is multi-frame) and tint color (if the bitmap contains Alpha8 information
156  only). The button can automatically play animated bitmaps. If desired, you can
157  also configure the bitmap to be arranged horizontally and vertically instead
158  of filling the entire widget area.
159  - 'Icon' is an image view (Views::Image) displayed per default in the center
160  of the button. The corresponding bitmap is determined in the property @Icon.
161  If the bitmap is multi-frame, the desired frame number can be selected by using
162  the property @IconFrame or individually for every button state by using the properties
163  @IconOffFrame, @IconOnFrame, @IconOffFrameActive, @IconOffFrameDefault, @IconOffFrameDisabled,
164  @IconOffFrameFocused, @IconOnFrameActive, @IconOnFrameDefault, @IconOnFrameDisabled
165  and @IconOnFrameFocused In the configuration object you can specify the alignment
166  and margins how to arrange the @Icon bitmap within the button area. Furthermore,
167  for every button state the opacity and tint color (if the @Icon bitmap contains
168  Alpha8 information only) can be determined. The button can automatically play
169  animated bitmaps.
170  - 'Label' is a text view (Views::Text) displayed per default in the center of
171  the button. The corresponding text is determined in the property @Label or @LabelOff
172  and @LabelOn depending on the current state of the button (property @Checked).
173  In the configuration object you can specify the font, alignment and margins to
174  use for the text view. For every button state you can specify individual text
175  color values.
176  In particular application cases you can instruct the button to automatically
177  resign and retarget the actual touch interaction to another touch handler (e.g.
178  another widget) after the user has performed a horizontal wipe gesture (@ResignAfterHorizontalWipe)
179  or vertical wipe gesture (@ResignAfterVerticalWipe). Using these properties several
180  widgets can cooperate during an active user interaction even if these handler
181  overlap each other.
182  If the button is actually focused, it can also be activated by pressing the keyboard
183  key Core::KeyCode.Enter. In the configuration object you can specify another
184  key code, if desired. To prevent the button from being able to be focused, specify
185  in the configuration object the Core::KeyCode.NoKey as the code to activate the
186  button.
187  For more details regarding the customization of the button see the description
188  of WidgetSet::ToggleButtonConfig class. */
189 EW_DEFINE_FIELDS( WidgetSetToggleButton, CoreGroup )
190  EW_VARIABLE( textView, ViewsText )
191  EW_VARIABLE( imageView, ViewsImage )
192  EW_VARIABLE( frameView, ViewsFrame )
193  EW_PROPERTY( Icon, ResourcesBitmap )
194  EW_PROPERTY( Appearance, WidgetSetToggleButtonConfig )
195  EW_PROPERTY( OnLeave, XSlot )
196  EW_PROPERTY( OnEnter, XSlot )
197  EW_PROPERTY( OnRelease, XSlot )
198  EW_PROPERTY( OnPress, XSlot )
199  EW_PROPERTY( OnSwitchOn, XSlot )
200  EW_PROPERTY( OnSwitchOff, XSlot )
201  EW_PROPERTY( Outlet, XRef )
202  EW_OBJECT ( FlashTimer, CoreTimer )
203  EW_OBJECT ( KeyHandler, CoreKeyPressHandler )
204  EW_OBJECT ( TouchHandler, CoreSimpleTouchHandler )
205  EW_PROPERTY( LabelOn, XString )
206  EW_PROPERTY( LabelOff, XString )
207  EW_VARIABLE( onPressKeyTime, XUInt32 )
208  EW_PROPERTY( IconOnFrameActive, XInt32 )
209  EW_PROPERTY( IconOnFrameFocused, XInt32 )
210  EW_PROPERTY( IconOnFrameDisabled, XInt32 )
211  EW_PROPERTY( IconOnFrameDefault, XInt32 )
212  EW_PROPERTY( IconOffFrameActive, XInt32 )
213  EW_PROPERTY( IconOffFrameFocused, XInt32 )
214  EW_PROPERTY( IconOffFrameDisabled, XInt32 )
215  EW_PROPERTY( IconOffFrameDefault, XInt32 )
216  EW_PROPERTY( Checked, XBool )
217 EW_END_OF_FIELDS( WidgetSetToggleButton )
218 
219 /* Virtual Method Table (VMT) for the class : 'WidgetSet::ToggleButton' */
220 EW_DEFINE_METHODS( WidgetSetToggleButton, CoreGroup )
221  EW_METHOD( initLayoutContext, void )( CoreRectView _this, XRect aBounds, CoreOutline
222  aOutline )
223  EW_METHOD( GetRoot, CoreRoot )( CoreView _this )
224  EW_METHOD( Draw, void )( CoreGroup _this, GraphicsCanvas aCanvas,
226  EW_METHOD( HandleEvent, XObject )( CoreView _this, CoreEvent aEvent )
227  EW_METHOD( CursorHitTest, CoreCursorHit )( CoreGroup _this, XRect aArea, XInt32
228  aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet aRetargetReason )
229  EW_METHOD( ArrangeView, XPoint )( CoreRectView _this, XRect aBounds, XEnum
230  aFormation )
231  EW_METHOD( MoveView, void )( CoreRectView _this, XPoint aOffset, XBool
232  aFastMove )
233  EW_METHOD( GetExtent, XRect )( CoreRectView _this )
234  EW_METHOD( ChangeViewState, void )( CoreGroup _this, XSet aSetState, XSet aClearState )
235  EW_METHOD( OnSetBounds, void )( WidgetSetToggleButton _this, XRect value )
236  EW_METHOD( drawContent, void )( CoreGroup _this, GraphicsCanvas aCanvas,
238  EW_METHOD( OnSetFocus, void )( CoreGroup _this, CoreView value )
239  EW_METHOD( OnSetBuffered, void )( CoreGroup _this, XBool value )
240  EW_METHOD( OnSetOpacity, void )( CoreGroup _this, XInt32 value )
241  EW_METHOD( IsDialog, XBool )( CoreGroup _this, XBool aRecursive )
242  EW_METHOD( DispatchEvent, XObject )( CoreGroup _this, CoreEvent aEvent )
243  EW_METHOD( BroadcastEvent, XObject )( CoreGroup _this, CoreEvent aEvent, XSet
244  aFilter )
245  EW_METHOD( UpdateLayout, void )( CoreGroup _this, XPoint aSize )
246  EW_METHOD( UpdateViewState, void )( WidgetSetToggleButton _this, XSet aState )
247  EW_METHOD( InvalidateArea, void )( CoreGroup _this, XRect aArea )
248 EW_END_OF_METHODS( WidgetSetToggleButton )
249 
250 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetBounds()' */
251 void WidgetSetToggleButton_OnSetBounds( WidgetSetToggleButton _this, XRect value );
252 
253 /* The method UpdateViewState() is invoked automatically after the state of the
254  component has been changed. This method can be overridden and filled with logic
255  to ensure the visual aspect of the component does reflect its current state.
256  For example, the 'enabled' state of the component can affect its colors (disabled
257  components may appear pale). In this case the logic of the method should modify
258  the respective color properties accordingly to the current 'enabled' state.
259  The current state of the component is passed as a set in the parameter aState.
260  It reflects the very basic component state like its visibility or the ability
261  to react to user inputs. Beside this common state, the method can also involve
262  any other variables used in the component as long as they reflect its current
263  state. For example, the toggle switch component can take in account its toggle
264  state 'on' or 'off' and change accordingly the location of the slider, etc.
265  Usually, this method will be invoked automatically by the framework. Optionally
266  you can request its invocation by using the method @InvalidateViewState(). */
267 void WidgetSetToggleButton_UpdateViewState( WidgetSetToggleButton _this, XSet aState );
268 
269 /* 'C' function for method : 'WidgetSet::ToggleButton.onConfigChanged()' */
270 void WidgetSetToggleButton_onConfigChanged( WidgetSetToggleButton _this, XObject
271  sender );
272 
273 /* 'C' function for method : 'WidgetSet::ToggleButton.onFlashTimer()' */
274 void WidgetSetToggleButton_onFlashTimer( WidgetSetToggleButton _this, XObject sender );
275 
276 /* 'C' function for method : 'WidgetSet::ToggleButton.onReleaseKey()' */
277 void WidgetSetToggleButton_onReleaseKey( WidgetSetToggleButton _this, XObject sender );
278 
279 /* 'C' function for method : 'WidgetSet::ToggleButton.onPressKey()' */
280 void WidgetSetToggleButton_onPressKey( WidgetSetToggleButton _this, XObject sender );
281 
282 /* 'C' function for method : 'WidgetSet::ToggleButton.onLeaveTouch()' */
283 void WidgetSetToggleButton_onLeaveTouch( WidgetSetToggleButton _this, XObject sender );
284 
285 /* 'C' function for method : 'WidgetSet::ToggleButton.onEnterTouch()' */
286 void WidgetSetToggleButton_onEnterTouch( WidgetSetToggleButton _this, XObject sender );
287 
288 /* 'C' function for method : 'WidgetSet::ToggleButton.onReleaseTouch()' */
289 void WidgetSetToggleButton_onReleaseTouch( WidgetSetToggleButton _this, XObject
290  sender );
291 
292 /* 'C' function for method : 'WidgetSet::ToggleButton.onPressTouch()' */
293 void WidgetSetToggleButton_onPressTouch( WidgetSetToggleButton _this, XObject sender );
294 
295 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetChecked()' */
296 void WidgetSetToggleButton_OnSetChecked( WidgetSetToggleButton _this, XBool value );
297 
298 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetLabelOn()' */
299 void WidgetSetToggleButton_OnSetLabelOn( WidgetSetToggleButton _this, XString value );
300 
301 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetLabelOff()' */
302 void WidgetSetToggleButton_OnSetLabelOff( WidgetSetToggleButton _this, XString value );
303 
304 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetLabel()' */
305 void WidgetSetToggleButton_OnSetLabel( WidgetSetToggleButton _this, XString value );
306 
307 /* 'C' function for method : 'WidgetSet::ToggleButton.OnSetAppearance()' */
308 void WidgetSetToggleButton_OnSetAppearance( WidgetSetToggleButton _this, WidgetSetToggleButtonConfig
309  value );
310 
311 #ifdef __cplusplus
312  }
313 #endif
314 
315 #endif /* _WidgetSetToggleButton_H */
316 
317 /* Embedded Wizard */
CoreCursorHit
XRect CoreOutline aOutline CoreCursorHit(CoreGroup _this, XRect aArea, XInt32 aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet aRetargetReason) EW_METHOD(ArrangeView
WidgetSetToggleButton_OnSetBounds
void WidgetSetToggleButton_OnSetBounds(WidgetSetToggleButton _this, XRect value)
Definition: WidgetSet.c:4090
XRef
Definition: ewrte.h:2075
WidgetSetToggleButton_OnSetLabel
void WidgetSetToggleButton_OnSetLabel(WidgetSetToggleButton _this, XString value)
Definition: WidgetSet.c:4768
ewrte.h
_CoreTimer.h
aBounds
XRect aBounds
Definition: _WidgetSetToggleButton.h:221
_CoreGroup.h
EW_END_OF_FIELDS
#define EW_END_OF_FIELDS(aClass)
Definition: ewrte.h:460
EW_DECLARE_CLASS
#define EW_DECLARE_CLASS(aClass)
Definition: ewrte.h:393
XSlot
Definition: ewrte.h:2114
EW_VARIABLE
#define EW_VARIABLE(aName, aType)
Definition: ewrte.h:464
ewgfx.h
EW_METHOD
EW_METHOD(initLayoutContext, void)(CoreRectView _this
WidgetSetToggleButton_OnSetAppearance
void WidgetSetToggleButton_OnSetAppearance(WidgetSetToggleButton _this, WidgetSetToggleButtonConfig value)
Definition: WidgetSet.c:4779
_obj_XObject
Definition: ewrte.h:281
aOutline
XRect CoreOutline aOutline XRect CoreOutline aOutline
Definition: _CoreQuadView.h:109
XInt32
signed long XInt32
Definition: ewrte.h:1586
_CoreSimpleTouchHandler.h
XBool
char XBool
Definition: ewrte.h:1592
XEnum
unsigned long XEnum
Definition: ewrte.h:1593
EW_DEFINE_METHODS
#define EW_DEFINE_METHODS(aClass, aSuperClass)
Definition: ewrte.h:524
XRect
Definition: ewrte.h:1639
WidgetSetToggleButton_onConfigChanged
void WidgetSetToggleButton_onConfigChanged(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4524
EffectsFader
EffectsFader(EffectsShowHideTransition _this) EW_METHOD(CreateRestoreFader
XSet
unsigned long XSet
Definition: ewrte.h:1594
aOpacity
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint XInt32 aOpacity
Definition: _CoreOutline.h:172
WidgetSetToggleButton_onReleaseKey
void WidgetSetToggleButton_onReleaseKey(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4573
WidgetSetToggleButton_OnSetChecked
void WidgetSetToggleButton_OnSetChecked(WidgetSetToggleButton _this, XBool value)
Definition: WidgetSet.c:4738
WidgetSetToggleButton_onFlashTimer
void WidgetSetToggleButton_onFlashTimer(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4552
_CoreKeyPressHandler.h
WidgetSetToggleButton_onLeaveTouch
void WidgetSetToggleButton_onLeaveTouch(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4645
WidgetSetToggleButton_onPressKey
void WidgetSetToggleButton_onPressKey(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4614
aClip
XRect CoreOutline aOutline GraphicsCanvas XRect aClip
Definition: _CoreOutline.h:171
WidgetSetToggleButton_OnSetLabelOff
void WidgetSetToggleButton_OnSetLabelOff(WidgetSetToggleButton _this, XString value)
Definition: WidgetSet.c:4758
sender
XRect CoreOutline aOutline XObject sender
Definition: _ApplicationRadioInterface.h:186
XPoint
Definition: ewrte.h:1616
EW_PROPERTY
#define EW_PROPERTY(aName, aType)
Definition: ewrte.h:466
aOffset
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint aOffset
Definition: _CoreOutline.h:172
EW_OBJECT
#define EW_OBJECT(aName, aObjectClass)
Definition: ewrte.h:468
XUInt32
unsigned long XUInt32
Definition: ewrte.h:1590
WidgetSetToggleButton_UpdateViewState
void WidgetSetToggleButton_UpdateViewState(WidgetSetToggleButton _this, XSet aState)
Definition: WidgetSet.c:4166
aCanvas
XRect CoreOutline aOutline GraphicsCanvas aCanvas
Definition: _CoreOutline.h:171
XString
XChar * XString
Definition: ewrte.h:1656
EW_END_OF_METHODS
#define EW_END_OF_METHODS(aClass)
Definition: ewrte.h:539
WidgetSetToggleButton_onReleaseTouch
void WidgetSetToggleButton_onReleaseTouch(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4665
WidgetSetToggleButton_onEnterTouch
void WidgetSetToggleButton_onEnterTouch(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4655
WidgetSetToggleButton_OnSetLabelOn
void WidgetSetToggleButton_OnSetLabelOn(WidgetSetToggleButton _this, XString value)
Definition: WidgetSet.c:4748
aBlend
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint XInt32 XBool aBlend
Definition: _CoreOutline.h:172
value
XRect CoreOutline aOutline XRect value
Definition: _WidgetSetToggleButton.h:251
WidgetSetToggleButton_onPressTouch
void WidgetSetToggleButton_onPressTouch(WidgetSetToggleButton _this, XObject sender)
Definition: WidgetSet.c:4710
EW_DEFINE_FIELDS
#define EW_DEFINE_FIELDS(aClass, aSuperClass)
Definition: ewrte.h:451