|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: Gesture helper implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef RT_GESTUREIF_H_ |
|
19 #define RT_GESTUREIF_H_ |
|
20 // INCLUDES |
|
21 #include <e32std.h> |
|
22 #include <e32base.h> |
|
23 #include <coemain.h> |
|
24 #include <aknutils.h> |
|
25 #include <e32property.h> |
|
26 #include <w32std.h> |
|
27 |
|
28 namespace stmGesture |
|
29 { |
|
30 |
|
31 /** |
|
32 * UIDs for supported Gestures |
|
33 */ |
|
34 enum TGestureUid |
|
35 { |
|
36 EGestureUidUnknown = 0, |
|
37 EGestureUidTouch, |
|
38 EGestureUidTap, |
|
39 EGestureUidDoubleTap = EGestureUidTap, |
|
40 EGestureUidLongPress, |
|
41 EGestureUidHover, |
|
42 EGestureUidPan, |
|
43 EGestureUidRelease, |
|
44 EGestureUidLeftRight, |
|
45 EGestureUidUpDown, |
|
46 EGestureUidFlick, |
|
47 EGestureUidEdgeScroll, |
|
48 EGestureUidPinch, |
|
49 EGestureUidCornerZoom, |
|
50 // |
|
51 EStmGestureUid_Count |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Area Settings |
|
56 */ |
|
57 enum TGestureAreaSettings |
|
58 { |
|
59 ETouchTimeArea, |
|
60 ETouchArea, |
|
61 EHoldArea, |
|
62 // |
|
63 EGestureAreaSettingsCount |
|
64 }; |
|
65 |
|
66 /** |
|
67 * Gesture Specific Settings |
|
68 */ |
|
69 enum TGestureSettings |
|
70 { |
|
71 //ETouchTimeout, |
|
72 EDoubleTapTimeout, |
|
73 ESuppressTimeout, |
|
74 EMoveSuppressTimeout, |
|
75 EHoverSpeed, |
|
76 EPanSpeedLow, |
|
77 EPanSpeedHigh, |
|
78 EFlickSpeed = EPanSpeedHigh, |
|
79 EPinchSpeed, |
|
80 EZoomCornerSize, |
|
81 EEdgeScrollRange, |
|
82 ECapacitiveUpUsed, |
|
83 EPanDisabledWhileHovering, |
|
84 EHoverDisabledWhilePanning, |
|
85 EAdjustYPos, |
|
86 EEnableFiltering, |
|
87 EWServMessageInterception, |
|
88 // |
|
89 EGestureSettingsCount |
|
90 }; |
|
91 |
|
92 struct TGestureArea |
|
93 { |
|
94 public: |
|
95 enum TShape |
|
96 { |
|
97 /// Use GestureArea settings from globally defined default |
|
98 EDefaultSettings = -1, |
|
99 ERectangle = 1, // == stmUiEventEngine::ERectangle, |
|
100 ECircle = 2, // == stmUiEventEngine::ECircle, |
|
101 EEllipse = 3 // == stmUiEventEngine::EEllipse |
|
102 }; |
|
103 |
|
104 TShape iShape; |
|
105 TInt iTimeout; |
|
106 // At the moment iWidth is only used |
|
107 TSize iSize; |
|
108 }; |
|
109 |
|
110 /** |
|
111 * Edge Scroll Type |
|
112 */ |
|
113 enum TEdgeScroll |
|
114 { |
|
115 EEdgeScrollUp = 1, |
|
116 EEdgeScrollDown, |
|
117 EEdgeScrollLeft, |
|
118 EEdgeScrollRight, |
|
119 EEdgeScrollUnknown |
|
120 }; |
|
121 |
|
122 /** |
|
123 * Tap Type |
|
124 */ |
|
125 enum TTapType |
|
126 { |
|
127 ETapTypeSingle = 1, |
|
128 ETapTypeDouble |
|
129 }; |
|
130 |
|
131 /** |
|
132 * Zoom Type |
|
133 */ |
|
134 enum TZoomType |
|
135 { |
|
136 EZoomUndefined = 0, |
|
137 EZoomIn = 1, |
|
138 EZoomOut = 2 |
|
139 }; |
|
140 |
|
141 /** |
|
142 * Direction Definition |
|
143 */ |
|
144 enum TGestureDirection |
|
145 { |
|
146 ENoDirection = 0, |
|
147 // |
|
148 ENorth = 1, |
|
149 ENorthEast, |
|
150 EEast, |
|
151 ESouthEast, |
|
152 ESouth, |
|
153 ESouthWest, |
|
154 EWest, |
|
155 ENorthWest, |
|
156 }; |
|
157 |
|
158 /*! |
|
159 * Generic gesture interface. The gestures |
|
160 * contain a generic part and a gesture specific part |
|
161 * is obtained using the getDetails() method. |
|
162 * |
|
163 */ |
|
164 class MGestureIf |
|
165 { |
|
166 public: |
|
167 virtual TGestureUid gestureUid() const = 0; // Identifier of recognizer type that issues the gesture |
|
168 virtual TPoint getLocation() const = 0 ; // Location where the gesture happened (if applicable) |
|
169 virtual int getType() const = 0 ; // If the gesture can have different types (like tap or double tap) |
|
170 virtual float getSpeedX() const __SOFTFP = 0 ; // px/msec, as calculated in the UI state machine, not valid in all cases |
|
171 virtual float getSpeedY() const __SOFTFP = 0 ; // px/msec, as calculated in the UI state machine, not valid in all cases |
|
172 virtual int getDetails() const = 0 ; // Other possible details.... |
|
173 virtual TPtrC8 getGestureName() = 0 ; // String name for gesture, makes possible to use single callback for gestures |
|
174 virtual TPoint getLengthAndDirection() const { return TPoint(0,0); } // very simple vector |
|
175 virtual TGestureDirection getDirection() const { return stmGesture::ENoDirection; } |
|
176 virtual TPoint getPinchEndPos() const { return TPoint(0,0); } |
|
177 }; |
|
178 |
|
179 } // namespace |
|
180 |
|
181 #endif /* RT_GESTUREIF_H_ */ |