WebRadioApp  0.1
_CoreSimpleTouchHandler.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 _CoreSimpleTouchHandler_H
28 #define _CoreSimpleTouchHandler_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 "_CoreQuadView.h"
46 
47 /* Forward declaration of the class Core::CursorHit */
48 #ifndef _CoreCursorHit_
50 #define _CoreCursorHit_
51 #endif
52 
53 /* Forward declaration of the class Core::Event */
54 #ifndef _CoreEvent_
55  EW_DECLARE_CLASS( CoreEvent )
56 #define _CoreEvent_
57 #endif
58 
59 /* Forward declaration of the class Core::Group */
60 #ifndef _CoreGroup_
61  EW_DECLARE_CLASS( CoreGroup )
62 #define _CoreGroup_
63 #endif
64 
65 /* Forward declaration of the class Core::LayoutContext */
66 #ifndef _CoreLayoutContext_
67  EW_DECLARE_CLASS( CoreLayoutContext )
68 #define _CoreLayoutContext_
69 #endif
70 
71 /* Forward declaration of the class Core::SimpleTouchHandler */
72 #ifndef _CoreSimpleTouchHandler_
73  EW_DECLARE_CLASS( CoreSimpleTouchHandler )
74 #define _CoreSimpleTouchHandler_
75 #endif
76 
77 /* Forward declaration of the class Core::View */
78 #ifndef _CoreView_
79  EW_DECLARE_CLASS( CoreView )
80 #define _CoreView_
81 #endif
82 
83 /* Forward declaration of the class Graphics::Canvas */
84 #ifndef _GraphicsCanvas_
85  EW_DECLARE_CLASS( GraphicsCanvas )
86 #define _GraphicsCanvas_
87 #endif
88 
89 
90 /* The class Core::SimpleTouchHandler provides a special kind of a view able to
91  react to touch screen events. Each time the user taps inside the area of the
92  handler view, the handler send signals to slot methods stored in its various
93  properties. For example, if there is a slot method assigned to the property @OnPress,
94  the handler will send a signal to this slot method as soon as the user has touched
95  the handler view area. The intention of this handler is to cover the internal
96  aspects of the cursor event handling.
97  The simple touch handler recognizes the tap and drag operations only. More sophisticated
98  gesture handlers are available in other classes, e.g. Core::RotateTouchHandler
99  is able to recognize the rotation gesture.
100  The touch area can assume any quad shape (4 corners polygon). Each corner can
101  be placed separately by the @Point1 .. @Point4 properties. In this manner fancy,
102  non rectangular touch areas can be determined.
103  The handler provides several variables useful to query e.g. the current touch
104  position (@CurrentPos), etc. These variables can be simply evaluated in the implementation
105  of the slot method.
106  If this handler is intended to process multi-touch events (the property @EnableMultiTouch
107  is 'true' and the target system can feed the application with multi-touch events)
108  you should additionally evaluate the variable @Finger, which helps you to distinguish
109  the touch events. Alternatively, the handler can be configured to react to multi-touch
110  gestures (e.g. two finger taps) performed by two or more fingers by specifying
111  the expected number of fingers in the property @NoOfFingers. With the property
112  @LimitToFinger the handler can be limited to react to events generated by a particular
113  finger only.
114  The property @Enabled can be used to activate/deactivate the touch handler. Disabled
115  handler will not react to user taps.
116  With the properties @RetargetCondition, @RetargetOffset and @RetargetDelay the
117  handler can be configured to automatically deflect the current event processing
118  to another handler as soon as the user has performed a simple gesture, e.g. wipe
119  down. Using these properties several handler can cooperate during an active user
120  interaction even if these handler overlap each other. For example, one handler
121  can process horizontal gestures while another handler will limit to vertical
122  gestures, etc.
123  Due to its ancestry from the Core::View class, the touch handler can be arranged
124  within its @Owner or if @Embedded == 'true' within the boundary area of an Core::Outline
125  view in the same manner as it is done with all regular views.
126  The touch handler itself is invisible except the Embedded Wizard Composer, where
127  all handler appear as semitransparent quads. This allows you to interact with
128  the handlers during the design time. */
129 EW_DEFINE_FIELDS( CoreSimpleTouchHandler, CoreQuadView )
130  EW_PROPERTY( OnDrag, XSlot )
131  EW_PROPERTY( OnLeave, XSlot )
132  EW_PROPERTY( OnEnter, XSlot )
133  EW_PROPERTY( OnHold, XSlot )
134  EW_PROPERTY( OnRelease, XSlot )
135  EW_PROPERTY( OnPress, XSlot )
136  EW_VARIABLE( stateRetargetReason, XSet )
137  EW_VARIABLE( state, XUInt32 )
138  EW_VARIABLE( Finger, XInt32 )
139  EW_VARIABLE( Time, XUInt32 )
140  EW_VARIABLE( StrikeCount, XInt32 )
141  EW_VARIABLE( HoldPeriod, XInt32 )
142  EW_VARIABLE( Offset, XPoint )
143  EW_VARIABLE( HittingPos, XPoint )
144  EW_VARIABLE( CurrentPos, XPoint )
145  EW_PROPERTY( RetargetDelay, XInt32 )
146  EW_PROPERTY( RetargetOffset, XInt32 )
147  EW_PROPERTY( RetargetCondition, XSet )
148  EW_PROPERTY( NoOfFingers, XInt32 )
149  EW_PROPERTY( LimitToFinger, XInt32 )
150  EW_PROPERTY( MaxStrikeCount, XInt32 )
151  EW_PROPERTY( MinStrikeCount, XInt32 )
152  EW_PROPERTY( EnableMultiTouch, XBool )
153  EW_VARIABLE( Down, XBool )
154  EW_VARIABLE( Inside, XBool )
155  EW_VARIABLE( AutoDeflected, XBool )
156 EW_END_OF_FIELDS( CoreSimpleTouchHandler )
157 
158 /* Virtual Method Table (VMT) for the class : 'Core::SimpleTouchHandler' */
159 EW_DEFINE_METHODS( CoreSimpleTouchHandler, CoreQuadView )
160  EW_METHOD( initLayoutContext, void )( CoreQuadView _this, XRect aBounds, CoreOutline
161  aOutline )
162  EW_METHOD( GetRoot, CoreRoot )( CoreView _this )
163  EW_METHOD( Draw, void )( CoreSimpleTouchHandler _this, GraphicsCanvas
165  EW_METHOD( HandleEvent, XObject )( CoreSimpleTouchHandler _this, CoreEvent
166  aEvent )
167  EW_METHOD( CursorHitTest, CoreCursorHit )( CoreSimpleTouchHandler _this, XRect
168  aArea, XInt32 aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet aRetargetReason )
169  EW_METHOD( ArrangeView, XPoint )( CoreQuadView _this, XRect aBounds, XEnum
170  aFormation )
171  EW_METHOD( MoveView, void )( CoreQuadView _this, XPoint aOffset, XBool
172  aFastMove )
173  EW_METHOD( GetExtent, XRect )( CoreQuadView _this )
174  EW_METHOD( ChangeViewState, void )( CoreView _this, XSet aSetState, XSet aClearState )
175  EW_METHOD( OnSetPoint4, void )( CoreQuadView _this, XPoint value )
176  EW_METHOD( OnSetPoint3, void )( CoreQuadView _this, XPoint value )
177  EW_METHOD( OnSetPoint2, void )( CoreQuadView _this, XPoint value )
178  EW_METHOD( OnSetPoint1, void )( CoreQuadView _this, XPoint value )
179 EW_END_OF_METHODS( CoreSimpleTouchHandler )
180 
181 /* The method Draw() is invoked automatically if parts of the view should be redrawn
182  on the screen. This can occur when e.g. the view has been moved or the appearance
183  of the view has changed before.
184  Draw() is invoked automatically by the framework, you never will need to invoke
185  this method directly. However you can request an invocation of this method by
186  calling the method InvalidateArea() of the views @Owner. Usually this is also
187  unnecessary unless you are developing your own view.
188  The passed parameters determine the drawing destination aCanvas and the area
189  to redraw aClip in the coordinate space of the canvas. The parameter aOffset
190  contains the displacement between the origin of the views owner and the origin
191  of the canvas. You will need it to convert views coordinates into these of the
192  canvas.
193  The parameter aOpacity contains the opacity descended from this view's @Owner.
194  It lies in range 0 .. 255. If the view implements its own 'Opacity', 'Color',
195  etc. properties, the Draw() method should calculate the resulting real opacity
196  by mixing the values of these properties with the one passed in aOpacity parameter.
197  The parameter aBlend contains the blending mode descended from this view's @Owner.
198  It determines, whether the view should be drawn with alpha-blending active or
199  not. If aBlend is false, the outputs of the view should overwrite the corresponding
200  pixel in the drawing destination aCanvas. If aBlend is true, the outputs should
201  be mixed with the pixel already stored in aCanvas. For this purpose all Graphics
202  Engine functions provide a parameter to specify the mode for the respective drawing
203  operation. If the view implements its own 'Blend' property, the Draw() method
204  should calculate the resulting real blend mode by using logical AND operation
205  of the value of the property and the one passed in aBlend parameter. */
206 void CoreSimpleTouchHandler_Draw( CoreSimpleTouchHandler _this, GraphicsCanvas aCanvas,
208 
209 /* The method HandleEvent() is invoked automatically if the view has received an
210  event. For example, touching the view on the touch screen can cause the view
211  to receive a Core::CursorEvent event. Within this method the view can evaluate
212  the event and react to it.
213  Whether the event has been handled by the view or not is determined by the return
214  value. To sign an event as handled HandleEvent() should return a valid object
215  (e.g. 'this'). If the event has not been handled, 'null' should be returned.
216  Depending on the kind of the event, the framework can continue dispatching of
217  still unhandled events. For example, keyboard events (Core::KeyEvent class) are
218  automatically delivered to the superior @Owner of the receiver view if this view
219  has ignored the event.
220  HandleEvent() is invoked automatically by the framework, so you never should
221  need to invoke it directly. However you can prepare and post new events by using
222  the methods DispatchEvent() and BroadcastEvent() of the application class Core::Root. */
223 XObject CoreSimpleTouchHandler_HandleEvent( CoreSimpleTouchHandler _this, CoreEvent
224  aEvent );
225 
226 /* The method CursorHitTest() is invoked automatically in order to determine whether
227  the view is interested in the receipt of cursor events or not. This method will
228  be invoked immediately after the user has tapped the visible area of the view.
229  If the view is not interested in the cursor event, the framework repeats this
230  procedure for the next behind view until a willing view has been found or all
231  views are evaluated.
232  In the implementation of the method the view can evaluate the passed aArea parameter.
233  It determines the place where the user has tapped the view with his fingertip
234  expressed in the coordinates of the views @Owner. The method can test e.g. whether
235  the tapped area does intersect any touchable areas within the view, etc. The
236  affected finger is identified in the parameter aFinger. The first finger (or
237  the first mouse device button) has the number 0.
238  The parameter aStrikeCount determines how many times the same area has been tapped
239  in series. This is useful to detect series of multiple touches, e.g. in case
240  of the double click, aStrikeCount == 2.
241  The parameter aDedicatedView, if it is not 'null', restricts the event to be
242  handled by this view only. If aDedicatedView == null, no special restriction
243  exists.
244  This method is also invoked if during an existing grab cycle the current target
245  view has decided to resign and deflect the cursor events to another view. This
246  is usually the case after the user has performed a gesture the current target
247  view is not interested to process. Thereupon, the system looks for another view
248  willing to take over the cursor event processing after the performed gesture.
249  Which gesture has caused the operation, is specified in the parameter aRetargetReason.
250  If the view is willing to process the event, the method should create, initialize
251  and return a new Core::CursorHit object. This object identify the willing view.
252  Otherwise the method should return 'null'.
253  CursorHitTest() is invoked automatically by the framework, so you never should
254  need to invoke it directly. This method is predetermined for the hit-test only.
255  The proper processing of events should take place in the @HandleEvent() method
256  by reacting to Core::CursorEvent and Core::DragEvent events. */
257 CoreCursorHit CoreSimpleTouchHandler_CursorHitTest( CoreSimpleTouchHandler _this,
258  XRect aArea, XInt32 aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet
259  aRetargetReason );
260 
261 /* 'C' function for method : 'Core::SimpleTouchHandler.OnSetRetargetOffset()' */
262 void CoreSimpleTouchHandler_OnSetRetargetOffset( CoreSimpleTouchHandler _this, XInt32
263  value );
264 
265 /* 'C' function for method : 'Core::SimpleTouchHandler.OnSetMaxStrikeCount()' */
266 void CoreSimpleTouchHandler_OnSetMaxStrikeCount( CoreSimpleTouchHandler _this, XInt32
267  value );
268 
269 /* 'C' function for method : 'Core::SimpleTouchHandler.OnSetEnabled()' */
270 void CoreSimpleTouchHandler_OnSetEnabled( CoreSimpleTouchHandler _this, XBool value );
271 
272 #ifdef __cplusplus
273  }
274 #endif
275 
276 #endif /* _CoreSimpleTouchHandler_H */
277 
278 /* Embedded Wizard */
CoreSimpleTouchHandler_HandleEvent
XObject CoreSimpleTouchHandler_HandleEvent(CoreSimpleTouchHandler _this, CoreEvent aEvent)
Definition: Core.c:5932
aCanvas
XRect CoreOutline aOutline GraphicsCanvas aCanvas
Definition: _CoreSimpleTouchHandler.h:206
CoreSimpleTouchHandler_OnSetRetargetOffset
void CoreSimpleTouchHandler_OnSetRetargetOffset(CoreSimpleTouchHandler _this, XInt32 value)
Definition: Core.c:6229
ewrte.h
CoreSimpleTouchHandler_OnSetMaxStrikeCount
void CoreSimpleTouchHandler_OnSetMaxStrikeCount(CoreSimpleTouchHandler _this, XInt32 value)
Definition: Core.c:6239
EW_END_OF_FIELDS
#define EW_END_OF_FIELDS(aClass)
Definition: ewrte.h:460
aOffset
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint aOffset
Definition: _CoreSimpleTouchHandler.h:207
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
aBounds
XRect aBounds
Definition: _CoreSimpleTouchHandler.h:160
ewgfx.h
_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
CoreCursorHit
XRect CoreOutline aOutline CoreCursorHit(CoreSimpleTouchHandler _this, XRect aArea, XInt32 aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet aRetargetReason) EW_METHOD(ArrangeView
value
XRect CoreOutline aOutline XPoint value
Definition: _ViewsWarpView.h:137
aOpacity
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint XInt32 aOpacity
Definition: _CoreSimpleTouchHandler.h:207
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
_CoreQuadView.h
CoreSimpleTouchHandler_Draw
void CoreSimpleTouchHandler_Draw(CoreSimpleTouchHandler _this, GraphicsCanvas aCanvas, XRect aClip, XPoint aOffset, XInt32 aOpacity, XBool aBlend)
Definition: Core.c:5906
XSet
unsigned long XSet
Definition: ewrte.h:1594
CoreSimpleTouchHandler_OnSetEnabled
void CoreSimpleTouchHandler_OnSetEnabled(CoreSimpleTouchHandler _this, XBool value)
Definition: Core.c:6249
CoreSimpleTouchHandler_CursorHitTest
CoreCursorHit CoreSimpleTouchHandler_CursorHitTest(CoreSimpleTouchHandler _this, XRect aArea, XInt32 aFinger, XInt32 aStrikeCount, CoreView aDedicatedView, XSet aRetargetReason)
Definition: Core.c:6149
EW_METHOD
EW_METHOD(initLayoutContext, void)(CoreQuadView _this
XPoint
Definition: ewrte.h:1616
EW_PROPERTY
#define EW_PROPERTY(aName, aType)
Definition: ewrte.h:466
aClip
XRect CoreOutline aOutline GraphicsCanvas XRect aClip
Definition: _CoreSimpleTouchHandler.h:207
XUInt32
unsigned long XUInt32
Definition: ewrte.h:1590
EW_END_OF_METHODS
#define EW_END_OF_METHODS(aClass)
Definition: ewrte.h:539
aBlend
XRect CoreOutline aOutline GraphicsCanvas XRect XPoint XInt32 XBool aBlend
Definition: _CoreSimpleTouchHandler.h:207
EW_DEFINE_FIELDS
#define EW_DEFINE_FIELDS(aClass, aSuperClass)
Definition: ewrte.h:451