|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Touch gesture framework simulation class - for testing |
|
15 * purposes only. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef C_AKNTOUCHGESTUREFWSIMULATION_H |
|
20 #define C_AKNTOUCHGESTUREFWSIMULATION_H |
|
21 |
|
22 #include <coemain.h> |
|
23 |
|
24 /** |
|
25 * Ugly hack class to enable pointer number setting. |
|
26 * Needed only for pointer event simulation. |
|
27 */ |
|
28 class TAdvancedPointerEventHelper |
|
29 { |
|
30 public: |
|
31 |
|
32 /** |
|
33 * Sets pointer number to an advanced pointer event. |
|
34 * |
|
35 * @param[in,out] aEvent Advanced pointer event in which the |
|
36 * pointer number is attached to. |
|
37 * @param aPointerNumber Pointer number. |
|
38 */ |
|
39 static void SetPointerNumberToEvent( TAdvancedPointerEvent* aEvent, |
|
40 TInt aPointerNumber ); |
|
41 }; |
|
42 |
|
43 namespace AknTouchGestureFw |
|
44 { |
|
45 |
|
46 class CAknTouchGestureFw; |
|
47 class CAknTouchGestureFwImpl; |
|
48 |
|
49 const TUid KAknTouchGestureFwSimulation = { 0x20026770 }; |
|
50 |
|
51 /** |
|
52 * Touch gesture framework simulation interface. |
|
53 * |
|
54 */ |
|
55 class MAknTouchGestureFwSimulator |
|
56 { |
|
57 |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Simulation function. |
|
62 * |
|
63 * @param aGestureFw Gesture FW to which to send the event. |
|
64 * @param aEvent Simulated pointer event. |
|
65 * @param aPointerNumber Simulated pointer event pointer number. |
|
66 * @param aTimeStamp Simulated pointer event time stamp. |
|
67 */ |
|
68 virtual void SimulateL( CAknTouchGestureFw* aGestureFw, |
|
69 TPointerEvent& aEvent, |
|
70 TInt aPointerNumber, |
|
71 TTime aTimeStamp ) = 0; |
|
72 }; |
|
73 |
|
74 |
|
75 /** |
|
76 * Simulation data class. |
|
77 * |
|
78 */ |
|
79 NONSHARABLE_CLASS ( TAknTouchGestureFwSimulationData ) |
|
80 { |
|
81 |
|
82 public: |
|
83 |
|
84 /** |
|
85 * Pointer to gesture framework instance. |
|
86 * Not own. |
|
87 */ |
|
88 CAknTouchGestureFw* iGestureFw; |
|
89 |
|
90 /** |
|
91 * Pointer to gesture framework engine. |
|
92 * Not own. |
|
93 */ |
|
94 CAknTouchGestureFwImpl* iGestureEngine; |
|
95 }; |
|
96 |
|
97 |
|
98 /** |
|
99 * Touch gesture framework simulation class. |
|
100 * |
|
101 */ |
|
102 NONSHARABLE_CLASS( CAknTouchGestureFwSimulation ) |
|
103 : public CCoeStatic, |
|
104 public MAknTouchGestureFwSimulator |
|
105 { |
|
106 |
|
107 public: |
|
108 |
|
109 /** |
|
110 * Initializes simulation for a Gesture FW instance. |
|
111 * |
|
112 * @param aGestureFw Pointer to Gesture FW. |
|
113 * @param aGestureEngine Pointer to Gesture FW implementation. |
|
114 */ |
|
115 static void InitSimulationL( CAknTouchGestureFw* aGestureFw, |
|
116 CAknTouchGestureFwImpl* aGestureEngine ); |
|
117 |
|
118 /** |
|
119 * Ends simulation for a Gesture FW instance. |
|
120 * |
|
121 * @param aGestureFw Pointer to Gesture FW. |
|
122 */ |
|
123 static void EndSimulation( CAknTouchGestureFw* aGestureFw ); |
|
124 |
|
125 /** |
|
126 * Destructor. |
|
127 */ |
|
128 virtual ~CAknTouchGestureFwSimulation(); |
|
129 |
|
130 public: // From base class MAknTouchGestureFwSimulator. |
|
131 |
|
132 /** |
|
133 * Simulation function. |
|
134 * |
|
135 * @param aGestureFw Gesture FW to which to send the event. |
|
136 * @param aEvent Simulated pointer event. |
|
137 * @param aPointerNumber Simulated pointer event pointer number. |
|
138 * @param aTimeStamp Simulated pointer event time stamp. |
|
139 */ |
|
140 void SimulateL( CAknTouchGestureFw* aGestureFw, |
|
141 TPointerEvent& aEvent, |
|
142 TInt aPointerNumber, |
|
143 TTime aTimeStamp ); |
|
144 |
|
145 private: |
|
146 |
|
147 /** |
|
148 * C++ constructor. |
|
149 */ |
|
150 CAknTouchGestureFwSimulation(); |
|
151 |
|
152 private: // data |
|
153 |
|
154 /** |
|
155 * Array of simulation data. |
|
156 */ |
|
157 RArray <TAknTouchGestureFwSimulationData> iDataArray; |
|
158 }; |
|
159 |
|
160 } // namespace AknTouchGestureFw |
|
161 |
|
162 #endif // C_AKNTOUCHGESTUREFWSIMULATION_H |