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