1 /* |
|
2 * ============================================================================ |
|
3 * Name : hgteleporteventcontroler.h |
|
4 * Part of : Hg Teleport |
|
5 * Description : Gesture and physics helper declaration |
|
6 * Version : %version: 3 % |
|
7 * |
|
8 * Copyright © 2008 Nokia. All rights reserved. |
|
9 * This material, including documentation and any related computer |
|
10 * programs, is protected by copyright controlled by Nokia. All |
|
11 * rights are reserved. Copying, including reproducing, storing, |
|
12 * adapting or translating, any or all of this material requires the |
|
13 * prior written consent of Nokia. This material also contains |
|
14 * confidential information which may not be disclosed to others |
|
15 * without the prior written consent of Nokia. |
|
16 * ============================================================================ |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef HGTELEPORTEVENTCONTROLER_H |
|
21 #define HGTELEPORTEVENTCONTROLER_H |
|
22 |
|
23 #include "hgteleporteventcontrolerobserver.h" |
|
24 #include <akntouchgesturefw.h> |
|
25 #include <aknphysicsobserveriface.h> |
|
26 |
|
27 class CHgTeleportPhysicsEngine; |
|
28 using namespace AknTouchGestureFw; |
|
29 /** |
|
30 * CHgTeleportEventControler |
|
31 * Input events handler. Class analyse pointer events and translate it to gesture. Procerss animations physics |
|
32 */ |
|
33 NONSHARABLE_CLASS(CHgTeleportEventControler): |
|
34 public CBase, |
|
35 public MAknTouchGestureFwObserver, |
|
36 public MAknPhysicsObserver |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Two phase constructor. Instance is pushed on cleanup stack. |
|
41 * @param aObs - reference to controler observer |
|
42 * @param aEventSrc - reference to control which provide pointer events |
|
43 * @return address of controler instance |
|
44 */ |
|
45 static CHgTeleportEventControler* NewLC(MHgTeleportEventControlerObserver& aObs, |
|
46 CCoeControl& aEventSrc); |
|
47 |
|
48 /** |
|
49 * Two phase constructor. |
|
50 * @param aObs - reference to control observer |
|
51 * @param aEventSrc - reference to control which provide pointer events |
|
52 * @return address of controler instance |
|
53 */ |
|
54 static CHgTeleportEventControler* NewL(MHgTeleportEventControlerObserver& aObs, |
|
55 CCoeControl& aEventSrc); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 */ |
|
60 ~CHgTeleportEventControler(); |
|
61 |
|
62 private: |
|
63 /** |
|
64 * First phase construction |
|
65 */ |
|
66 CHgTeleportEventControler(MHgTeleportEventControlerObserver& aObserver); |
|
67 |
|
68 /** |
|
69 * Second phase construction |
|
70 * @param aEventSrc - control that provides pointer ivents to handler |
|
71 */ |
|
72 void ConstructL(CCoeControl& aEventSrc); |
|
73 |
|
74 /** |
|
75 * Implements gesture handling |
|
76 * @param aEvent - gesture event |
|
77 * @see MAknTouchGestureFwObserver |
|
78 */ |
|
79 void HandleTouchGestureL(MAknTouchGestureFwEvent& aEvent); |
|
80 |
|
81 /** |
|
82 * Implements tap gesture handling ( short tap, double tap, long tap ) |
|
83 * @param aEvent - tap event |
|
84 */ |
|
85 void HandleTapEventL(MAknTouchGestureFwTapEvent& aEvent); |
|
86 |
|
87 /** |
|
88 * Implements drag gesture handling |
|
89 * @param aEvent - drag event |
|
90 */ |
|
91 void HandleDragEventL(MAknTouchGestureFwDragEvent& aEvent); |
|
92 |
|
93 /** |
|
94 * Implements flick gesture handling |
|
95 * @param aEvent - drag event |
|
96 */ |
|
97 void HandleFlickEventL(MAknTouchGestureFwFlickEvent& aEvent); |
|
98 |
|
99 //From MAknPhysicsObserver |
|
100 public: |
|
101 /** |
|
102 * Physics emulation has moved the view. |
|
103 * |
|
104 * When this method is called client should update its visual and logical |
|
105 * states to reflect the changes caused by view move. Note that if the |
|
106 * parameter @c aDrawNow is @c EFalse client is not allowed to redraw the |
|
107 * display but should only update its logical state. |
|
108 * Physics engine will ensure that the last frame is always drawn. |
|
109 * |
|
110 * @since S60 v5.0 |
|
111 * |
|
112 * @param aNewPosition The new position of the view. |
|
113 * @param aDrawNow @c ETrue if client should redraw the screen, |
|
114 * otherwise @c EFalse. |
|
115 * @param aFlags Additional flags, not used currently. |
|
116 */ |
|
117 virtual void ViewPositionChanged( const TPoint& aNewPosition, |
|
118 TBool aDrawNow, |
|
119 TUint aFlags ); |
|
120 |
|
121 /** |
|
122 * Physics emulation has stopped moving the view |
|
123 * |
|
124 * @since S60 v5.0 |
|
125 */ |
|
126 virtual void PhysicEmulationEnded(); |
|
127 |
|
128 /** |
|
129 * Returns the observer's view position. |
|
130 * |
|
131 * @since S60 v5.0 |
|
132 * |
|
133 * @return Physics observer's view position. |
|
134 */ |
|
135 virtual TPoint ViewPosition() const; |
|
136 |
|
137 public: |
|
138 |
|
139 /** |
|
140 * Initialize animation between current position and destination point |
|
141 * @param aPoint - destination point |
|
142 */ |
|
143 void Animate(const TPoint& aPoint); |
|
144 |
|
145 /** |
|
146 * |
|
147 * @param aWorldSize Physics world size. |
|
148 * @param aViewSize Physics (visible) view size. |
|
149 * @param aLandscape ETrue if physics should work in landscape. |
|
150 **/ |
|
151 void ReInitPhysicsL(const TSize& aWorldSize, |
|
152 const TSize& aViewSize, |
|
153 TBool aLandscape); |
|
154 |
|
155 /** |
|
156 * Stops currently ongoing animation |
|
157 */ |
|
158 void StopAnimation(); |
|
159 |
|
160 private: |
|
161 /** |
|
162 * Controler observer. Not own |
|
163 */ |
|
164 MHgTeleportEventControlerObserver& iObserver; |
|
165 |
|
166 /** |
|
167 * Gesture recognition helper. Own |
|
168 */ |
|
169 CAknTouchGestureFw* iGestureHelper; |
|
170 |
|
171 /** |
|
172 * Physics helper. Own |
|
173 */ |
|
174 CHgTeleportPhysicsEngine* iPhysicsHelper; |
|
175 }; |
|
176 |
|
177 #endif // HGTELEPORTEVENTCONTROLER_H |
|