|
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: Base class for touch gesture recognizers. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_AKNTOUCHGESTUREFWBASERECOGNIZER_H |
|
19 #define C_AKNTOUCHGESTUREFWBASERECOGNIZER_H |
|
20 |
|
21 #include <akntouchgesturefwevents.h> |
|
22 #include <touchfeedback.h> |
|
23 |
|
24 #include "akntouchgesturefwutils.h" |
|
25 |
|
26 namespace AknTouchGestureFw { |
|
27 |
|
28 class CAknTouchGestureFwRecognitionEngine; |
|
29 class MAknTouchGestureFwEvent; |
|
30 class CAknTouchGestureFwSettings; |
|
31 |
|
32 /** |
|
33 * Base class for touch gesture recognizers. |
|
34 * |
|
35 * @lib akntouchgesturefw |
|
36 * @since S60 v5.2 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CAknTouchGestureFwBaseRecognizer ) : public CBase |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Returns @c ETrue if recognizer is enabled. |
|
45 * |
|
46 * @return @c ETrue if recognizer is enabled. |
|
47 */ |
|
48 TBool Enabled() const; |
|
49 |
|
50 /** |
|
51 * Enables or disables recognizer. |
|
52 * |
|
53 * @param aEnable @c ETrue if recognizer is to be enabled, |
|
54 * @c EFalse otherwise. |
|
55 */ |
|
56 void SetEnabled( TBool aEnable ); |
|
57 |
|
58 /** |
|
59 * Returns recognizer gesture group. |
|
60 * |
|
61 * @return Gesture group. |
|
62 */ |
|
63 virtual TAknTouchGestureFwGroup GestureGroup() const = 0; |
|
64 |
|
65 /** |
|
66 * Cancels gesture recognition. |
|
67 */ |
|
68 virtual void CancelRecognizing() = 0; |
|
69 |
|
70 /** |
|
71 * Handles single pointer event. |
|
72 * Single touch is expected to be always reliable. |
|
73 * |
|
74 * @param aPointerData Pointer event related data. |
|
75 */ |
|
76 virtual void HandleSinglePointerEventL( |
|
77 const TPointerEventData& aPointerData ) = 0; |
|
78 |
|
79 /** |
|
80 * Handles multi pointer event. |
|
81 * |
|
82 * @param aPointerData Pointer event related data. |
|
83 * @param aFirstPointerPosition First pointer position. |
|
84 * @param aSecondPointerPosition Second pointer position. |
|
85 */ |
|
86 virtual void HandleMultiPointerEventL( |
|
87 const TPointerEventData& aPointerData, |
|
88 const TPoint& aFirstPointerPosition, |
|
89 const TPoint& aSecondPointerPosition ) = 0; |
|
90 |
|
91 /** |
|
92 * Sets gesture types which generate tactile and audio feedback. |
|
93 * |
|
94 * @param aGestureTypesForTactile Gesture types with tactile feedback |
|
95 * @param aGestureTypesForAudio Gesture types with audio feedback |
|
96 */ |
|
97 void SetFeedbackForTypesL( |
|
98 TUint aGestureTypesForTactile, |
|
99 TUint aGestureTypesForAudio ); |
|
100 |
|
101 protected: |
|
102 |
|
103 /** |
|
104 * C++ constructor. |
|
105 * |
|
106 * @param aEngine The gesture recognition engine. |
|
107 */ |
|
108 CAknTouchGestureFwBaseRecognizer( |
|
109 CAknTouchGestureFwRecognitionEngine& aEngine ); |
|
110 |
|
111 /** |
|
112 * Sends event to engine. |
|
113 * |
|
114 * @param aEvent Touch gesture event to send. |
|
115 */ |
|
116 void SendGestureEventL( MAknTouchGestureFwEvent& aEvent ); |
|
117 |
|
118 /** |
|
119 * Returns a reference to the Central Repository settings provider. |
|
120 * |
|
121 * @return Settings provider. |
|
122 */ |
|
123 CAknTouchGestureFwSettings& Settings() const; |
|
124 |
|
125 /** |
|
126 * Returns drag threshold. |
|
127 * |
|
128 * @return Drag threshold. |
|
129 */ |
|
130 TInt DragThreshold() const; |
|
131 |
|
132 /** |
|
133 * Gives immediate direct feedback. |
|
134 * |
|
135 * @param aLogicalFeedback - The logical feedback type to play. |
|
136 * @param aFeedbackType - Feedback types to be played as a bitmask |
|
137 * combination of enumeration items from |
|
138 * TTouchFeedbackType. |
|
139 */ |
|
140 void ImmediateFeedback( |
|
141 TTouchLogicalFeedback aLogicalFeedback, |
|
142 TTouchFeedbackType aFeedbackType ); |
|
143 |
|
144 /** |
|
145 * Starts continuous feedback. |
|
146 * |
|
147 * @param aType - The continuous feedback type to play. |
|
148 * @param aIntensity - Intensity of continuous feedback. |
|
149 * @param aTimeout - Timeout value to automatically stop continuous |
|
150 * feedback if there's no new Start call within the |
|
151 * timeout. Use value 0 if timeout is not used. |
|
152 */ |
|
153 void StartContinuousFeedback( |
|
154 TTouchContinuousFeedback aContinuousFeedback, |
|
155 TInt aIntensity, |
|
156 TTimeIntervalMicroSeconds32 aTimeout ); |
|
157 |
|
158 /** |
|
159 * Modifies continuous feedback. |
|
160 * |
|
161 * @param aIntensity - New intensity value for feedback. |
|
162 */ |
|
163 void ModifyContinuousFeedback( TInt aIntensity ); |
|
164 |
|
165 /** |
|
166 * Stops continuous feedback. |
|
167 */ |
|
168 void StopContinuousFeedback(); |
|
169 |
|
170 /** |
|
171 * Returns feedback types of requested gesture type. |
|
172 * |
|
173 * @return Feedback type |
|
174 */ |
|
175 TTouchFeedbackType FeedbackType( TAknTouchGestureFwType aGestureType ); |
|
176 |
|
177 private: // data |
|
178 |
|
179 /** |
|
180 * Reference to the gesture recognition engine. |
|
181 * Not own. |
|
182 */ |
|
183 CAknTouchGestureFwRecognitionEngine& iEngine; |
|
184 |
|
185 /** |
|
186 * Is the recognizer enabled or not. |
|
187 */ |
|
188 TBool iEnabled; |
|
189 |
|
190 /** |
|
191 * Gesture types for tactile vibra. |
|
192 */ |
|
193 TUint iGestureTypesForTactile; |
|
194 |
|
195 /** |
|
196 * Gesture types for audio. |
|
197 */ |
|
198 TUint iGestureTypesForAudio; |
|
199 }; |
|
200 |
|
201 } // namespace AknTouchGestureFw |
|
202 |
|
203 #endif // C_AKNTOUCHGESTUREFWBASERECOGNIZER_H |