|
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: peninput VKB data manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <peninputdataconverter.h> |
|
21 #include <peninputcommonlayoutglobalenum.h> |
|
22 #include <aknutils.h> |
|
23 #include <AknLayoutScalable_Avkon.cdl.h> |
|
24 #include <peninputpluginutils.h> |
|
25 #include <aknlayoutscalable_apps.cdl.h> |
|
26 #include <layoutmetaData.cdl.h> |
|
27 |
|
28 // User includes |
|
29 #include "peninputsplitqwertylafdatamgr.h" |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // C++ destructor |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CPeninputQwtLayoutDataInfo::~CPeninputQwtLayoutDataInfo() |
|
36 { |
|
37 iKeypad.iRects.Close(); |
|
38 iKeypad.iCharRects.Close(); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // C++ destructor |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 MPeninputLafDataCommon::~MPeninputLafDataCommon() |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // Release laf data |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void MPeninputLafDataCommon::DestoryDataCommon() |
|
54 { |
|
55 iLayoutDataInfo.ResetAndDestroy(); |
|
56 iLayoutDataInfo.Close(); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // Symbian constructor |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 void MPeninputLafDataCommon::ConstructL() |
|
64 { |
|
65 ReadLafInfoL(); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // Retrieve laf data of button specified by aButtonID |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 const TPeninputButtonLayoutData& MPeninputLafDataCommon::ButtonLayoutData( |
|
73 TInt aButtonID ) const |
|
74 { |
|
75 ASSERT( IsValid() ); |
|
76 const TPeninputButtonLayoutData* pData = NULL; |
|
77 |
|
78 switch ( aButtonID ) |
|
79 { |
|
80 case EPeninutWindowCtrlIdMoveBtn: |
|
81 { |
|
82 pData = &(iLayoutDataInfo[iLayoutType]->iMoveButton); |
|
83 } |
|
84 break; |
|
85 case EPeninutWindowCtrlIdCloseBtn: |
|
86 { |
|
87 pData = &(iLayoutDataInfo[iLayoutType]->iCloseButton); |
|
88 } |
|
89 break; |
|
90 case EPeninutWindowCtrlIdOptionBtn: |
|
91 { |
|
92 pData = &(iLayoutDataInfo[iLayoutType]->iOptionButton); |
|
93 } |
|
94 break; |
|
95 case EPeninutWindowCtrlIdBackspaceBtn: |
|
96 { |
|
97 pData = &(iLayoutDataInfo[iLayoutType]->iClearButton); |
|
98 } |
|
99 break; |
|
100 case EPeninutWindowCtrlIdEnterBtn: |
|
101 { |
|
102 pData = &(iLayoutDataInfo[iLayoutType]->iEnterButton); |
|
103 } |
|
104 break; |
|
105 case EPeninutWindowCtrlIdSpaceBtn: |
|
106 { |
|
107 pData = &(iLayoutDataInfo[iLayoutType]->iSpaceButton); |
|
108 } |
|
109 break; |
|
110 case EPeninutWindowCtrlIdShiftBtn: |
|
111 { |
|
112 pData = &(iLayoutDataInfo[iLayoutType]->iShiftButton); |
|
113 } |
|
114 break; |
|
115 case EPeninupWindowCtrlIdArrowLeftBtn: |
|
116 { |
|
117 pData = &(iLayoutDataInfo[iLayoutType]->iLeftButton); |
|
118 } |
|
119 break; |
|
120 case EPeninupWindowCtrlIdArrowRightBtn: |
|
121 { |
|
122 pData = &(iLayoutDataInfo[iLayoutType]->iRightButton); |
|
123 } |
|
124 break; |
|
125 |
|
126 case EPeninutWindowCtrlIdRangeBtn: |
|
127 { |
|
128 pData = &(iLayoutDataInfo[iLayoutType]->iRangeButton); |
|
129 } |
|
130 break; |
|
131 default: |
|
132 ASSERT( EFalse ); |
|
133 break; |
|
134 } |
|
135 ASSERT( pData ); |
|
136 return *pData; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Retrieve laf data of keypad |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 const TPeninputKeyLayoutData& MPeninputLafDataCommon::KeypadLayoutData() const |
|
144 { |
|
145 ASSERT( IsValid() ); |
|
146 return iLayoutDataInfo[iLayoutType]->iKeypad; |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // Retrieve laf data of qwerty layout |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 const CPeninputQwtLayoutDataInfo& MPeninputLafDataCommon::QwtLayoutData() const |
|
154 { |
|
155 ASSERT( IsValid() ); |
|
156 return *iLayoutDataInfo[iLayoutType]; |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // Set layout type |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 void MPeninputLafDataCommon::SetLayoutType( TInt aLayoutType ) |
|
164 { |
|
165 iLayoutType = aLayoutType; |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // Get current layout type |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 TInt MPeninputLafDataCommon::LayoutType() const |
|
173 { |
|
174 return iLayoutType; |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // Set laf option) |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 void MPeninputLafDataCommon::SetLafOption( TPeninputVkbLafOption aLafOption ) |
|
182 { |
|
183 iLafOption = aLafOption; |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // Get current laf option |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 TPeninputVkbLafOption MPeninputLafDataCommon::LafOption() const |
|
191 { |
|
192 return iLafOption; |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // Check whether laf data is valid or not |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 TBool MPeninputLafDataCommon::IsValid() const |
|
200 { |
|
201 return ( iLayoutDataInfo.Count() && iLayoutType != ELayoutNone ) ? ETrue : EFalse; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // Symbian constructor |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 CPeninputLafDataFSQ* CPeninputLafDataFSQ::NewL( TInt aLayoutType ) |
|
209 { |
|
210 CPeninputLafDataFSQ* self = NewLC( aLayoutType ); |
|
211 CleanupStack::Pop(); |
|
212 return self; |
|
213 } |
|
214 // --------------------------------------------------------------------------- |
|
215 // Symbian constructor |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 CPeninputLafDataFSQ* CPeninputLafDataFSQ::NewLC( TInt aLayoutType ) |
|
219 { |
|
220 CPeninputLafDataFSQ* self = new( ELeave ) CPeninputLafDataFSQ( aLayoutType ); |
|
221 CleanupStack::PushL( self ); |
|
222 self->ConstructL(); |
|
223 |
|
224 return self; |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // C++ destructor |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 CPeninputLafDataFSQ::~CPeninputLafDataFSQ() |
|
232 { |
|
233 DestoryDataCommon(); |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------------------------- |
|
237 // Read all laf data |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 void CPeninputLafDataFSQ::ReadLafInfoL() |
|
241 { |
|
242 // clean up all the data |
|
243 iLayoutDataInfo.ResetAndDestroy(); |
|
244 |
|
245 CPeninputQwtLayoutDataInfo* info = NULL; |
|
246 |
|
247 //ELayout10x3 |
|
248 info = ReadLC( ELayout10x3, 3, 10 ); |
|
249 iLayoutDataInfo.AppendL( info ); |
|
250 CleanupStack::Pop( info ); |
|
251 |
|
252 //ELayout11x3 |
|
253 info = ReadLC( ELayout11x3, 3, 11 ); |
|
254 iLayoutDataInfo.AppendL( info ); |
|
255 CleanupStack::Pop( info ); |
|
256 |
|
257 //ELayout11x4 |
|
258 info = ReadLC( ELayout11x4, 4, 11 ); |
|
259 iLayoutDataInfo.AppendL( info ); |
|
260 CleanupStack::Pop( info ); |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // C++ constructor |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 CPeninputLafDataFSQ::CPeninputLafDataFSQ( TInt aLayoutType ) |
|
268 { |
|
269 SetLayoutType( aLayoutType ); |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------------------------- |
|
273 // Read laf data |
|
274 // --------------------------------------------------------------------------- |
|
275 // |
|
276 CPeninputQwtLayoutDataInfo* CPeninputLafDataFSQ::ReadLC( const TInt aLayoutType, |
|
277 const TInt aRows, |
|
278 const TInt aCols ) |
|
279 { |
|
280 //variety v1, value 0/1 = 10cols/11cols, applay to: |
|
281 // grid_vkbss_keypad_pane |
|
282 // aid_vkbss_key_offset |
|
283 TInt v1 = ( aCols == 10 ) ? 0 : 1; |
|
284 |
|
285 //variety v2, value 0/1/2/3 = 10x3/10x4/11x3/11x4, applay to: |
|
286 // cell_vkbss_key_pane |
|
287 // bg_cell_vkbss_key_g1 |
|
288 // cell_vkbss_key_t1 |
|
289 // cell_vkbss_key_g1 |
|
290 // cell_vkbss_key_3p_pane |
|
291 TInt v2 = 0; |
|
292 switch ( aLayoutType ) |
|
293 { |
|
294 case ELayout10x3: v2 = 0; break; |
|
295 case ELayout11x3: v2 = 2; break; |
|
296 case ELayout11x4: v2 = 3; break; |
|
297 default: v2 = 0; |
|
298 } |
|
299 |
|
300 CPeninputQwtLayoutDataInfo* data = new( ELeave ) CPeninputQwtLayoutDataInfo; |
|
301 CleanupStack::PushL( data ); |
|
302 |
|
303 TAknWindowLineLayout linelayout; |
|
304 TAknLayoutRect layoutrect; |
|
305 |
|
306 TAknLayoutRect keypadRect, keypaneRect, keycellRect, keylabelRect; |
|
307 TAknLayoutRect pic3paneRect; |
|
308 |
|
309 TAknTextLineLayout keyText; |
|
310 |
|
311 TRect rectAppWin, rectMainWin; |
|
312 TPoint base; |
|
313 TInt pic3pLeftWidth, pic3pRightWidth; |
|
314 |
|
315 linelayout = AknLayoutScalable_Avkon::application_window(0).LayoutLine(); |
|
316 rectAppWin = linelayout.Rect(); |
|
317 |
|
318 linelayout = AknLayoutScalable_Avkon::popup_fep_vkbss_window(0).LayoutLine(); |
|
319 layoutrect.LayoutRect( rectAppWin, linelayout ); |
|
320 rectMainWin = layoutrect.Rect(); |
|
321 |
|
322 linelayout = AknLayoutScalable_Avkon::grid_vkbss_keypad_pane(v1).LayoutLine(); |
|
323 keypadRect.LayoutRect( rectMainWin, linelayout ); |
|
324 |
|
325 linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_pane(v2).LayoutLine(); |
|
326 keypaneRect.LayoutRect( keypadRect.Rect(), linelayout ); |
|
327 |
|
328 linelayout = AknLayoutScalable_Avkon::bg_cell_vkbss_key_g1(v2).LayoutLine(); |
|
329 keycellRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
330 |
|
331 keyText = AknLayoutScalable_Avkon::cell_vkbss_key_t1(v2).LayoutLine(); |
|
332 keyText.iB += 3; //todo split-view, temp solution |
|
333 |
|
334 linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_g1(v2).LayoutLine(); |
|
335 keylabelRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
336 |
|
337 linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane(v2).LayoutLine(); |
|
338 pic3paneRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
339 |
|
340 linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane_g1(0).LayoutLine(); |
|
341 layoutrect.LayoutRect( pic3paneRect.Rect(), linelayout ); |
|
342 pic3pLeftWidth = layoutrect.Rect().Width(); |
|
343 |
|
344 linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane_g3(0).LayoutLine(); |
|
345 layoutrect.LayoutRect( pic3paneRect.Rect(), linelayout ); |
|
346 pic3pRightWidth = layoutrect.Rect().Width(); |
|
347 |
|
348 linelayout = AknLayoutScalable_Avkon::aid_vkbss_key_offset(v1).LayoutLine(); |
|
349 layoutrect.LayoutRect( keypadRect.Rect(), linelayout ); |
|
350 TInt rowIndentWidth = layoutrect.Rect().Width(); |
|
351 |
|
352 base = rectMainWin.iTl; |
|
353 |
|
354 data->iClientRect = RelativeRect( rectMainWin, base ); |
|
355 data->iQwtRect = rectMainWin; //screen coord-sys ? |
|
356 |
|
357 TRect rectOfKeypad = RelativeRect( keypadRect.Rect(), base ); |
|
358 TRect rectOfButtons = rectOfKeypad; |
|
359 rectOfKeypad.iBr.iY -= keypaneRect.Rect().Height(); |
|
360 rectOfButtons.iTl.iY += rectOfKeypad.Height(); |
|
361 |
|
362 //keypad |
|
363 data->iKeypad.iKaypadRect = rectOfKeypad; |
|
364 data->iKeypad.iTextLayout = keyText; |
|
365 data->iKeypad.iFont = AknLayoutUtils::FontFromId( keyText.iFont, NULL ); |
|
366 |
|
367 //all template rects are relative to TL of keypad |
|
368 TRect rectXPane = RelativeRect( keypaneRect.Rect(), base ); |
|
369 TRect rectXBorder = RelativeRect( keycellRect.Rect(), base ); |
|
370 TRect rectXInner = RelativeRect( keylabelRect.Rect(), base ); |
|
371 |
|
372 rectXPane.Move( - rectOfKeypad.iTl ); //translate to keypad coord-sys |
|
373 rectXBorder.Move( - rectOfKeypad.iTl ); |
|
374 rectXInner.Move( - rectOfKeypad.iTl ); |
|
375 |
|
376 for ( TInt i = 0; i < aRows; i++ ) |
|
377 { |
|
378 TInt indent = ( i % 2 == 1 ) ? rowIndentWidth : 0; |
|
379 for ( TInt j = 0; j < aCols; j++ ) |
|
380 { |
|
381 TRect bound = rectXBorder; |
|
382 bound.Move( j * rectXPane.Width(), i * rectXPane.Height() ); |
|
383 bound.Move( indent, 0 ); |
|
384 |
|
385 data->iKeypad.iRects.AppendL( bound ); |
|
386 |
|
387 TRect inner = rectXPane; |
|
388 inner.Move( j * rectXPane.Width(), i * rectXPane.Height() ); |
|
389 inner.Move( indent, 0 ); |
|
390 |
|
391 TAknLayoutText keyTextLayout; |
|
392 keyTextLayout.LayoutText( inner, keyText ); |
|
393 data->iKeypad.iCharRects.AppendL( keyTextLayout.TextRect() ); |
|
394 } |
|
395 } |
|
396 |
|
397 //buttons |
|
398 |
|
399 //all template rects are relative to TL of buttons row |
|
400 rectXPane = keypaneRect.Rect(); |
|
401 rectXBorder = RelativeRect( keycellRect.Rect(), rectXPane.iTl ); |
|
402 rectXInner = RelativeRect( keylabelRect.Rect(), rectXPane.iTl ); |
|
403 TRect rect3PicPane = RelativeRect( pic3paneRect.Rect(), rectXPane.iTl ); |
|
404 rectXPane.Move( - rectXPane.iTl ); |
|
405 |
|
406 TInt spaceBtnWidth = rectOfButtons.Width() - rectXPane.Width() * 8; |
|
407 TInt dx = rectOfButtons.iTl.iX; |
|
408 TInt dy = rectOfButtons.iTl.iY; |
|
409 |
|
410 data->iCloseButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
411 data->iCloseButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
412 dx += rectXPane.Width(); |
|
413 |
|
414 data->iShiftButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
415 data->iShiftButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
416 dx += rectXPane.Width(); |
|
417 |
|
418 data->iRangeButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
419 data->iRangeButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
420 dx += rectXPane.Width(); |
|
421 |
|
422 data->iLeftButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
423 data->iLeftButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
424 dx += rectXPane.Width(); |
|
425 |
|
426 TInt expand = spaceBtnWidth - rectXPane.Width(); |
|
427 data->iSpaceButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
428 data->iSpaceButton.iRect.Resize( expand, 0 ); |
|
429 data->iSpaceButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
430 data->iSpaceButton.iInnerRect.Resize( expand, 0 ); |
|
431 data->iSpaceButtonEx.iIconsFrameRect = OffsetRect( rect3PicPane, dx, dy ); |
|
432 data->iSpaceButtonEx.iIconsFrameRect.Resize( expand, 0 ); |
|
433 data->iSpaceButtonEx.iMiddleIconRect = data->iSpaceButtonEx.iIconsFrameRect; |
|
434 data->iSpaceButtonEx.iMiddleIconRect.iTl.iX += pic3pLeftWidth; |
|
435 data->iSpaceButtonEx.iMiddleIconRect.iBr.iX -= pic3pRightWidth; |
|
436 dx += spaceBtnWidth; |
|
437 |
|
438 data->iRightButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
439 data->iRightButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
440 dx += rectXPane.Width(); |
|
441 |
|
442 data->iOptionButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
443 data->iOptionButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
444 dx += rectXPane.Width(); |
|
445 |
|
446 data->iEnterButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
447 data->iEnterButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
448 dx += rectXPane.Width(); |
|
449 |
|
450 data->iClearButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
451 data->iClearButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
452 dx += rectXPane.Width(); |
|
453 |
|
454 return data; |
|
455 } |
|
456 |
|
457 // --------------------------------------------------------------------------- |
|
458 // calculate relative rect base on given point |
|
459 // --------------------------------------------------------------------------- |
|
460 // |
|
461 TRect CPeninputLafDataFSQ::RelativeRect( const TRect& aRect, const TPoint& aPoint ) |
|
462 { |
|
463 TRect rect = aRect; |
|
464 rect.Move( - aPoint.iX, - aPoint.iY ); |
|
465 return rect; |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 // Offset rect |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 TRect CPeninputLafDataFSQ::OffsetRect( const TRect& aRect, TInt aDx, TInt aDy ) |
|
473 { |
|
474 TRect rect = aRect; |
|
475 rect.Move( aDx, aDy ); |
|
476 return rect; |
|
477 } |
|
478 |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // Symbian constructor |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 CPeninputSplitQwertyLafMgr* CPeninputSplitQwertyLafMgr::NewL() |
|
485 { |
|
486 CPeninputSplitQwertyLafMgr* self = NewLC(); |
|
487 CleanupStack::Pop(self); |
|
488 |
|
489 return self; |
|
490 } |
|
491 |
|
492 // --------------------------------------------------------------------------- |
|
493 // Symbian constructor |
|
494 // --------------------------------------------------------------------------- |
|
495 // |
|
496 CPeninputSplitQwertyLafMgr* CPeninputSplitQwertyLafMgr::NewLC() |
|
497 { |
|
498 CPeninputSplitQwertyLafMgr* self = new ( ELeave ) CPeninputSplitQwertyLafMgr(); |
|
499 CleanupStack::PushL( self ); |
|
500 self->ConstructL(); |
|
501 |
|
502 return self; |
|
503 } |
|
504 |
|
505 // --------------------------------------------------------------------------- |
|
506 // C++ destructor |
|
507 // --------------------------------------------------------------------------- |
|
508 // |
|
509 CPeninputSplitQwertyLafMgr::~CPeninputSplitQwertyLafMgr() |
|
510 { |
|
511 delete iLafData; |
|
512 iLafData = NULL; |
|
513 } |
|
514 |
|
515 // --------------------------------------------------------------------------- |
|
516 // Set input mode and reload laf |
|
517 // --------------------------------------------------------------------------- |
|
518 // |
|
519 void CPeninputSplitQwertyLafMgr::SetInputModeL( TPluginInputMode aInputMode ) |
|
520 { |
|
521 if ( iInputMode == aInputMode ) |
|
522 { |
|
523 return; |
|
524 } |
|
525 |
|
526 if ( iLafData ) |
|
527 { |
|
528 delete iLafData; |
|
529 iLafData = NULL; |
|
530 } |
|
531 |
|
532 if ( aInputMode == EPluginInputModeFSQ ) |
|
533 { |
|
534 iLafData = CPeninputLafDataFSQ::NewL( ELayoutNone ); |
|
535 } |
|
536 else |
|
537 { |
|
538 User::Leave( KErrNotSupported ); |
|
539 } |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------------------------- |
|
543 // Get current input mode |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 TPluginInputMode CPeninputSplitQwertyLafMgr::InputMode() const |
|
547 { |
|
548 return iInputMode; |
|
549 } |
|
550 |
|
551 // --------------------------------------------------------------------------- |
|
552 // Set layout type |
|
553 // --------------------------------------------------------------------------- |
|
554 // |
|
555 void CPeninputSplitQwertyLafMgr::SetLayoutType( TPeninputQwtLayoutType aLayoutType ) |
|
556 { |
|
557 ASSERT( iLafData ); |
|
558 if ( iLafData ) |
|
559 { |
|
560 iLafData->SetLayoutType( aLayoutType ); |
|
561 } |
|
562 } |
|
563 |
|
564 // --------------------------------------------------------------------------- |
|
565 // Get layout type by row and column count |
|
566 // --------------------------------------------------------------------------- |
|
567 // |
|
568 TPeninputQwtLayoutType CPeninputSplitQwertyLafMgr::LayoutTypeFromRowsColumns( |
|
569 const TInt aRows, |
|
570 const TInt aColumns ) |
|
571 { |
|
572 TPeninputQwtLayoutType ret = ELayoutNone; |
|
573 |
|
574 if ( aRows == 3 && aColumns == 10 ) |
|
575 { |
|
576 ret = ELayout10x3; |
|
577 } |
|
578 else if ( aRows == 3 && aColumns == 11 ) |
|
579 { |
|
580 ret = ELayout11x3; |
|
581 } |
|
582 else if ( aRows == 4 && aColumns == 11 ) |
|
583 { |
|
584 ret = ELayout11x4; |
|
585 } |
|
586 else |
|
587 { |
|
588 ret = ELayoutNone; |
|
589 } |
|
590 |
|
591 return ret; |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // Set option ( and reload laf ) |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CPeninputSplitQwertyLafMgr::SetLafOption( TPeninputVkbLafOption aOption ) |
|
599 { |
|
600 if ( iLafData->LafOption() == aOption ) |
|
601 { |
|
602 return; |
|
603 } |
|
604 |
|
605 iLafData->SetLafOption( aOption ); |
|
606 TRAP_IGNORE( iLafData->ConstructL() ); |
|
607 } |
|
608 |
|
609 // --------------------------------------------------------------------------- |
|
610 // Get current option |
|
611 // --------------------------------------------------------------------------- |
|
612 // |
|
613 TPeninputVkbLafOption CPeninputSplitQwertyLafMgr::OptionType() const |
|
614 { |
|
615 return iLafData->LafOption(); |
|
616 } |
|
617 |
|
618 // --------------------------------------------------------------------------- |
|
619 // Check whether laf data is valid or not |
|
620 // --------------------------------------------------------------------------- |
|
621 // |
|
622 TBool CPeninputSplitQwertyLafMgr::IsValid() |
|
623 { |
|
624 if ( !iLafData ) |
|
625 { |
|
626 return EFalse; |
|
627 } |
|
628 |
|
629 return iLafData->IsValid(); |
|
630 } |
|
631 |
|
632 // --------------------------------------------------------------------------- |
|
633 // Reload laf data |
|
634 // --------------------------------------------------------------------------- |
|
635 // |
|
636 void CPeninputSplitQwertyLafMgr::UpdateLafDataL() |
|
637 { |
|
638 iLafData->ConstructL(); |
|
639 } |
|
640 |
|
641 // --------------------------------------------------------------------------- |
|
642 // Get rect of entire ui, screen coord-sys |
|
643 // --------------------------------------------------------------------------- |
|
644 // |
|
645 const TRect& CPeninputSplitQwertyLafMgr::EntirePaneRect() const |
|
646 { |
|
647 ASSERT( iLafData ); |
|
648 return iLafData->QwtLayoutData().iQwtRect; |
|
649 } |
|
650 |
|
651 // --------------------------------------------------------------------------- |
|
652 // Get rect of entire ui, client coord-sys |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 const TRect& CPeninputSplitQwertyLafMgr::ClientRect() const |
|
656 { |
|
657 ASSERT( iLafData ); |
|
658 return iLafData->QwtLayoutData().iClientRect; |
|
659 } |
|
660 |
|
661 // --------------------------------------------------------------------------- |
|
662 // Get rect of button ctrl |
|
663 // --------------------------------------------------------------------------- |
|
664 // |
|
665 void CPeninputSplitQwertyLafMgr::GetButtonRect( TPeninputCommonCtrlID aButtonID, |
|
666 TRect& aOutterRect, |
|
667 TRect& aInnerRect ) |
|
668 { |
|
669 ASSERT( iLafData ); |
|
670 const TPeninputButtonLayoutData& data = iLafData->ButtonLayoutData( aButtonID ); |
|
671 aOutterRect = data.iRect; |
|
672 aInnerRect = data.iInnerRect; |
|
673 } |
|
674 |
|
675 |
|
676 // --------------------------------------------------------------------------- |
|
677 // Get rect of virtual keypad ctrl |
|
678 // --------------------------------------------------------------------------- |
|
679 // |
|
680 const TRect& CPeninputSplitQwertyLafMgr::KeypadRect() const |
|
681 { |
|
682 ASSERT( iLafData ); |
|
683 const TPeninputKeyLayoutData& data = iLafData->KeypadLayoutData(); |
|
684 return data.iKaypadRect; |
|
685 } |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // Get rect of virtual key ctrl |
|
689 // --------------------------------------------------------------------------- |
|
690 // |
|
691 void CPeninputSplitQwertyLafMgr::GetKeyRect( TInt aCol, TInt aRow, |
|
692 TRect& aKeyRect, |
|
693 TRect& aCharRect ) const |
|
694 { |
|
695 ASSERT(iLafData); |
|
696 TInt colNum = 0; |
|
697 TInt index = 0; |
|
698 switch( iLafData->LayoutType() ) |
|
699 { |
|
700 case ELayout10x3: |
|
701 { |
|
702 colNum = 10; |
|
703 } |
|
704 break; |
|
705 case ELayout11x3: |
|
706 { |
|
707 colNum = 11; |
|
708 } |
|
709 break; |
|
710 case ELayout11x4: |
|
711 { |
|
712 colNum = 11; |
|
713 } |
|
714 break; |
|
715 } |
|
716 index = aRow * colNum + aCol; |
|
717 aKeyRect = iLafData->KeypadLayoutData().iRects[index]; |
|
718 aCharRect = iLafData->KeypadLayoutData().iCharRects[index]; |
|
719 } |
|
720 |
|
721 // --------------------------------------------------------------------------- |
|
722 // Get text font of virtual keypad ctrl |
|
723 // --------------------------------------------------------------------------- |
|
724 // |
|
725 const CFont* CPeninputSplitQwertyLafMgr::KeyTextFont() const |
|
726 { |
|
727 ASSERT( iLafData ); |
|
728 return iLafData->KeypadLayoutData().iFont; |
|
729 } |
|
730 |
|
731 // --------------------------------------------------------------------------- |
|
732 // Get text layout of virtual keypad ctrl |
|
733 // --------------------------------------------------------------------------- |
|
734 // |
|
735 TAknTextLineLayout CPeninputSplitQwertyLafMgr::KeyTextLayout() const |
|
736 { |
|
737 ASSERT( iLafData ); |
|
738 return iLafData->KeypadLayoutData().iTextLayout; |
|
739 } |
|
740 |
|
741 // --------------------------------------------------------------------------- |
|
742 // Get rect of preview bubble ctrl |
|
743 // --------------------------------------------------------------------------- |
|
744 // |
|
745 void CPeninputSplitQwertyLafMgr::GetPreviewWndRect( TRect& aOutRect, |
|
746 TRect& aInnerRect ) const |
|
747 { |
|
748 aOutRect = iLafData->QwtLayoutData().iPreviewWndRect; |
|
749 aInnerRect = iLafData->QwtLayoutData().iPreviewWndInnerRect; |
|
750 } |
|
751 |
|
752 // --------------------------------------------------------------------------- |
|
753 // Get text layout of preview bubble |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 TAknTextLineLayout CPeninputSplitQwertyLafMgr::PreviewWndText() const |
|
757 { |
|
758 return iLafData->QwtLayoutData().iPreviewWndText; |
|
759 } |
|
760 |
|
761 // --------------------------------------------------------------------------- |
|
762 // Get 3-pieces info of space button |
|
763 // --------------------------------------------------------------------------- |
|
764 // |
|
765 void CPeninputSplitQwertyLafMgr::GetSpaceButtonExLayoutInfo( TRect& aIconsFrameRect, |
|
766 TRect& aMiddleIconRect ) const |
|
767 { |
|
768 ASSERT( iLafData ); |
|
769 aIconsFrameRect = iLafData->QwtLayoutData().iSpaceButtonEx.iIconsFrameRect; |
|
770 aMiddleIconRect = iLafData->QwtLayoutData().iSpaceButtonEx.iMiddleIconRect; |
|
771 } |
|
772 |
|
773 // --------------------------------------------------------------------------- |
|
774 // C++ constructor |
|
775 // --------------------------------------------------------------------------- |
|
776 // |
|
777 CPeninputSplitQwertyLafMgr::CPeninputSplitQwertyLafMgr() |
|
778 : iInputMode(EPluginInputModeNone) |
|
779 { |
|
780 } |
|
781 |
|
782 // --------------------------------------------------------------------------- |
|
783 // CPeninputSplitQwertyLafMgr::ConstructL |
|
784 // (other items were commented in a header) |
|
785 // --------------------------------------------------------------------------- |
|
786 // |
|
787 void CPeninputSplitQwertyLafMgr::ConstructL() |
|
788 { |
|
789 } |
|
790 // End Of File |