|
1 /* |
|
2 * Copyright (c) 2002-2005 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: L&F data manager |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_PENINPUTSPLITQWERTYLAFDATAMGR_H |
|
19 #define C_PENINPUTSPLITQWERTYLAFDATAMGR_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 #include <AknFepGlobalEnums.h> |
|
25 |
|
26 // User includes |
|
27 |
|
28 // Forward decalaration |
|
29 |
|
30 /** |
|
31 * laf type definition |
|
32 */ |
|
33 enum TPeninputQwtLayoutType |
|
34 { |
|
35 ELayoutNone = -1, |
|
36 ELayout10x3, |
|
37 ELayout11x3, |
|
38 ELayout11x4 |
|
39 }; |
|
40 |
|
41 /** |
|
42 * laf option definition |
|
43 */ |
|
44 enum TPeninputVkbLafOption |
|
45 { |
|
46 EOptionNone, |
|
47 EOption3CellRange = 0x0001, |
|
48 EOptionWithSmily = 0x0002 |
|
49 }; |
|
50 |
|
51 /** |
|
52 * button data |
|
53 */ |
|
54 struct TPeninputButtonLayoutData |
|
55 { |
|
56 TRect iRect; |
|
57 TRect iInnerRect; |
|
58 }; |
|
59 |
|
60 /** |
|
61 * 3-pieces icon data |
|
62 */ |
|
63 struct TPeninputButtonLayoutDataEx |
|
64 { |
|
65 TRect iIconsFrameRect; // The frame rect contains all the icons |
|
66 TRect iMiddleIconRect; // Middle icon rect |
|
67 }; |
|
68 |
|
69 /** |
|
70 * virtual keypad data |
|
71 */ |
|
72 struct TPeninputKeyLayoutData |
|
73 { |
|
74 TRect iKaypadRect; |
|
75 RArray<TRect> iRects; |
|
76 RArray<TRect> iCharRects; |
|
77 TAknTextLineLayout iTextLayout; |
|
78 const CFont* iFont; |
|
79 }; |
|
80 |
|
81 |
|
82 /** |
|
83 * class CPeninputQwtLayoutDataInfo |
|
84 * |
|
85 * @lib peninputsplitqwerty.lib |
|
86 * @since S60 v5.0 |
|
87 */ |
|
88 |
|
89 class CPeninputQwtLayoutDataInfo : public CBase |
|
90 { |
|
91 public: |
|
92 virtual ~CPeninputQwtLayoutDataInfo(); |
|
93 |
|
94 public: |
|
95 TPeninputButtonLayoutData iCloseButton; |
|
96 TPeninputButtonLayoutData iOptionButton; |
|
97 TPeninputButtonLayoutData iMoveButton; |
|
98 TPeninputButtonLayoutData iLeftButton; |
|
99 TPeninputButtonLayoutData iRightButton; |
|
100 TPeninputButtonLayoutData iClearButton; |
|
101 TPeninputKeyLayoutData iKeypad; |
|
102 TPeninputButtonLayoutData iShiftButton; |
|
103 TPeninputButtonLayoutData iSmillyButton; |
|
104 TPeninputButtonLayoutData iSpaceButton; |
|
105 TPeninputButtonLayoutDataEx iSpaceButtonEx; |
|
106 TPeninputButtonLayoutData iEnterButton; |
|
107 TPeninputButtonLayoutData iRangeButton; |
|
108 TRect iTitlebarRect; |
|
109 TRect iClientRect; |
|
110 TRect iQwtRect; |
|
111 TRect iPreviewWndRect; |
|
112 TRect iPreviewWndInnerRect; |
|
113 TAknTextLineLayout iPreviewWndText; |
|
114 }; |
|
115 |
|
116 /** |
|
117 * interface MPeninputLafDataBase |
|
118 * |
|
119 * @lib peninputsplitqwerty.lib |
|
120 * @since S60 v5.0 |
|
121 */ |
|
122 |
|
123 class MPeninputLafDataBase |
|
124 { |
|
125 public: |
|
126 /** |
|
127 * retrieve laf data of a button specified by aButtonID |
|
128 * |
|
129 * @since S60 v5.0 |
|
130 * @param aButtonID id of button control |
|
131 * @return ref to laf data object |
|
132 */ |
|
133 virtual const TPeninputButtonLayoutData& ButtonLayoutData( |
|
134 TInt aButtonID ) const = 0; |
|
135 |
|
136 /** |
|
137 * Retrieve laf data of keypad |
|
138 * |
|
139 * @since S60 v5.0 |
|
140 * @return ref to laf data object |
|
141 */ |
|
142 virtual const TPeninputKeyLayoutData& KeypadLayoutData() const = 0; |
|
143 |
|
144 /** |
|
145 * Retrieve laf data of qwerty layout |
|
146 * |
|
147 * @since S60 v5.0 |
|
148 * @return ref to laf data object |
|
149 */ |
|
150 virtual const CPeninputQwtLayoutDataInfo& QwtLayoutData() const = 0; |
|
151 |
|
152 /** |
|
153 * Set layout type |
|
154 * |
|
155 * @since S60 v5.0 |
|
156 * @param aLayoutType layout type |
|
157 * @return none |
|
158 */ |
|
159 virtual void SetLayoutType( TInt aLayoutType ) = 0; |
|
160 |
|
161 /** |
|
162 * Get current layout type |
|
163 * |
|
164 * @since S60 v5.0 |
|
165 * @return layout type |
|
166 */ |
|
167 virtual TInt LayoutType() const = 0; |
|
168 |
|
169 }; |
|
170 |
|
171 /** |
|
172 * interface MPeninputLafDataCommon |
|
173 * |
|
174 * @lib peninputsplitqwerty.lib |
|
175 * @since S60 v5.0 |
|
176 */ |
|
177 class MPeninputLafDataCommon : public MPeninputLafDataBase |
|
178 { |
|
179 public: |
|
180 /** |
|
181 * C++ destructor. |
|
182 * |
|
183 * @since S60 v5.0 |
|
184 * @return None |
|
185 */ |
|
186 virtual ~MPeninputLafDataCommon(); |
|
187 |
|
188 /** |
|
189 * Release laf data |
|
190 * |
|
191 * @since S60 v5.0 |
|
192 * @return none |
|
193 */ |
|
194 void DestoryDataCommon(); |
|
195 |
|
196 /** |
|
197 * Symbian constructor |
|
198 * |
|
199 * @since S60 v5.0 |
|
200 * @return None |
|
201 */ |
|
202 void ConstructL(); |
|
203 |
|
204 public: // From base MPeninputLafDataBase |
|
205 |
|
206 /** |
|
207 * From MPeninputLafDataBase |
|
208 * Retrieve laf data of a button specified by aButtonID |
|
209 * |
|
210 * @since S60 v5.0 |
|
211 * @param aButtonID id of button control |
|
212 * @return ref to laf data object |
|
213 */ |
|
214 const TPeninputButtonLayoutData& ButtonLayoutData( TInt aButtonID ) const; |
|
215 |
|
216 /** |
|
217 * From MPeninputLafDataBase |
|
218 * Retrieve laf data of keypad |
|
219 * |
|
220 * @since S60 v5.0 |
|
221 * @return ref to laf data object |
|
222 */ |
|
223 const TPeninputKeyLayoutData& KeypadLayoutData() const; |
|
224 |
|
225 /** |
|
226 * From MPeninputLafDataBase |
|
227 * Retrieve laf data of qwerty layout |
|
228 * |
|
229 * @since S60 v5.0 |
|
230 * @return ref to laf data object |
|
231 */ |
|
232 const CPeninputQwtLayoutDataInfo& QwtLayoutData() const; |
|
233 |
|
234 /** |
|
235 * From MPeninputLafDataBase |
|
236 * Set layout type |
|
237 * |
|
238 * @since S60 v5.0 |
|
239 * @param aLayoutType layout type |
|
240 * @return none |
|
241 */ |
|
242 void SetLayoutType( TInt aLayoutType ); |
|
243 |
|
244 /** |
|
245 * From MPeninputLafDataBase |
|
246 * Get current layout type |
|
247 * |
|
248 * @since S60 v5.0 |
|
249 * @return layout type |
|
250 */ |
|
251 TInt LayoutType() const; |
|
252 |
|
253 public: |
|
254 /** |
|
255 * Set laf option |
|
256 * |
|
257 * @since S60 v5.0 |
|
258 * @param aLafOption laf option |
|
259 * @return none |
|
260 */ |
|
261 void SetLafOption( TPeninputVkbLafOption aLafOption ); |
|
262 |
|
263 /** |
|
264 * Get current laf option |
|
265 * |
|
266 * @since S60 v5.0 |
|
267 * @return laf option |
|
268 */ |
|
269 TPeninputVkbLafOption LafOption() const; |
|
270 |
|
271 /** |
|
272 * Check whether laf data is valid or not |
|
273 * |
|
274 * @since S60 v5.0 |
|
275 * @return ETrue if laf data is valid |
|
276 */ |
|
277 TBool IsValid() const; |
|
278 |
|
279 protected: |
|
280 |
|
281 /** |
|
282 * Read laf data |
|
283 * |
|
284 * @since S60 v5.0 |
|
285 * @return none |
|
286 */ |
|
287 virtual void ReadLafInfoL() = 0; |
|
288 |
|
289 protected: |
|
290 /** |
|
291 * Layout type |
|
292 */ |
|
293 TInt iLayoutType; |
|
294 |
|
295 /** |
|
296 * Laf option |
|
297 */ |
|
298 TPeninputVkbLafOption iLafOption; |
|
299 |
|
300 /** |
|
301 * Laf datas |
|
302 */ |
|
303 RPointerArray<CPeninputQwtLayoutDataInfo> iLayoutDataInfo; |
|
304 }; |
|
305 |
|
306 /** |
|
307 * class CPeninputLafDataFSQ |
|
308 * |
|
309 * @lib peninputsplitqwerty.lib |
|
310 * @since S60 v5.0 |
|
311 */ |
|
312 class CPeninputLafDataFSQ : public CBase, public MPeninputLafDataCommon |
|
313 { |
|
314 public: |
|
315 /** |
|
316 * Symbian constructor |
|
317 * |
|
318 * @since S60 v5.0 |
|
319 * @param aLayoutType layout type |
|
320 * @return The pointer to created object |
|
321 */ |
|
322 static CPeninputLafDataFSQ* NewL( TInt aLayoutType ); |
|
323 |
|
324 /** |
|
325 * Symbian constructor |
|
326 * |
|
327 * @since S60 v5.0 |
|
328 * @param aLayoutType layout type |
|
329 * @return The pointer to created object |
|
330 */ |
|
331 static CPeninputLafDataFSQ* NewLC( TInt aLayoutType ); |
|
332 |
|
333 /** |
|
334 * C++ destructor |
|
335 * |
|
336 * @since S60 v5.0 |
|
337 * @return None |
|
338 */ |
|
339 virtual ~CPeninputLafDataFSQ(); |
|
340 |
|
341 protected: //from base MPeninputLafDataCommon |
|
342 |
|
343 /** |
|
344 * From MPeninputLafDataCommon |
|
345 * Read all laf data |
|
346 * |
|
347 * @since S60 v5.0 |
|
348 * @return none |
|
349 */ |
|
350 void ReadLafInfoL(); |
|
351 |
|
352 protected: |
|
353 /** |
|
354 * C++ constructor |
|
355 * |
|
356 * @since S60 v5.0 |
|
357 * @param aContext The layout context |
|
358 * @return None |
|
359 */ |
|
360 CPeninputLafDataFSQ( TInt aLayoutType ); |
|
361 |
|
362 private: |
|
363 /** |
|
364 * Read laf data |
|
365 * |
|
366 * @since S60 v5.0 |
|
367 * @param aLayoutType layout type |
|
368 * @param aRows row count of keypad |
|
369 * @param aCols column count leypad |
|
370 * @return pointer to created laf data object |
|
371 */ |
|
372 CPeninputQwtLayoutDataInfo* ReadLC( const TInt aLayoutType, |
|
373 const TInt aRows, |
|
374 const TInt aCols ); |
|
375 |
|
376 /** |
|
377 * Utils to calculate relative rect base on given point |
|
378 * |
|
379 * @since S60 v5.0 |
|
380 * @param aRect source rect |
|
381 * @param aPoint base point |
|
382 * @return result rect |
|
383 */ |
|
384 TRect RelativeRect(const TRect& aRect, const TPoint& aPoint ); |
|
385 |
|
386 /** |
|
387 * Utils to offset rect |
|
388 * |
|
389 * @since S60 v5.0 |
|
390 * @param aRect source rect |
|
391 * @param aDx x offset |
|
392 * @param aDy y offset |
|
393 * @return result rect |
|
394 */ |
|
395 TRect OffsetRect(const TRect& aRect, TInt aDx, TInt aDy ); |
|
396 |
|
397 }; |
|
398 |
|
399 |
|
400 /** |
|
401 * Peninput VKB data management class |
|
402 * This class manager the data of VKB |
|
403 * |
|
404 * @lib peninputsplitqwerty.lib |
|
405 * @since S60 v5.0 |
|
406 */ |
|
407 class CPeninputSplitQwertyLafMgr : public CBase |
|
408 { |
|
409 |
|
410 public: |
|
411 /** |
|
412 * Symbian constructor |
|
413 * |
|
414 * @since S60 v5.0 |
|
415 * @return The pointer to created object |
|
416 */ |
|
417 static CPeninputSplitQwertyLafMgr* NewL(); |
|
418 |
|
419 /** |
|
420 * Symbian constructor |
|
421 * |
|
422 * @since S60 v5.0 |
|
423 * @return The pointer to created object |
|
424 */ |
|
425 static CPeninputSplitQwertyLafMgr* NewLC(); |
|
426 |
|
427 /** |
|
428 * C++ destructor |
|
429 * |
|
430 * @since S60 v5.0 |
|
431 * @return None |
|
432 */ |
|
433 virtual ~CPeninputSplitQwertyLafMgr(); |
|
434 |
|
435 public: |
|
436 /** |
|
437 * Set input mode and reload laf |
|
438 * |
|
439 * @since S60 v5.0 |
|
440 * @param aInputMode input mode |
|
441 * @return None |
|
442 */ |
|
443 void SetInputModeL( TPluginInputMode aInputMode ); |
|
444 |
|
445 /** |
|
446 * Get current input mode |
|
447 * |
|
448 * @since S60 v5.0 |
|
449 * @return Input mode |
|
450 */ |
|
451 TPluginInputMode InputMode() const; |
|
452 |
|
453 /** |
|
454 * Set layout type |
|
455 * |
|
456 * @since S60 v5.0 |
|
457 * @param aLayoutType Layout type index |
|
458 * @return None |
|
459 */ |
|
460 void SetLayoutType( TPeninputQwtLayoutType aLayoutType ); |
|
461 |
|
462 /** |
|
463 * Get layout type by row and column count |
|
464 * |
|
465 * @since S60 v5.0 |
|
466 * @return layout type |
|
467 */ |
|
468 TPeninputQwtLayoutType LayoutTypeFromRowsColumns( const TInt aRows, |
|
469 const TInt aColumns ); |
|
470 |
|
471 /** |
|
472 * Set option ( and reload laf ) |
|
473 * |
|
474 * @since S60 v5.0 |
|
475 * @param aOption option type |
|
476 * @return None |
|
477 */ |
|
478 void SetLafOption( TPeninputVkbLafOption aOption ); |
|
479 |
|
480 /** |
|
481 * Get current option |
|
482 * |
|
483 * @since S60 v5.0 |
|
484 * @return option |
|
485 */ |
|
486 TPeninputVkbLafOption OptionType() const; |
|
487 |
|
488 /** |
|
489 * Check whether laf data is valid or not |
|
490 * |
|
491 * @since S60 v5.0 |
|
492 * @return if laf data is valid |
|
493 */ |
|
494 TBool IsValid(); |
|
495 |
|
496 /** |
|
497 * Reload laf data |
|
498 * |
|
499 * @since S60 v5.0 |
|
500 * @return None |
|
501 */ |
|
502 void UpdateLafDataL(); |
|
503 |
|
504 /** |
|
505 * Get rect of entire ui, screen coord-sys |
|
506 * |
|
507 * @since S60 v5.0 |
|
508 * @return rect of ui |
|
509 */ |
|
510 const TRect& EntirePaneRect() const; |
|
511 |
|
512 /** |
|
513 * Get rect of entire ui, client coord-sys |
|
514 * |
|
515 * @since S60 v5.0 |
|
516 * @return rect of client |
|
517 */ |
|
518 const TRect& ClientRect() const; |
|
519 |
|
520 /** |
|
521 * |
|
522 * Get rect of button ctrl |
|
523 * |
|
524 * @since S60 v5.0 |
|
525 * @param aButtonID button id |
|
526 * @param aOutterRect button rect |
|
527 * @param aInnerRect button forground rect |
|
528 * @return None |
|
529 */ |
|
530 void GetButtonRect( TPeninputCommonCtrlID aButtonID, TRect& aOutterRect, |
|
531 TRect& aInnerRect ); |
|
532 |
|
533 /** |
|
534 * Get rect of virtual keypad ctrl |
|
535 * |
|
536 * @since S60 v5.0 |
|
537 * @return rect of keypad |
|
538 */ |
|
539 const TRect& KeypadRect() const; |
|
540 |
|
541 /** |
|
542 * Get rect of virtual key ctrl |
|
543 * |
|
544 * @since S60 v5.0 |
|
545 * @param aCol the colume index of the key |
|
546 * @param aRow the row index of the key |
|
547 * @return Key rect |
|
548 */ |
|
549 void GetKeyRect( TInt aCol, TInt aRow, TRect& aKeyRect, TRect& aCharRect ) const; |
|
550 |
|
551 /** |
|
552 * Get text font of virtual keypad ctrl |
|
553 * |
|
554 * @since S60 v5.0 |
|
555 * @return none |
|
556 */ |
|
557 const CFont* KeyTextFont() const; |
|
558 |
|
559 /** |
|
560 * Get text layout of virtual keypad ctrl |
|
561 * |
|
562 * @since S60 v5.0 |
|
563 * @return text layout |
|
564 */ |
|
565 TAknTextLineLayout KeyTextLayout() const; |
|
566 |
|
567 /** |
|
568 * Get rect of preview bubble ctrl |
|
569 * |
|
570 * @since S60 v5.0 |
|
571 * @return none |
|
572 */ |
|
573 void GetPreviewWndRect( TRect& aOutRect, TRect& aInnerRect ) const; |
|
574 |
|
575 /** |
|
576 * Get text layout of preview bubble |
|
577 * |
|
578 * @since S60 v5.0 |
|
579 * @return text layout of preview bubble |
|
580 */ |
|
581 TAknTextLineLayout PreviewWndText() const; |
|
582 |
|
583 /** |
|
584 * Get 3-pieces info of space button |
|
585 * |
|
586 * @since S60 v5.0 |
|
587 * @return none |
|
588 */ |
|
589 void GetSpaceButtonExLayoutInfo( TRect& aIconsFrameRect, |
|
590 TRect& aMiddleIconRect ) const; |
|
591 |
|
592 private: |
|
593 |
|
594 /** |
|
595 * C++ constructor |
|
596 * |
|
597 * @since S60 v5.0 |
|
598 * @return None |
|
599 */ |
|
600 CPeninputSplitQwertyLafMgr(); |
|
601 |
|
602 /** |
|
603 * Symbian Constructor |
|
604 * |
|
605 * @since S60 v5.0 |
|
606 * @return None |
|
607 */ |
|
608 void ConstructL(); |
|
609 |
|
610 private: |
|
611 /** |
|
612 * Laf data |
|
613 * Own |
|
614 */ |
|
615 MPeninputLafDataCommon* iLafData; |
|
616 |
|
617 /** |
|
618 * Current input mode |
|
619 */ |
|
620 TPluginInputMode iInputMode; |
|
621 }; |
|
622 |
|
623 #endif // C_PENINPUTSPLITQWERTYLAFDATAMGR_H |