|
1 /* |
|
2 * Copyright (c) 2005-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: Implementation for arabic peninput finger hwr |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PENINPUTFINGERHWRARSTATEMANAGER_H |
|
20 #define C_PENINPUTFINGERHWRARSTATEMANAGER_H |
|
21 |
|
22 //SYSTEM INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32cmn.h> |
|
25 |
|
26 //FORWARD CLASS |
|
27 class CPeninputFingerHwrArLayout; |
|
28 class CPeninputFingerHwrArDataStore; |
|
29 class CPeninputFingerHwrArStateManagerBase; |
|
30 class CPeninputFingerHwrArStateManager; |
|
31 |
|
32 |
|
33 /** |
|
34 * Class MPeninputFingerHwrArStateHandler |
|
35 * |
|
36 * The state handler interfaces |
|
37 * |
|
38 * @lib peninputFingerHwr.lib |
|
39 * @since S60 v5.0 |
|
40 */ |
|
41 class MPeninputFingerHwrArStateHandler |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * Handle state event |
|
46 * |
|
47 * @since Series 60 5.0 |
|
48 */ |
|
49 virtual void HandleEventL( const TInt aEventType, const TDesC& aEventData ) = 0; |
|
50 |
|
51 /** |
|
52 * Handle the state entering action |
|
53 * |
|
54 * @since Series 60 5.0 |
|
55 */ |
|
56 virtual void OnEntry() = 0; |
|
57 |
|
58 /** |
|
59 * Handle the state exiting action |
|
60 * |
|
61 * @since Series 60 5.0 |
|
62 */ |
|
63 virtual void OnExit() = 0; |
|
64 }; |
|
65 |
|
66 |
|
67 /** |
|
68 * The state handler base class. |
|
69 * |
|
70 * @since Series 60 5.0. |
|
71 */ |
|
72 class CPeninputFingerHwrArStateHandlerBase :public CBase |
|
73 ,public MPeninputFingerHwrArStateHandler |
|
74 { |
|
75 |
|
76 public: |
|
77 /** |
|
78 * The handler base destructor |
|
79 * |
|
80 * @since Series 60 5.0 |
|
81 */ |
|
82 virtual ~CPeninputFingerHwrArStateHandlerBase(); |
|
83 |
|
84 protected: |
|
85 /** |
|
86 * The constructor. |
|
87 * |
|
88 * @since Series 60 5.0 |
|
89 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
90 */ |
|
91 CPeninputFingerHwrArStateHandlerBase( CPeninputFingerHwrArStateManagerBase& aStateManager ); |
|
92 |
|
93 protected: |
|
94 /** |
|
95 * The reference to state manager. |
|
96 * |
|
97 * @since Series 60 5.0 |
|
98 */ |
|
99 CPeninputFingerHwrArStateManagerBase& iStateManager; |
|
100 |
|
101 /** |
|
102 * The data store reference |
|
103 * |
|
104 * @since Series 60 5.0 |
|
105 */ |
|
106 CPeninputFingerHwrArDataStore& iDataStore; |
|
107 }; |
|
108 |
|
109 |
|
110 |
|
111 /** |
|
112 * The finger hwr state manager base class. |
|
113 * |
|
114 * @since Series 60 5.0 |
|
115 */ |
|
116 class CPeninputFingerHwrArStateManagerBase : public CBase |
|
117 { |
|
118 public: |
|
119 enum TStateManagerState |
|
120 { |
|
121 EStateStandBy = 0 |
|
122 }; |
|
123 public: |
|
124 /** |
|
125 * The destructor |
|
126 * |
|
127 *@since Series 60 5.0 |
|
128 */ |
|
129 virtual ~CPeninputFingerHwrArStateManagerBase(); |
|
130 |
|
131 public: |
|
132 /** |
|
133 * Handle the hwr box and canidate events |
|
134 * |
|
135 * @since Series 60 5.0 |
|
136 * @param aEventType The event type |
|
137 * @param aEventData The event data |
|
138 */ |
|
139 virtual void HandleEventL( const TInt aEventType, const TDesC& aEventData ); |
|
140 |
|
141 /** |
|
142 * Return the layout reference |
|
143 * |
|
144 * @since Series 60 5.0 |
|
145 * CPeninputFingerHwrArLayout& The hwr layout reference |
|
146 */ |
|
147 CPeninputFingerHwrArLayout& HwrLayout(); |
|
148 |
|
149 /** |
|
150 * Is stanby state |
|
151 * |
|
152 * @since Series 60 5.0 |
|
153 * TBool The standby state flag |
|
154 */ |
|
155 TBool IsStandbyState(); |
|
156 |
|
157 /** |
|
158 * Set current state. |
|
159 * |
|
160 * @since Series 60 5.0 |
|
161 * @param aState The state to be set. @See TPeninputFingerHwrState. |
|
162 */ |
|
163 virtual void SetState( TInt aState ); |
|
164 |
|
165 |
|
166 protected: |
|
167 /** |
|
168 * 2nd phase constructor. |
|
169 * |
|
170 * @since Series 60 5.0 |
|
171 */ |
|
172 void BaseConstructL(); |
|
173 |
|
174 /** |
|
175 * The constructor. |
|
176 * |
|
177 * @since Series 60 5.0 |
|
178 * @param aLayout The full screen HWR layout pointer. |
|
179 */ |
|
180 CPeninputFingerHwrArStateManagerBase( CPeninputFingerHwrArLayout* aLayout ); |
|
181 |
|
182 /** |
|
183 * Pointer to the full screen hwr layout. |
|
184 * |
|
185 * Not own. |
|
186 */ |
|
187 CPeninputFingerHwrArLayout* iLayout; |
|
188 |
|
189 /** |
|
190 * The pointer to current state. |
|
191 * Own |
|
192 */ |
|
193 CPeninputFingerHwrArStateHandlerBase* iCurrentStateHandler; |
|
194 |
|
195 /** |
|
196 * The current state. |
|
197 * Own |
|
198 */ |
|
199 TInt iCurrentState; |
|
200 |
|
201 }; |
|
202 |
|
203 /** |
|
204 * The finger hwr state manager for arabic. |
|
205 * |
|
206 * @since Series 60 5.0 |
|
207 */ |
|
208 class CPeninputFingerHwrArStateManager : public CPeninputFingerHwrArStateManagerBase |
|
209 { |
|
210 public: |
|
211 /** |
|
212 * The factory function |
|
213 * |
|
214 * @since Series 60 5.0 |
|
215 * @param aLayout The layout reference |
|
216 * @return CPeninputFingerHwrArStateManager* The newly created CPeninputFingerHwrArStateManager object |
|
217 */ |
|
218 static CPeninputFingerHwrArStateManager* NewL( CPeninputFingerHwrArLayout* aLayout ); |
|
219 |
|
220 /** |
|
221 * The destructor |
|
222 * |
|
223 *@since Series 60 5.0 |
|
224 */ |
|
225 ~CPeninputFingerHwrArStateManager(); |
|
226 |
|
227 public: |
|
228 /** |
|
229 * The hwr states. |
|
230 * |
|
231 *@since Series 60 5.0 |
|
232 */ |
|
233 enum TPeninputFingerHwrArState |
|
234 { |
|
235 EPeninputFingerHwrArStateStandby = EStateStandBy, |
|
236 EPeninputFingerHwrArStateWriting, |
|
237 EPeninputFingerHwrArStateCandidateSelecting, |
|
238 EPeninputFingerHwrArStateCount |
|
239 }; |
|
240 |
|
241 public: |
|
242 /** |
|
243 * Handle the hwr box and canidate events |
|
244 * |
|
245 * @since Series 60 5.0 |
|
246 * @param aEventType The event type |
|
247 * @param aEventData The event data |
|
248 */ |
|
249 virtual void HandleEventL( const TInt aEventType, const TDesC& aEventData ); |
|
250 |
|
251 /** |
|
252 * Set current state. |
|
253 * |
|
254 * @since Series 60 5.0 |
|
255 * @param aState The state to be set. @See TPeninputFingerHwrState. |
|
256 */ |
|
257 virtual void SetState( TInt aState ); |
|
258 |
|
259 private: |
|
260 /** |
|
261 * The constructor. |
|
262 * |
|
263 * @since Series 60 5.0 |
|
264 * @param aLayout The full screen HWR layout pointer. |
|
265 */ |
|
266 CPeninputFingerHwrArStateManager( CPeninputFingerHwrArLayout* aLayout ); |
|
267 |
|
268 /** |
|
269 * 2nd phase constructor. |
|
270 * |
|
271 * @since Series 60 5.0 |
|
272 */ |
|
273 void ConstructL(); |
|
274 |
|
275 /** |
|
276 * Find the current state object. |
|
277 * |
|
278 * @since Series 60 5.0 |
|
279 * @param aState According to this state type, |
|
280 * we could find the corresponding state obect. |
|
281 */ |
|
282 CPeninputFingerHwrArStateHandlerBase* Find( TPeninputFingerHwrArState ); |
|
283 |
|
284 private: |
|
285 /** |
|
286 * Store all states pointers. |
|
287 * Own. |
|
288 */ |
|
289 CPeninputFingerHwrArStateHandlerBase* iStateHandlers[EPeninputFingerHwrArStateCount]; |
|
290 |
|
291 /** |
|
292 * Store all states' types. |
|
293 * Own |
|
294 */ |
|
295 TPeninputFingerHwrArState iStates[EPeninputFingerHwrArStateCount]; |
|
296 }; |
|
297 |
|
298 |
|
299 |
|
300 /** |
|
301 * The Standby state class. |
|
302 * |
|
303 * @since Series 60 5.0 |
|
304 */ |
|
305 class CPeninputFingerHwrArStateStandby : public CPeninputFingerHwrArStateHandlerBase |
|
306 { |
|
307 public: |
|
308 /** |
|
309 * Factory function |
|
310 * |
|
311 * @since Series 60 5.0 |
|
312 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
313 * @return CPeninputFingerHwrStateHandlerStandby* Return the |
|
314 CPeninputFingerHwrStateHandlerStandby object pointer. |
|
315 */ |
|
316 static CPeninputFingerHwrArStateStandby* NewL( |
|
317 CPeninputFingerHwrArStateManager& aStateManager ); |
|
318 public: |
|
319 |
|
320 /** |
|
321 * Handle state event |
|
322 * |
|
323 * @since Series 60 5.0 |
|
324 */ |
|
325 void HandleEventL( const TInt aEventType, const TDesC& aEventData ); |
|
326 |
|
327 /** |
|
328 * Handle the state entering action |
|
329 * |
|
330 * @since Series 60 5.0 |
|
331 */ |
|
332 void OnEntry(); |
|
333 |
|
334 /** |
|
335 * Handle the state exiting action |
|
336 * |
|
337 * @since Series 60 5.0 |
|
338 */ |
|
339 void OnExit(); |
|
340 |
|
341 private: |
|
342 /** |
|
343 * The constructor |
|
344 * |
|
345 * @since Series 60 5.0 |
|
346 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
347 */ |
|
348 CPeninputFingerHwrArStateStandby( |
|
349 CPeninputFingerHwrArStateManager& aStateManager ); |
|
350 |
|
351 }; |
|
352 |
|
353 |
|
354 /** |
|
355 * The Writing state class. |
|
356 * |
|
357 * @since Series 60 5.0 |
|
358 */ |
|
359 class CPeninputFingerHwrArStateWriting : public CPeninputFingerHwrArStateHandlerBase |
|
360 { |
|
361 public: |
|
362 /** |
|
363 * Factory function |
|
364 * |
|
365 * @since Series 60 5.0 |
|
366 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
367 * @return CPeninputFingerHwrStateHandlerWriting* Return the |
|
368 CPeninputFingerHwrStateHandlerWriting object pointer. |
|
369 */ |
|
370 static CPeninputFingerHwrArStateWriting* NewL( |
|
371 CPeninputFingerHwrArStateManager& aStateManager ); |
|
372 public: |
|
373 |
|
374 /** |
|
375 * Handle state event |
|
376 * |
|
377 * @since Series 60 5.0 |
|
378 */ |
|
379 void HandleEventL( const TInt aEventType, const TDesC& aEventData ); |
|
380 |
|
381 /** |
|
382 * Handle the state entering action |
|
383 * |
|
384 * @since Series 60 5.0 |
|
385 */ |
|
386 void OnEntry(); |
|
387 |
|
388 /** |
|
389 * Handle the state exiting action |
|
390 * |
|
391 * @since Series 60 5.0 |
|
392 */ |
|
393 void OnExit(); |
|
394 |
|
395 private: |
|
396 /** |
|
397 * The constructor |
|
398 * |
|
399 * @since Series 60 5.0 |
|
400 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
401 */ |
|
402 CPeninputFingerHwrArStateWriting( CPeninputFingerHwrArStateManager& aStateManager ); |
|
403 |
|
404 private: |
|
405 /** |
|
406 * Handle the end stroke event |
|
407 * |
|
408 * @since Series 60 5.0 |
|
409 * @param aEventData The trace data |
|
410 */ |
|
411 void OnEndStrokeL( const TDesC& aEventData ); |
|
412 |
|
413 /** |
|
414 * Handle the end writing event |
|
415 * |
|
416 * @since Series 60 5.0 |
|
417 * @param aEventData The trace data |
|
418 */ |
|
419 void OnEndWritingL( const TDesC& aEventData ); |
|
420 |
|
421 /** |
|
422 * Handle the candidate selection event |
|
423 * |
|
424 * @since Series 60 5.0 |
|
425 * @param aEventData The trace data |
|
426 */ |
|
427 void OnSelectedCandidatesL( const TDesC& aEventData ); |
|
428 |
|
429 }; |
|
430 |
|
431 /** |
|
432 * The CandidateSelecting state class for Chinese. |
|
433 * |
|
434 * @since Series 60 5.0 |
|
435 */ |
|
436 class CPeninputFingerHwrArStateCandidateSelecting : public CPeninputFingerHwrArStateHandlerBase |
|
437 { |
|
438 public: |
|
439 /** |
|
440 * Factory function |
|
441 * |
|
442 * @since Series 60 5.0 |
|
443 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
444 * @return CPeninputFingerHwrStateHandlerCandidateSelecting Return the |
|
445 CPeninputFingerHwrStateHandlerCandidateSelecting object pointer. |
|
446 */ |
|
447 static CPeninputFingerHwrArStateCandidateSelecting* NewL( |
|
448 CPeninputFingerHwrArStateManager& aStateManager ); |
|
449 public: |
|
450 |
|
451 /** |
|
452 * Handle state event |
|
453 * |
|
454 * @since Series 60 5.0 |
|
455 */ |
|
456 void HandleEventL( const TInt aEventType, const TDesC& aEventData ); |
|
457 |
|
458 /** |
|
459 * Handle the state entering action |
|
460 * |
|
461 * @since Series 60 5.0 |
|
462 */ |
|
463 void OnEntry(); |
|
464 |
|
465 /** |
|
466 * Handle the state exiting action |
|
467 * |
|
468 * @since Series 60 5.0 |
|
469 */ |
|
470 void OnExit(); |
|
471 |
|
472 private: |
|
473 /** |
|
474 * The constructor |
|
475 * |
|
476 * @since Series 60 5.0 |
|
477 * @param aStateManager The reference to state manager. @see CPeninputFingerHwrStateManager. |
|
478 */ |
|
479 CPeninputFingerHwrArStateCandidateSelecting( |
|
480 CPeninputFingerHwrArStateManager& aStateManager ); |
|
481 |
|
482 private: |
|
483 /** |
|
484 * Handle one candiate selected event |
|
485 * |
|
486 * @since Series 60 5.0 |
|
487 * @param aEventData The selected candidate |
|
488 */ |
|
489 void OnSelectedCandidatesL( const TDesC& aEventData ); |
|
490 |
|
491 |
|
492 /** |
|
493 * Handle backspace events |
|
494 * |
|
495 * @since Series 60 5.0 |
|
496 */ |
|
497 void OnClickBackSpaceL(); |
|
498 }; |
|
499 |
|
500 |
|
501 |
|
502 #endif //C_PENINPUTFINGERHWRARSTATEMANAGER_H |