author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:23:59 +0300 | |
branch | RCL_3 |
changeset 83 | 26b2b12093af |
parent 66 | 2455ef1f5bbc |
permissions | -rw-r--r-- |
66 | 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 "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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CMIDCANVASKEYPAD_H |
|
20 |
#define CMIDCANVASKEYPAD_H |
|
21 |
||
22 |
#include <coecntrl.h> |
|
23 |
#include <gdi.h> |
|
24 |
#include <lcdui.h> |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
25 |
#include <AknsBasicBackgroundControlContext.h> //skin |
66 | 26 |
|
27 |
class CAknButton; |
|
28 |
class CMIDDisplayable; |
|
29 |
class CMIDCanvas; |
|
30 |
||
31 |
// OnScreenKeypad types |
|
32 |
enum TCanvasKeypadType |
|
33 |
{ |
|
34 |
ENotDefined, |
|
35 |
EKeypadValueNo, |
|
36 |
EKeypadValueNavigationKeys, |
|
37 |
EKeypadValueGameActions, |
|
38 |
EKeypadValueLskRsk |
|
39 |
}; |
|
40 |
||
41 |
// type of pressed button |
|
42 |
enum TButtonPress |
|
43 |
{ |
|
44 |
ENoneKey, |
|
45 |
ERockerKey, |
|
46 |
EOtherKey |
|
47 |
}; |
|
48 |
||
49 |
// All possible OnScreenKeypad keys |
|
50 |
enum TKeypadKeys |
|
51 |
{ |
|
52 |
ENavigationKeysFire, |
|
53 |
ENavigationKeysRight, |
|
54 |
ENavigationKeysLeft, |
|
55 |
ENavigationKeysUp, |
|
56 |
ENavigationKeysDown, |
|
57 |
ENavigationKeysNumberOfButtons,//separator value for key types |
|
58 |
EGameA, |
|
59 |
EGameB, |
|
60 |
EGameC, |
|
61 |
EGameD, |
|
62 |
ELsk, |
|
63 |
ERsk |
|
64 |
}; |
|
65 |
||
66 |
NONSHARABLE_CLASS(CMIDCanvasKeypad) : public CCoeControl |
|
67 |
{ |
|
68 |
struct TButtonData |
|
69 |
{ |
|
70 |
CAknButton* iButton; |
|
71 |
TKeyEvent iKeyEvent; |
|
72 |
TKeyEvent iKeyEvent_2; |
|
73 |
TKeypadKeys keyType; |
|
74 |
}; |
|
75 |
||
76 |
public: |
|
77 |
friend class CMIDUIManager; |
|
78 |
||
79 |
/** |
|
80 |
* Ctor |
|
81 |
*/ |
|
82 |
~CMIDCanvasKeypad(); |
|
83 |
||
84 |
//From CCoeControl |
|
85 |
/** |
|
86 |
* @see CCoeControl::CountComponentControls() |
|
87 |
*/ |
|
88 |
TInt CountComponentControls() const; |
|
89 |
||
90 |
/** |
|
91 |
* @see CCoeControl::ComponentControl() |
|
92 |
*/ |
|
93 |
CCoeControl* ComponentControl(TInt) const; |
|
94 |
||
95 |
/** |
|
96 |
* @see CCoeControl::SizeChanged() |
|
97 |
*/ |
|
98 |
void SizeChanged(); |
|
99 |
||
100 |
/** |
|
101 |
* @see CCoeControl::HandlePointerEventL() |
|
102 |
*/ |
|
103 |
void HandlePointerEventL(const TPointerEvent &aPointerEvent); |
|
104 |
||
105 |
/** |
|
106 |
* Layouts and draws OnScreenKeypad to the screen. |
|
107 |
* |
|
108 |
* |
|
109 |
* @param aCanvas Canvas that which listens to OnScreenKeypad events. |
|
110 |
* @param aKeypadType OnScreenKeypad type |
|
111 |
* @param aDisplayable MMIDisplayable that currently uses the CMIDCanvasKeypad. |
|
112 |
* @since S60 5.0 |
|
113 |
*/ |
|
114 |
void UpdateVisualAppearanceL(CMIDCanvas& aCanvas, TInt aKeypadType, MMIDDisplayable& aDisplayable); |
|
115 |
||
116 |
/** |
|
117 |
* Notify a CMIDCanvasKeypad then application is switch to background. |
|
118 |
* |
|
119 |
* @since S60 5.0 |
|
120 |
*/ |
|
121 |
void HandleApplicationBackground(); |
|
122 |
/** |
|
123 |
* Send EButton1Up event and stoped repeat timer if OSK in background |
|
124 |
* |
|
125 |
*/ |
|
126 |
void OSKInBackground(TBool aOSKInBackground); |
|
127 |
||
128 |
protected: |
|
129 |
/** |
|
130 |
* Draws skin and separator lines between Canvas and keypad. |
|
131 |
* |
|
132 |
* @since S60 5.0 |
|
133 |
*/ |
|
134 |
void Draw(const TRect &aRect) const; |
|
135 |
||
136 |
private: |
|
137 |
/** |
|
138 |
* Ctor |
|
139 |
* @since S60 5.0 |
|
140 |
*/ |
|
141 |
static CMIDCanvasKeypad* NewL(MMIDDisplayable* aDisplayable); |
|
142 |
||
143 |
/** |
|
144 |
* Ctor |
|
145 |
* @since S60 5.0 |
|
146 |
*/ |
|
147 |
void ConstructL(MMIDDisplayable* aDisplayable); |
|
148 |
||
149 |
/** |
|
150 |
* Ctor |
|
151 |
* @since S60 5.0 |
|
152 |
*/ |
|
153 |
CMIDCanvasKeypad(); |
|
154 |
||
155 |
/** |
|
156 |
* Deletes all the created buttons. |
|
157 |
* |
|
158 |
* @since S60 5.0 |
|
159 |
*/ |
|
160 |
void DeleteButtons(); |
|
161 |
||
162 |
/** |
|
163 |
* Creates all buttons |
|
164 |
* |
|
165 |
* @since S60 5.0 |
|
166 |
*/ |
|
167 |
void CreateButtonsL(); |
|
168 |
||
169 |
/** |
|
170 |
* Initializes buttons that are used. |
|
171 |
* |
|
172 |
* @since S60 5.0 |
|
173 |
*/ |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
174 |
void InitializeKeys(); |
66 | 175 |
|
176 |
/** |
|
177 |
* Sets key event struct for each button. |
|
178 |
* Key events are sent to Canvas when button pressed. |
|
179 |
* @since S60 5.0 |
|
180 |
*/ |
|
181 |
void InitializeKeyEvents(TKeypadKeys aKeypadKeys, TButtonData* aButtonData); |
|
182 |
||
183 |
/** |
|
184 |
* Sets Rect areas for buttons from LAF. |
|
185 |
* |
|
186 |
* @since S60 5.0 |
|
187 |
*/ |
|
188 |
void SetRectForAllButtons(); |
|
189 |
||
190 |
/** |
|
191 |
* Updates keypad area rect from LAF. |
|
192 |
* |
|
193 |
* @since S60 5.0 |
|
194 |
*/ |
|
195 |
void UpdateKeypadPaneRect(); |
|
196 |
||
197 |
/** |
|
198 |
* Calls OfferKeyEventL function in CMIDCanvas. |
|
199 |
* |
|
200 |
* @param aEvent Event that is generated. |
|
201 |
* @param aType Event code that is that is generated. |
|
202 |
* @param aFeedbckRpt Feedback on key repeat on/off |
|
203 |
* @return TKeyResponse Returns TKeyResponse indicating whether the key event was consumend. |
|
204 |
* @since S60 5.0 |
|
205 |
*/ |
|
206 |
TKeyResponse RaiseOfferKeyEventL(const TKeyEvent& aEvent, TEventCode aType, TBool aFeedbckRpt = ETrue); |
|
207 |
||
208 |
/** |
|
209 |
* Static callback function called by the repeat timer. |
|
210 |
* |
|
211 |
* @param aThis Pointer to an instance of this class. |
|
212 |
* @return TInt Returns zero always. |
|
213 |
* @since S60 5.0 |
|
214 |
*/ |
|
215 |
static TInt RepeatTimerCallbackL(TAny* aThis); |
|
216 |
||
217 |
/** |
|
218 |
* Generates keyRepeated events when repeat timer expires. |
|
219 |
* |
|
220 |
* @since S60 5.0 |
|
221 |
*/ |
|
222 |
void HandleRepeatTimerEventL(); |
|
223 |
||
224 |
/** |
|
225 |
* Cancels key repeat timer. |
|
226 |
* Sends also up event for a key that is possible pressed down |
|
227 |
* and also resets button state. |
|
228 |
* |
|
229 |
* @since S60 5.0 |
|
230 |
*/ |
|
231 |
void ResetButtons(); |
|
232 |
||
233 |
/** |
|
234 |
* Reference counter. |
|
235 |
* Number of Displayables (Canvases) that are using CanvasKeypad. |
|
236 |
* If reference counter becomes 0, then we destroy ourself. |
|
237 |
*/ |
|
238 |
TUint16 iRefC; |
|
239 |
||
240 |
/** |
|
241 |
* The whole screen size. |
|
242 |
* Needed when we decide whether we must re-create the button graphics. |
|
243 |
* |
|
244 |
*/ |
|
245 |
TRect iScreenRect; |
|
246 |
||
247 |
/** |
|
248 |
* Pointer to acting Displayable. |
|
249 |
*/ |
|
250 |
CMIDDisplayable* iDisplayable; |
|
251 |
||
252 |
/** |
|
253 |
* Pointer to acting Canvas. |
|
254 |
*/ |
|
255 |
CMIDCanvas* iCanvas; |
|
256 |
||
257 |
/** |
|
258 |
* Rect for the whole keypad area. |
|
259 |
*/ |
|
260 |
TRect iKeypadPaneRect; |
|
261 |
||
262 |
/** |
|
263 |
* Rect for the rocker keys. |
|
264 |
*/ |
|
265 |
TRect iRockerRect; |
|
266 |
||
267 |
/** |
|
268 |
* Rect for the left softkey. |
|
269 |
*/ |
|
270 |
TRect iLskRect; |
|
271 |
||
272 |
/** |
|
273 |
* Rect for the right softkey. |
|
274 |
*/ |
|
275 |
TRect iRskRect; |
|
276 |
||
277 |
/** |
|
278 |
* Rect for the GAME A button. |
|
279 |
*/ |
|
280 |
TRect iGameARect; |
|
281 |
||
282 |
/** |
|
283 |
* Rect for the GAME B button. |
|
284 |
*/ |
|
285 |
TRect iGameBRect; |
|
286 |
||
287 |
/** |
|
288 |
* Rect for the GAME C button. |
|
289 |
*/ |
|
290 |
TRect iGameCRect; |
|
291 |
||
292 |
/** |
|
293 |
* Rect for the GAME D button. |
|
294 |
*/ |
|
295 |
TRect iGameDRect; |
|
296 |
||
297 |
/** |
|
298 |
* Information about Canvas display mode. |
|
299 |
*/ |
|
300 |
TBool iIsFullScreenMode; |
|
301 |
||
302 |
/** |
|
303 |
* Information about layout orientation. |
|
304 |
*/ |
|
305 |
TBool iIsPortrait; |
|
306 |
||
307 |
/** |
|
308 |
* Information about used keypad type. |
|
309 |
*/ |
|
310 |
TInt iKeypadType; |
|
311 |
||
312 |
/** |
|
313 |
* Key event type. |
|
314 |
*/ |
|
315 |
TKeyEvent iKeyEvent; |
|
316 |
||
317 |
/** |
|
318 |
* Counter for received drag events. |
|
319 |
*/ |
|
320 |
TInt iDrag; |
|
321 |
||
322 |
/** |
|
323 |
* Array for the button data of all buttons. |
|
324 |
*/ |
|
325 |
RArray<TButtonData> iButtonData; |
|
326 |
||
327 |
/** |
|
328 |
* Array for the pointers to the current buttons in iButtonData. |
|
329 |
*/ |
|
330 |
RArray<TButtonData*> iCurrentButtonData; |
|
331 |
||
332 |
/** |
|
333 |
* Timer for generating keyRepeated events, owned. |
|
334 |
*/ |
|
335 |
CPeriodic* iRepeatTimer; |
|
336 |
||
337 |
/** |
|
338 |
* The Rocker key which is currently active. |
|
339 |
* E.g. keyRepeated events are being generated with iRepeatTimer. |
|
340 |
*/ |
|
341 |
TButtonData* iCurrentRockerKey; |
|
342 |
||
343 |
/** |
|
344 |
* The Other key which is currently active. |
|
345 |
* E.g. keyRepeated events are being generated with iRepeatTimer. |
|
346 |
*/ |
|
347 |
TButtonData* iCurrentOtherKey; |
|
348 |
||
349 |
/** |
|
350 |
* Indicates value of the application attribute |
|
351 |
* Nokia-MIDlet-S60-Selection-Key-Compatibility. |
|
352 |
*/ |
|
353 |
TBool iSelectionKeyCompatibility; |
|
354 |
/** |
|
355 |
* Variables for store counter of tap events |
|
356 |
*/ |
|
357 |
TInt iTapCnt; |
|
358 |
TInt iOldTapCnt; |
|
359 |
||
360 |
/** |
|
361 |
* Timer for counting tap events. |
|
362 |
*/ |
|
363 |
CPeriodic* iTapTimer; |
|
364 |
||
365 |
/** |
|
366 |
* Static callback function called on tap timer. |
|
367 |
*/ |
|
368 |
static TInt TapTimerCallbackL(TAny* aThis); |
|
369 |
||
370 |
/** |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
371 |
* Basic Background Control Context |
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
372 |
*/ |
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
373 |
MAknsControlContext* iBackgroundCC; |
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
374 |
|
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
375 |
/** |
66 | 376 |
* Tap counter with timer interval KTapTimerExpiryInterval |
377 |
*/ |
|
378 |
void HandleTapTimerEventL(); |
|
379 |
||
380 |
/** |
|
381 |
* Change the rocker key state, set skin |
|
382 |
* and refresh rocker keys area |
|
383 |
*/ |
|
384 |
void ChangeStatus(TInt aState, TButtonData* aButton); |
|
385 |
||
386 |
/** |
|
387 |
* Queue for last hitting keys. |
|
388 |
*/ |
|
389 |
RArray<TInt> iButtonStack; |
|
390 |
||
391 |
/** |
|
392 |
* Key was hit on the last is set to first in iButtonStack array. |
|
393 |
*/ |
|
394 |
void ButtonPriorityQueue(TInt aIdx); |
|
395 |
||
396 |
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
397 |
/** |
|
398 |
* Flag indicates if user dragged from one button to another |
|
399 |
*/ |
|
400 |
TBool iDragBetweenArrowKeys; |
|
401 |
||
402 |
/** |
|
403 |
* Flag indicates if user dragged outside of button area |
|
404 |
*/ |
|
405 |
TBool iDragOutsideArrowKeys; |
|
406 |
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
407 |
/** |
|
408 |
* Flag iOSKInBackground sets on true if OSK in background |
|
409 |
*/ |
|
410 |
TBool iOSKInBackground; |
|
411 |
||
412 |
/** |
|
413 |
* Structure for store key down event |
|
414 |
*/ |
|
415 |
TPointerEvent iStoreKeyDownEvent; |
|
416 |
}; |
|
417 |
||
418 |
#endif // CMIDCANVASKEYPAD_H |
|
419 |