|
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: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknlayoutscalable_apps.cdl.h> |
|
20 #include <peninputgeneralitutnew.rsg> |
|
21 #include <peninputitutconfig_chinese.rsg> |
|
22 #include <skinlayout.cdl.h> |
|
23 #include <AknsDrawUtils.h> |
|
24 #include <AknsUtils.h> |
|
25 #include <AknUtils.h> |
|
26 #include <peninputrawkeybutton.h> |
|
27 #include <peninputrepeatbutton.h> |
|
28 #include <peninputcommonbutton.h> |
|
29 #include "peninputrepeatbuttonex.h" |
|
30 #include <AknFepGlobalEnums.h> |
|
31 #include <aknfeppeninputenums.h> |
|
32 #include <peninputdropdownlist.h> |
|
33 #include <peninputlayoutchoicelist.h> |
|
34 #include <peninputscrollablelist.h> |
|
35 #include <s32mem.h> |
|
36 #include <peninputlabel.h> |
|
37 #include <peninputlayoutinputmodechoice.h> |
|
38 #include <peninputlayoutbubblectrl.h> |
|
39 |
|
40 #include "peninputgenericitutwindow.h" |
|
41 #include "peninputgenericitutdatamgr.h" |
|
42 #include "peninputgenericitutuimgrbase.h" |
|
43 #include "peninputgenericitutuistatebase.h" |
|
44 #include "peninputitutchnuimgr.h" |
|
45 #include "peninputitutwesternuimgr.h" |
|
46 #include "peninputgenericitutconverter.h" |
|
47 #include "peninputcommonbgctrl.h" |
|
48 |
|
49 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputgenericitut.mbm"); |
|
50 |
|
51 const TInt KImageMajorSkinId = EAknsMajorGeneric; |
|
52 const TUint KDefaultSpellTextColor = 0; |
|
53 const TUint KDefaultIcfTextColor = 0x000000; |
|
54 const TUint KDefaultIcfFrameColor = 0x000000; |
|
55 |
|
56 const TInt KSpaceUnicode = 32; |
|
57 const TInt KButtonOneUnicode = 49; |
|
58 |
|
59 CGenericItutWindow* CGenericItutWindow::NewL(CGenericItutWindowManager* aWindowMgr, |
|
60 CGenericItutUiLayout* aLayoutOwner, |
|
61 CGenericItutDataMgr* aDataMgr) |
|
62 { |
|
63 CGenericItutWindow* window = new (ELeave) CGenericItutWindow(aWindowMgr,aLayoutOwner,aDataMgr); |
|
64 |
|
65 CleanupStack::PushL(window); |
|
66 window->ConstructL(); |
|
67 CleanupStack::Pop(window); |
|
68 |
|
69 return window; |
|
70 } |
|
71 |
|
72 CGenericItutWindow::CGenericItutWindow(CGenericItutWindowManager* aWindowMgr, |
|
73 CGenericItutUiLayout* aLayoutOwner, |
|
74 CGenericItutDataMgr* aDataMgr) |
|
75 : iDataMgr(aDataMgr), |
|
76 iLayoutOwner(aLayoutOwner), |
|
77 iWindowMgr(aWindowMgr) |
|
78 { |
|
79 } |
|
80 |
|
81 CGenericItutWindow::~CGenericItutWindow() |
|
82 { |
|
83 delete iBmpRotator; |
|
84 } |
|
85 |
|
86 void CGenericItutWindow::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, |
|
87 const TDesC& aPropertyValue) |
|
88 { |
|
89 switch (aPropertyName) |
|
90 { |
|
91 case MItutPropertySubscriber::EItutPropertyKeypadResourceId: |
|
92 case MItutPropertySubscriber::EItutPropertyCandidateListResourceId: |
|
93 { |
|
94 TInt resId = TItutDataConverter::AnyToInt(const_cast<TUint16*>(aPropertyValue.Ptr())); |
|
95 |
|
96 if (resId == KInvalidResId) |
|
97 { |
|
98 return; |
|
99 } |
|
100 |
|
101 if (aPropertyName == MItutPropertySubscriber::EItutPropertyKeypadResourceId) |
|
102 { |
|
103 ConstructItutKeypadFromResourceL(resId); |
|
104 } |
|
105 else if (iCandsList) |
|
106 { |
|
107 iCandsList->ResetAndClear(CFepCtrlDropdownList::EListExpandable); |
|
108 iCandsList->SetResourceId(resId); |
|
109 iCandsList->ConstructFromResourceL(); |
|
110 } |
|
111 } |
|
112 break; |
|
113 case MItutPropertySubscriber::EItutPropertyLandscape: |
|
114 { |
|
115 TBool landscape = *((TInt*)(aPropertyValue.Ptr())); |
|
116 |
|
117 if (iDataMgr->IsChinese()) |
|
118 { |
|
119 if (landscape) |
|
120 { |
|
121 // expand upward |
|
122 iSpellCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward); |
|
123 iCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward); |
|
124 } |
|
125 else |
|
126 { |
|
127 // portrait, expand downward |
|
128 iSpellCandsList->SetCandExpandType(); |
|
129 iCandsList->SetCandExpandType(); |
|
130 } |
|
131 } |
|
132 } |
|
133 break; |
|
134 default: |
|
135 break; |
|
136 } |
|
137 } |
|
138 |
|
139 void CGenericItutWindow::CreateItutKeypadL() |
|
140 { |
|
141 TRect keypadRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EKeypadRect)); |
|
142 |
|
143 TFontSpec spec; |
|
144 |
|
145 iStandardItutKp = CVirtualKeyboard::NewL(keypadRect, |
|
146 iLayoutOwner, |
|
147 ECtrlIdStdItut, |
|
148 spec); |
|
149 AddControlL(iStandardItutKp); |
|
150 |
|
151 iStandardItutKp->SetResourceId(KInvalidResId); |
|
152 |
|
153 // read keypad image info |
|
154 ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP ); |
|
155 |
|
156 iStandardItutKp->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG65 ); |
|
157 iStandardItutKp->SetDrawOpaqueBackground(EFalse); |
|
158 |
|
159 // read key shift icon res |
|
160 CPenInputColorIcon* shiftIcon = CPenInputColorIcon::NewL( R_ITUT_KEYPAD_SHIFT_ICON ); |
|
161 shiftIcon->ResizeL( iDataMgr->iShiftIconRect.Size() ); |
|
162 iStandardItutKp->SetShiftIcon( shiftIcon ); |
|
163 |
|
164 //set key to be 9 piece graphics |
|
165 iStandardItutKp->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal ); |
|
166 iStandardItutKp->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed ); |
|
167 iStandardItutKp->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive ); |
|
168 } |
|
169 |
|
170 void CGenericItutWindow::CreateLayoutIconL(TInt aMajorSkinId, |
|
171 TInt aMinorSkinId, |
|
172 const TDesC& aBmpFileName, |
|
173 TInt aBmpId, |
|
174 TInt aMaskBmpId, |
|
175 CFbsBitmap*& aBmp, |
|
176 CFbsBitmap*& aMaskBmp, |
|
177 TSize aSize) |
|
178 { |
|
179 TAknsItemID id; |
|
180 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
181 id.Set(TInt(aMajorSkinId), aMinorSkinId); |
|
182 |
|
183 if (aBmpId != KInvalidBmp) |
|
184 { |
|
185 if (aMaskBmpId != KInvalidBmp) |
|
186 { |
|
187 AknsUtils::CreateIconL(skininstance, |
|
188 id, |
|
189 aBmp, |
|
190 aMaskBmp, |
|
191 aBmpFileName, |
|
192 aBmpId, |
|
193 aMaskBmpId); |
|
194 AknIconUtils::SetSize(aMaskBmp, aSize, EAspectRatioNotPreserved); |
|
195 } |
|
196 else |
|
197 { |
|
198 AknsUtils::CreateIconL(skininstance, |
|
199 id, |
|
200 aBmp, |
|
201 aBmpFileName, |
|
202 aBmpId); |
|
203 } |
|
204 |
|
205 AknIconUtils::SetSize(aBmp, aSize, EAspectRatioNotPreserved); |
|
206 } |
|
207 } |
|
208 |
|
209 void CGenericItutWindow::ConstructItutKeypadFromResourceL(TInt aResId) |
|
210 { |
|
211 iStandardItutKp->SetResourceId(aResId); |
|
212 |
|
213 iStandardItutKp->SetTextLineLayout( |
|
214 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)), |
|
215 EPosLeft); |
|
216 iStandardItutKp->SetTextLineLayout( |
|
217 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)), |
|
218 EPosRight1); |
|
219 iStandardItutKp->SetTextLineLayout( |
|
220 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
|
221 EPosRight2); |
|
222 iStandardItutKp->SetTextLineLayout( |
|
223 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
|
224 EPosRight3); |
|
225 |
|
226 TResourceReader reader; |
|
227 CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId); |
|
228 |
|
229 // construct keys |
|
230 TInt countkeys = reader.ReadInt16(); |
|
231 |
|
232 RPointerArray<CVirtualKey>& keys = |
|
233 const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray()); |
|
234 |
|
235 if (keys.Count() == 0) |
|
236 { |
|
237 for (TInt i = 0; i < countkeys; i++) |
|
238 { |
|
239 RArray<TRect>& cellrects = |
|
240 TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects)); |
|
241 |
|
242 CVirtualKey* vk = CreateKeyL(reader, |
|
243 cellrects[i]); |
|
244 CleanupStack::PushL(vk); |
|
245 iStandardItutKp->AddRawKeyL(vk); |
|
246 CleanupStack::Pop(vk); |
|
247 } |
|
248 } |
|
249 else |
|
250 { |
|
251 countkeys = keys.Count(); |
|
252 for (TInt i = 0; i < countkeys; i++) |
|
253 { |
|
254 ChangeVirtualKeyInfoL(reader, keys[i]); |
|
255 } |
|
256 } |
|
257 |
|
258 CleanupStack::PopAndDestroy(1); // reader |
|
259 |
|
260 iStandardItutKp->Draw(); |
|
261 iStandardItutKp->UpdateArea( iStandardItutKp->Rect() ); |
|
262 |
|
263 //iLayoutOwner->RootControl()->Draw(); |
|
264 } |
|
265 |
|
266 void CGenericItutWindow::ChangeVirtualKeyInfoL(TResourceReader& aReader, |
|
267 CVirtualKey* aKey) |
|
268 { |
|
269 |
|
270 TBuf<5> mapData; |
|
271 //Init Data |
|
272 for (TInt i = 0; i < 5; i++) |
|
273 { |
|
274 mapData.Append(0); |
|
275 } |
|
276 |
|
277 RPointerArray<HBufC> unicodesArr; |
|
278 for (TInt i = 0; i <= EPosLast; i++) |
|
279 { |
|
280 HBufC* unicode = aReader.ReadHBufCL(); |
|
281 if (i == 0 && unicode != NULL) |
|
282 { |
|
283 mapData = unicode->Des(); |
|
284 } |
|
285 unicodesArr.AppendL(unicode); |
|
286 } |
|
287 |
|
288 TInt keyscancode = aReader.ReadInt16(); |
|
289 if (keyscancode != aKey->ScanCode()) |
|
290 { |
|
291 return; |
|
292 } |
|
293 |
|
294 TInt curMode = TItutDataConverter::AnyToInt( |
|
295 iLayoutOwner->DataMgr()->RequestData(EInputMode)); |
|
296 TBool isChinese = iLayoutOwner->DataMgr()->IsChinese(); |
|
297 TBool isThai = iLayoutOwner->DataMgr()->IsThai(); |
|
298 |
|
299 TInt latinOnly = TItutDataConverter::AnyToInt( |
|
300 iLayoutOwner->DataMgr()->RequestData(ELatinOnly)); |
|
301 |
|
302 //No symbol in Number range. Symbols under chinese are read from res |
|
303 if ( curMode != ENumber && curMode != ENativeNumber |
|
304 && iSymbolData.iSymbol1 != 0 && keyscancode == KButtonOneUnicode |
|
305 && ( !isChinese || latinOnly ) |
|
306 && ( !isThai ) && (curMode != EHangul) ) |
|
307 { |
|
308 //This array is alloced when |
|
309 //HBufC* unicode = aReader.ReadHBufCL(); |
|
310 //unicodesArr.AppendL(unicode); |
|
311 //So we should delete it |
|
312 for (TInt i = 0; i <= EPosLast; i++) |
|
313 { |
|
314 delete unicodesArr[i]; |
|
315 } |
|
316 SetUnicodesForHardKey1(aKey, mapData); |
|
317 } |
|
318 else |
|
319 { |
|
320 aKey->SetUnicodesL(unicodesArr); |
|
321 } |
|
322 |
|
323 unicodesArr.Close(); |
|
324 } |
|
325 |
|
326 CVirtualKey* CGenericItutWindow::CreateKeyL(TResourceReader& aReader, |
|
327 TRect aKeyRect) |
|
328 { |
|
329 RPointerArray<HBufC> unicodesArr; |
|
330 for (TInt i = 0; i <= EPosLast; i++) |
|
331 { |
|
332 HBufC* unicode = aReader.ReadHBufCL(); |
|
333 unicodesArr.AppendL(unicode); |
|
334 } |
|
335 |
|
336 TInt keyscancode = aReader.ReadInt16(); |
|
337 |
|
338 CVirtualKey* vk = CVirtualKey::NewL(unicodesArr, |
|
339 keyscancode, |
|
340 aKeyRect); |
|
341 unicodesArr.Close(); |
|
342 CleanupStack::PushL(vk); |
|
343 |
|
344 TRect innerrect = aKeyRect; |
|
345 innerrect.Shrink(TSize(7, 7)); |
|
346 vk->SetInnerRect(innerrect); |
|
347 |
|
348 CleanupStack::Pop(vk); |
|
349 |
|
350 return vk; |
|
351 } |
|
352 |
|
353 void CGenericItutWindow::CreateBackGroundControlL() |
|
354 { |
|
355 iBackgroundCtrl = CAknFepCtrlCommonBgCtrl::NewL( |
|
356 iLayoutOwner, |
|
357 ECtrlIdBackground, |
|
358 KAknsIIDQsnFrPopup, |
|
359 KAknsIIDQsnFrPopupCenter); |
|
360 |
|
361 |
|
362 iBackgroundCtrl->SetRect(TItutDataConverter::AnyToRect( |
|
363 iLayoutOwner->DataMgr()->RequestData(ELayoutRect))); |
|
364 |
|
365 TCommonBgCtrlSubItem bgSubItem; |
|
366 TRect spellPaneRect; |
|
367 |
|
368 spellPaneRect = TItutDataConverter::AnyToRect( |
|
369 iDataMgr->RequestData(ESpellQueryPaneRect) ); |
|
370 |
|
371 bgSubItem.iRect = spellPaneRect; |
|
372 bgSubItem.iFrameID = KAknsIIDQsnFrPopupSub; |
|
373 bgSubItem.iCenterID = KAknsIIDDefault; |
|
374 bgSubItem.iIsShow = EFalse; |
|
375 |
|
376 iBackgroundCtrl->AddSubBgItemL( bgSubItem ); |
|
377 |
|
378 AddControlL(iBackgroundCtrl); |
|
379 } |
|
380 |
|
381 |
|
382 CAknFepCtrlCommonButton* CGenericItutWindow::CreateRawKeyButtonL(const TInt aControlId, |
|
383 const TInt aCommand) |
|
384 { |
|
385 CAknFepCtrlCommonButton* temp = NULL; |
|
386 |
|
387 if (aCommand == KUnavailableID) |
|
388 { |
|
389 temp = CAknFepCtrlRawKeyButton::NewL(iLayoutOwner, |
|
390 aControlId, |
|
391 KAknsIIDQsnFrFunctionButtonNormal, |
|
392 KAknsIIDQsnFrFunctionButtonPressed, |
|
393 KAknsIIDQsnFrFunctionButtonInactive, |
|
394 EEventRawKeyDownEvent, |
|
395 EEventRawKeyUpEvent); |
|
396 } |
|
397 else |
|
398 { |
|
399 temp = CAknFepCtrlRawKeyButton::NewL(iLayoutOwner, |
|
400 aControlId, |
|
401 KAknsIIDQsnFrFunctionButtonNormal, |
|
402 KAknsIIDQsnFrFunctionButtonPressed, |
|
403 KAknsIIDQsnFrFunctionButtonInactive, |
|
404 EEventRawKeyDownEvent, |
|
405 EEventRawKeyUpEvent, |
|
406 aCommand); |
|
407 } |
|
408 |
|
409 return temp; |
|
410 } |
|
411 |
|
412 CAknFepCtrlCommonButton* CGenericItutWindow::CreateCommonButtonL(const TInt aControlId) |
|
413 { |
|
414 return CAknFepCtrlCommonButton::NewL(iLayoutOwner, |
|
415 aControlId, |
|
416 KAknsIIDQsnFrFunctionButtonNormal, |
|
417 KAknsIIDQsnFrFunctionButtonPressed, |
|
418 KAknsIIDQsnFrFunctionButtonInactive ); |
|
419 |
|
420 } |
|
421 |
|
422 CAknFepCtrlCommonButton* CGenericItutWindow::CreateRepeatButtonL(const TInt aControlId, |
|
423 const TInt aCommand) |
|
424 { |
|
425 return CAknFepCtrlRepeatButtonEx::NewL(iLayoutOwner, |
|
426 aControlId, |
|
427 KAknsIIDQsnFrFunctionButtonNormal, |
|
428 KAknsIIDQsnFrFunctionButtonPressed, |
|
429 KAknsIIDQsnFrFunctionButtonInactive, |
|
430 aCommand); |
|
431 |
|
432 } |
|
433 |
|
434 |
|
435 CFepUiBaseCtrl* CGenericItutWindow::CreateButtonL(TButtonType aType, |
|
436 const TInt aControlId, |
|
437 const TInt aRectId, |
|
438 const TInt aInnerRectId, |
|
439 const TInt aResourceId, |
|
440 const TInt aCommand) |
|
441 { |
|
442 CAknFepCtrlCommonButton* temp = NULL; |
|
443 |
|
444 switch(aType) |
|
445 { |
|
446 case ERawKeyButton: |
|
447 { |
|
448 temp = CreateRawKeyButtonL(aControlId, aCommand); |
|
449 } |
|
450 break; |
|
451 case ECommonButton: |
|
452 { |
|
453 temp = CreateCommonButtonL(aControlId); |
|
454 } |
|
455 break; |
|
456 case ERepeatButtonEx: |
|
457 { |
|
458 temp = CreateRepeatButtonL(aControlId, aCommand); |
|
459 } |
|
460 break; |
|
461 default: |
|
462 { |
|
463 User::Leave(KErrArgument); |
|
464 } |
|
465 } |
|
466 |
|
467 TRect btnrect; |
|
468 TRect btnInnerRect; |
|
469 |
|
470 if (aRectId != KUnavailableID && |
|
471 aInnerRectId != KUnavailableID) |
|
472 { |
|
473 btnrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectId)); |
|
474 btnInnerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRectId)); |
|
475 |
|
476 temp->SetRect(btnrect); |
|
477 temp->SetForgroundBmpRect(btnInnerRect); |
|
478 } |
|
479 |
|
480 if (aResourceId != KUnavailableID) |
|
481 { |
|
482 temp->SetResourceId(aResourceId); |
|
483 temp->ConstructFromResourceL(); |
|
484 } |
|
485 |
|
486 if (aRectId != KUnavailableID && |
|
487 aInnerRectId != KUnavailableID) |
|
488 { |
|
489 temp->SizeChanged(temp->Rect(), btnInnerRect, ETrue); |
|
490 } |
|
491 |
|
492 AddControlL(temp); |
|
493 |
|
494 return temp; |
|
495 } |
|
496 |
|
497 |
|
498 void CGenericItutWindow::CreateAllButtonL() |
|
499 { |
|
500 CFepUiBaseCtrl* temp = NULL; |
|
501 //create backgrand |
|
502 CreateBackGroundControlL(); |
|
503 |
|
504 //create backspace |
|
505 CreateButtonL(ERawKeyButton, ECtrlIdBackspace, EBackspaceRect, |
|
506 EBackspaceInnerRect,R_FINGER_RAWKEY_BACKSPACE); |
|
507 |
|
508 //create switch |
|
509 CreateButtonL(ECommonButton, ECtrlIdSwitch, ESwitchRect, |
|
510 ESwitchInnerRect, R_FINGER_LAYOUT_SWITCH); |
|
511 |
|
512 |
|
513 //create indicator |
|
514 // temp = CreateButtonL(ERawKeyButton, ECtrlIdIndicator, KUnavailableID, |
|
515 // KUnavailableID,KUnavailableID, 127); |
|
516 //If open indicator menu, please use the following 2 lines |
|
517 temp = CreateButtonL(ECommonButton, ECtrlIdIndicator, KUnavailableID, |
|
518 KUnavailableID,KUnavailableID); |
|
519 |
|
520 if (temp) |
|
521 { |
|
522 temp->Hide(ETrue); |
|
523 } |
|
524 |
|
525 temp = NULL; |
|
526 |
|
527 |
|
528 // create navi |
|
529 CreateButtonL(ERawKeyButton, ECtrlIdArrowLeft, EArrowLeftRect, |
|
530 ELeftInnerRect,R_FINGER_RAWKEY_LEFTARROW); |
|
531 |
|
532 CreateButtonL(ERawKeyButton, ECtrlIdArrowRight, EArrowRightRect, |
|
533 ERightInnerRect,R_FINGER_RAWKEY_RIGHTARROW); |
|
534 |
|
535 CreateButtonL(ERepeatButtonEx, ECtrlIdArrowUp, EArrowUpRect, |
|
536 EUpInnerRect,R_PENINPUT_FINGER_CURSOR_UP); |
|
537 |
|
538 CreateButtonL(ERepeatButtonEx, ECtrlIdArrowDown, EArrowDownRect, |
|
539 EDownInnerRect,R_PENINPUT_FINGER_CURSOR_DOWN); |
|
540 |
|
541 //create option |
|
542 CreateButtonL(ECommonButton, ECtrlIdOptions, EOptionsRect, |
|
543 EOptionInnerRect, R_PENINPUT_FINGER_OPTIONS); |
|
544 |
|
545 //Crease close |
|
546 CreateButtonL(ECommonButton, ECtrlIdClose, ECloseRect, |
|
547 ECloseInnerRect, R_PENINPUT_FINGER_CLOSE); |
|
548 |
|
549 |
|
550 CAknFepCtrlLabel* spellIndicator = CAknFepCtrlLabel::NewL(iLayoutOwner, ECtrlIdSpellIndicator); |
|
551 AddControlL(spellIndicator); |
|
552 spellIndicator->Hide(ETrue); |
|
553 |
|
554 } |
|
555 |
|
556 void CGenericItutWindow::CreateDropdownListL() |
|
557 { |
|
558 TRect outrect,innerrect; |
|
559 outrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleRect)); |
|
560 innerrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleInnerRect)); |
|
561 TAknTextLineLayout bubbleTextLayout = |
|
562 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EPreviewBubbleTextlayout)); |
|
563 CFont* bubbleFont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EPreviewBubbleFont)); |
|
564 |
|
565 TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, |
|
566 KAknsIIDQsnFrFunctionButtonNormal, |
|
567 KAknsIIDQsnFrFunctionButtonPressed, |
|
568 KAknsIIDQsnFrItutButtonCandiSideL, |
|
569 KAknsIIDQsnFrItutButtonCandiMiddle, |
|
570 KAknsIIDQsnFrItutButtonCandiSideR, |
|
571 KAknsIIDQsnFrItutButtonCandiPressedSideL, |
|
572 KAknsIIDQsnFrItutButtonCandiPressedMiddle, |
|
573 KAknsIIDQsnFrItutButtonCandiPressedSideR, |
|
574 TRgb(194, 221, 242), |
|
575 ETrue); |
|
576 |
|
577 TDropdownListDrawInfo compositionDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, |
|
578 KAknsIIDQsnFrFunctionButtonNormal, |
|
579 KAknsIIDQsnFrFunctionButtonPressed, |
|
580 KAknsIIDQsnFrItutButtonComposeSideL, |
|
581 KAknsIIDQsnFrItutButtonComposeMiddle, |
|
582 KAknsIIDQsnFrItutButtonComposeSideR, |
|
583 KAknsIIDQsnFrItutButtonComposePressedSideL, |
|
584 KAknsIIDQsnFrItutButtonComposePressedSideR, |
|
585 KAknsIIDQsnFrItutButtonComposePressedMiddle, |
|
586 TRgb(194, 221, 242), |
|
587 ETrue); |
|
588 TInt unitWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth)); |
|
589 TInt unitHeight = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitHeight)); |
|
590 TInt horizontalMargin = |
|
591 TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin)); |
|
592 TInt verticalMargin = |
|
593 TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin)); |
|
594 |
|
595 CFont* listfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EDropdownListFont)); |
|
596 TInt textmargin = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListTextMargin)); |
|
597 TRgb textcolor = TItutDataConverter::AnyToRgb(iDataMgr->RequestData(EDropdownListTextColor)); |
|
598 |
|
599 TPoint spellListLTPos = |
|
600 TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListSpellLTPos)); |
|
601 // create spelling drop list |
|
602 iSpellCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner, |
|
603 ECtrlIdSpellCandsList, |
|
604 R_AKN_FEP_PINYIN_SPELLING_DROP_DOWN_LIST, |
|
605 spellListLTPos, |
|
606 TSize(unitWidth, unitHeight), |
|
607 5, |
|
608 3); |
|
609 |
|
610 if (iDataMgr->IsLandScape()) |
|
611 { |
|
612 iSpellCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward); |
|
613 } |
|
614 |
|
615 iSpellCandsList->SetCellMargin(horizontalMargin, verticalMargin); |
|
616 iSpellCandsList->SetFont(listfont); |
|
617 AddControlL(iSpellCandsList); |
|
618 iSpellCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected); |
|
619 iSpellCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateFromBeginning); |
|
620 iSpellCandsList->SetFuzzyBoundry(10); |
|
621 iSpellCandsList->Hide(ETrue); |
|
622 iSpellCandsList->SetDropdownListImgID(compositionDrawInfo); |
|
623 |
|
624 TPoint candListLTPos = |
|
625 TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListCandsLTPos)); |
|
626 // create candidate drop list |
|
627 iCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner, |
|
628 ECtrlIdStdCandsList, |
|
629 R_AKN_FEP_NORMAL_CAND_DROP_DOWN_LIST, |
|
630 candListLTPos, |
|
631 TSize(unitWidth, unitHeight), |
|
632 5, |
|
633 3); |
|
634 |
|
635 if (iDataMgr->IsLandScape()) |
|
636 { |
|
637 iCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward); |
|
638 } |
|
639 |
|
640 iCandsList->SetCellMargin(horizontalMargin, verticalMargin); |
|
641 iCandsList->SetFont(listfont); |
|
642 AddControlL(iCandsList); |
|
643 iCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected); |
|
644 iCandsList->SetEventIdForNextPageCandidate(EItutCmdGetNextCandidatePage); |
|
645 iCandsList->SetEventIdForCandidateExisted(EItutCmdCandidateExisted); |
|
646 iCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateAsEllipsis); |
|
647 iCandsList->SetFuzzyBoundry(10); |
|
648 iCandsList->Hide(ETrue); |
|
649 iCandsList->SetDropdownListImgID(candiDrawInfo); |
|
650 |
|
651 TPoint puncListLTPos = |
|
652 TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListPuncLTPos)); |
|
653 // create punctuation drop list |
|
654 iPuncCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner, |
|
655 ECtrlIdPuncCandsList, |
|
656 R_AKN_FEP_PUNC_DROP_DOWN_LIST, |
|
657 puncListLTPos, |
|
658 TSize(unitWidth, unitHeight), |
|
659 5, |
|
660 1); |
|
661 iPuncCandsList->SetCellMargin(horizontalMargin, verticalMargin); |
|
662 iPuncCandsList->SetFont(listfont); |
|
663 AddControlL(iPuncCandsList); |
|
664 iPuncCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected); |
|
665 iPuncCandsList->SetDropdownListImgID(candiDrawInfo); |
|
666 iPuncCandsList->Hide(ETrue); |
|
667 } |
|
668 |
|
669 void CGenericItutWindow::ConstructIcfFromResourceL() |
|
670 { |
|
671 if (!iICF->ResourceId()) |
|
672 { |
|
673 return; |
|
674 } |
|
675 |
|
676 TResourceReader icfreader; |
|
677 CCoeEnv::Static()->CreateResourceReaderLC(icfreader, iICF->ResourceId()); |
|
678 TInt32 colorMajorSkinId = icfreader.ReadInt32(); |
|
679 TInt skinitemid = icfreader.ReadInt16(); |
|
680 TInt coloridx = icfreader.ReadInt16(); |
|
681 |
|
682 TAknsItemID colorid; |
|
683 colorid.Set(TInt(colorMajorSkinId), skinitemid); |
|
684 |
|
685 TRgb icftextcolor; |
|
686 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
687 TInt error = AknsUtils::GetCachedColor(skininstance, |
|
688 icftextcolor, |
|
689 colorid, |
|
690 coloridx); |
|
691 |
|
692 if (error != KErrNone) |
|
693 { |
|
694 icftextcolor = TRgb(KDefaultIcfTextColor); |
|
695 } |
|
696 |
|
697 iICF->SetTextColorL(icftextcolor); |
|
698 |
|
699 // Set highlight color |
|
700 TRgb icfhightlightcolor; |
|
701 error = AknsUtils::GetCachedColor( skininstance, |
|
702 icfhightlightcolor, |
|
703 KAknsIIDQsnHighlightColors, |
|
704 EAknsCIQsnHighlightColorsCG2 ); |
|
705 if ( error == KErrNone ) |
|
706 { |
|
707 iICF->SetTextSelColorL( icfhightlightcolor ); |
|
708 } |
|
709 |
|
710 skinitemid = icfreader.ReadInt16(); |
|
711 coloridx = icfreader.ReadInt16(); |
|
712 |
|
713 colorid.Set(TInt(colorMajorSkinId), skinitemid); |
|
714 |
|
715 TRgb icfframecolor; |
|
716 error = AknsUtils::GetCachedColor(skininstance, |
|
717 icfframecolor, |
|
718 colorid, |
|
719 coloridx); |
|
720 |
|
721 if (error != KErrNone) |
|
722 { |
|
723 icfframecolor = TRgb(KDefaultIcfFrameColor); |
|
724 } |
|
725 |
|
726 iICF->SetBorderColor(icfframecolor); |
|
727 CleanupStack::PopAndDestroy( 1 ); // icfreader |
|
728 } |
|
729 |
|
730 void CGenericItutWindow::CreateICFL() |
|
731 { |
|
732 CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
733 TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)); |
|
734 iICF = CFepLayoutMultiLineIcf::NewL(rect, |
|
735 iLayoutOwner, |
|
736 ECtrlIdICF, |
|
737 icffont->HeightInPixels(), |
|
738 icffont->FontMaxHeight(), |
|
739 icffont); |
|
740 |
|
741 iICF->SetFocus(ETrue); |
|
742 |
|
743 iICF->SetResourceId(R_FINGER_ICF); |
|
744 ConstructIcfFromResourceL(); |
|
745 iICF->SetBgImgSkinId(KAknsIIDQsnFrCall2Rect); |
|
746 //iDataMgr->SetTextAlignment(); |
|
747 |
|
748 AddControlL(iICF); |
|
749 } |
|
750 |
|
751 void CGenericItutWindow::AddEditorMenuL() |
|
752 { |
|
753 iEditorMenu = CPeninputCommonChoiceList::NewL( iLayoutOwner, |
|
754 ECtrlIdEditorMenu, |
|
755 KAknsIIDQsnFrList, |
|
756 KAknsIIDQsnFrPopupSub ); |
|
757 |
|
758 AddControlL( iEditorMenu ); |
|
759 } |
|
760 |
|
761 void CGenericItutWindow::ShowEditorMenuL(TInt* aData) |
|
762 { |
|
763 TInt count = *aData; |
|
764 iEditorMenu->ClearItemsL(); |
|
765 for (TInt i=1;i<=count;i++ ) |
|
766 { |
|
767 TInt menucommand = *(aData+i); |
|
768 CGenericItutDataMgr::TMenuItem* menuitem = iDataMgr->GetMenuItem(menucommand); |
|
769 if ( menuitem ) |
|
770 { |
|
771 CFepLayoutChoiceList::SItem item; |
|
772 item.iCommand = menucommand; |
|
773 item.iText = menuitem->iText; |
|
774 iEditorMenu->AddItemL(item); |
|
775 } |
|
776 } |
|
777 |
|
778 if ( count > 0 ) |
|
779 { |
|
780 iEditorMenu->SetListColumnNumWithLafL(count); |
|
781 iEditorMenu->Display(Control(ECtrlIdIndicator)->Rect()); |
|
782 } |
|
783 } |
|
784 |
|
785 void CGenericItutWindow::ConstructL() |
|
786 { |
|
787 iBmpRotator = CPeninputSyncBitmapRotator::NewL(); |
|
788 CreateAllButtonL(); |
|
789 CreateItutKeypadL(); |
|
790 CreateICFL(); |
|
791 CreateMatchSelectionCtrlL(); |
|
792 |
|
793 AddEditorMenuL(); |
|
794 |
|
795 iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL( |
|
796 iLayoutOwner, |
|
797 ECtrlIdInputSwitch, |
|
798 EPluginInputModeItut ); |
|
799 iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub ); |
|
800 AddControlL( iInputModeSwitch ); |
|
801 |
|
802 |
|
803 iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine(); |
|
804 iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine(); |
|
805 |
|
806 iICF->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
807 iICF->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
808 //Change the ID when ID into release |
|
809 iICF->MsgBubbleCtrl()->SetBitmapParam(NULL, |
|
810 NULL, |
|
811 KAknsIIDQsnFrInputPreviewSideL, |
|
812 KAknsIIDQsnFrInputPreviewMiddle, |
|
813 KAknsIIDQsnFrInputPreviewSideR); |
|
814 iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
815 /* Teleca change start, 18.05.2009 ssal */ |
|
816 iICF->InfoBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
817 iICF->InfoBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
818 iICF->InfoBubbleCtrl()->SetBitmapParam(NULL, |
|
819 NULL, |
|
820 KAknsIIDQsnFrInputPreviewSideL, |
|
821 KAknsIIDQsnFrInputPreviewMiddle, |
|
822 KAknsIIDQsnFrInputPreviewSideR); |
|
823 iICF->SetInfoBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
824 } |
|
825 |
|
826 void CGenericItutWindow::AddControlL(CFepUiBaseCtrl* aControl) |
|
827 { |
|
828 iLayoutOwner->AddControlL(aControl); |
|
829 } |
|
830 |
|
831 void CGenericItutWindow::CreateChineseSpecificCtrlsIfNeededL() |
|
832 { |
|
833 if (iChnCtrlInited) |
|
834 { |
|
835 return; |
|
836 } |
|
837 |
|
838 CreateDropdownListL(); |
|
839 // create spell control for stroke/zhuyin |
|
840 TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESpellRect)); |
|
841 iSpell = CFepInputContextField::NewL(rect, iLayoutOwner, ECtrlIdSpellICF); |
|
842 |
|
843 iSpell->SetResourceId(R_FINGER_SPELL); |
|
844 ConstructSpellCtrlFromResourceL(); |
|
845 |
|
846 iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont))); |
|
847 AddControlL(iSpell); |
|
848 |
|
849 iSpell->Hide(ETrue); |
|
850 |
|
851 |
|
852 iChnCtrlInited = ETrue; |
|
853 } |
|
854 |
|
855 void CGenericItutWindow::ConstructSpellCtrlFromResourceL() |
|
856 { |
|
857 if (!iSpell || !iSpell->ResourceId()) |
|
858 { |
|
859 return; |
|
860 } |
|
861 |
|
862 TResourceReader spellreader; |
|
863 CCoeEnv::Static()->CreateResourceReaderLC(spellreader, iSpell->ResourceId()); |
|
864 |
|
865 TInt bgimgResId = spellreader.ReadInt32(); |
|
866 TResourceReader bgreader; |
|
867 CCoeEnv::Static()->CreateResourceReaderLC(bgreader, bgimgResId); |
|
868 |
|
869 TInt bmpid = bgreader.ReadInt16(); |
|
870 TInt maskbmpid = bgreader.ReadInt16(); |
|
871 TInt bmpskinid = bgreader.ReadInt16(); |
|
872 |
|
873 CFbsBitmap* bmp = NULL; |
|
874 CFbsBitmap* maskbmp = NULL; |
|
875 |
|
876 CreateLayoutIconL(KImageMajorSkinId, |
|
877 bmpskinid, |
|
878 KBmpFileName, |
|
879 bmpid, |
|
880 maskbmpid, |
|
881 bmp, |
|
882 maskbmp, |
|
883 iSpell->Rect().Size()); |
|
884 |
|
885 CleanupStack::PushL( bmp ); |
|
886 CleanupStack::PushL( maskbmp ); |
|
887 |
|
888 if (bmp) |
|
889 { |
|
890 iSpell->SetBackgroundBitmapL(bmp); |
|
891 } |
|
892 |
|
893 CleanupStack::PopAndDestroy( maskbmp ); |
|
894 CleanupStack::Pop( bmp ); |
|
895 |
|
896 CleanupStack::PopAndDestroy( 1 ); // bgreader |
|
897 |
|
898 TInt colorMajorSkinId = spellreader.ReadInt32(); |
|
899 TInt skinitemid= spellreader.ReadInt16(); |
|
900 TInt coloridx = spellreader.ReadInt16(); |
|
901 |
|
902 TAknsItemID colorid; |
|
903 colorid.Set(TInt(colorMajorSkinId), skinitemid); |
|
904 |
|
905 TRgb spelltextcolor; |
|
906 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
907 TInt error = AknsUtils::GetCachedColor(skininstance, |
|
908 spelltextcolor, |
|
909 colorid, |
|
910 coloridx); |
|
911 |
|
912 if (error != KErrNone) |
|
913 { |
|
914 spelltextcolor = TRgb(KDefaultSpellTextColor); |
|
915 } |
|
916 |
|
917 iSpell->SetTextColor(spelltextcolor); |
|
918 |
|
919 CleanupStack::PopAndDestroy( 1 ); // spellreader |
|
920 } |
|
921 |
|
922 |
|
923 TRgb CGenericItutWindow::GetMatchListTextColor() |
|
924 { |
|
925 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
926 TRgb matchlistcolor; |
|
927 TInt error = AknsUtils::GetCachedColor(skininstance, |
|
928 matchlistcolor, |
|
929 KAknsIIDQsnTextColors, |
|
930 EAknsCIQsnTextColorsCG43); |
|
931 |
|
932 if (error != KErrNone) |
|
933 { |
|
934 matchlistcolor = TRgb(KDefaultIcfTextColor); |
|
935 } |
|
936 |
|
937 return matchlistcolor; |
|
938 } |
|
939 |
|
940 void CGenericItutWindow::CreateMatchSelectionCtrlL() |
|
941 { |
|
942 // size and pos info of new match selection list should get from laf: later |
|
943 iMatchSelection = CFepLayoutScrollableList::NewL(iLayoutOwner, |
|
944 ECtrlIdMatchSelection, |
|
945 iDataMgr->iSelectionItemSize, |
|
946 iDataMgr->iSelectionHorMargin, |
|
947 iDataMgr->iSelectionVerMargin, |
|
948 iDataMgr->iSelectionNaviSize, |
|
949 iDataMgr->iSelectionNaviInnerSize); |
|
950 |
|
951 iMatchSelection->SetImgFrId(KAknsIIDQsnFrPopupSub, |
|
952 KAknsIIDQsnFrFunctionButtonNormal, |
|
953 KAknsIIDQsnFrFunctionButtonPressed, |
|
954 KAknsIIDQsnFrFunctionButtonInactive, |
|
955 KAknsIIDQsnFrList, |
|
956 KAknsIIDQsnFrPopupSub); |
|
957 CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
958 TRgb textcolor = GetMatchListTextColor(); |
|
959 |
|
960 iMatchSelection->SetTextProperty(itemfont, textcolor); |
|
961 iMatchSelection->SetResourceId(R_FINGER_SELECTION_LIST); |
|
962 iMatchSelection->ConstructFromResourceL(); |
|
963 iMatchSelection->SetTextLineLayout( iDataMgr->iSelectionTextLine ); |
|
964 iMatchSelection->SetPageInfoTextLineLayout( iDataMgr->iSelectionPageTextLine ); |
|
965 iMatchSelection->SetPageInfoResID( R_PENINPUT_SELECTION_LIST_PAGE_NUM ); |
|
966 AddControlL(iMatchSelection); |
|
967 } |
|
968 |
|
969 TInt CGenericItutWindow::OnAppEditorTextComing(const TFepInputContextFieldData& aData) |
|
970 { |
|
971 TRAPD(err, iICF->SetTextL(aData)); |
|
972 |
|
973 // make sure if selection list on top of multiline icf, |
|
974 // it will not be hidden by icf |
|
975 if (!iMatchSelection->Hiden()) |
|
976 { |
|
977 iMatchSelection->Draw(); |
|
978 } |
|
979 |
|
980 return err; |
|
981 } |
|
982 |
|
983 |
|
984 |
|
985 void CGenericItutWindow::SetIndicatorImageL(CFepUiBaseCtrl* aIndicator, |
|
986 const TInt aImgID1, |
|
987 const TInt aMaskID1, |
|
988 const TInt aImgID2, |
|
989 const TInt aMaskID2) |
|
990 { |
|
991 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
992 |
|
993 CFbsBitmap* bmp1 = NULL; |
|
994 CFbsBitmap* mask1 = NULL; |
|
995 |
|
996 TInt colorIndex; |
|
997 if (iLayoutOwner->UiMgr()->CurrentState()->StateType() == |
|
998 CGenericItutUiMgrBase::EStateSpelling) |
|
999 { |
|
1000 colorIndex = EAknsCIQsnIconColorsCG10; |
|
1001 } |
|
1002 else |
|
1003 { |
|
1004 colorIndex = EAknsCIQsnIconColorsCG30; |
|
1005 } |
|
1006 AknsUtils::CreateColorIconL(skininstance, |
|
1007 KAknsIIDQsnIconColors, |
|
1008 KAknsIIDQsnIconColors, |
|
1009 colorIndex, |
|
1010 bmp1, |
|
1011 mask1, |
|
1012 AknIconUtils::AvkonIconFileName(), |
|
1013 aImgID1, |
|
1014 aMaskID1, |
|
1015 KRgbGray); |
|
1016 CleanupStack::PushL( bmp1 ); |
|
1017 CleanupStack::PushL( mask1 ); |
|
1018 |
|
1019 AknIconUtils::GetContentDimensions(bmp1, iIndicatorSize); |
|
1020 |
|
1021 CFbsBitmap* bmp2 = NULL; |
|
1022 CFbsBitmap* mask2 = NULL; |
|
1023 AknsUtils::CreateColorIconL(skininstance, |
|
1024 KAknsIIDQsnIconColors, |
|
1025 KAknsIIDQsnIconColors, |
|
1026 colorIndex, |
|
1027 bmp2, |
|
1028 mask2, |
|
1029 AknIconUtils::AvkonIconFileName(), |
|
1030 aImgID2, |
|
1031 aMaskID2, |
|
1032 KRgbGray); |
|
1033 |
|
1034 CleanupStack::PushL( bmp2 ); |
|
1035 CleanupStack::PushL( mask2 ); |
|
1036 |
|
1037 AknIconUtils::GetContentDimensions(bmp2, iIndicatorTextSize); |
|
1038 |
|
1039 TRect boundRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EImIndicatorRect)); |
|
1040 TRect imgrect, textrect; |
|
1041 |
|
1042 if (aIndicator->ControlId() == ECtrlIdIndicator) |
|
1043 { |
|
1044 CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter); |
|
1045 AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved); |
|
1046 AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved); |
|
1047 AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved); |
|
1048 AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved); |
|
1049 |
|
1050 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256); |
|
1051 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
|
1052 |
|
1053 TInt bigger = imgrect.Height() > textrect.Height() ? imgrect.Height() : textrect.Height(); |
|
1054 TRect indirect(imgrect.iTl, TSize(imgrect.Width() + textrect.Width(), bigger)); |
|
1055 // button like indicator |
|
1056 CAknFepCtrlCommonButton* indibtn = static_cast<CAknFepCtrlCommonButton*>(aIndicator); |
|
1057 TRect outerrect = |
|
1058 TItutDataConverter::AnyToRect(iDataMgr->RequestData(EImIndicatorOuterRect)); |
|
1059 /*if (IsChineseMode()) |
|
1060 { |
|
1061 indirect.Move( TPoint(0 , 0)); |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 indirect.Move(TPoint( -20 ,0));// |
|
1066 } |
|
1067 */ |
|
1068 indibtn->SetForgroundBmpRect(indirect); |
|
1069 indibtn->SetForegroundBmpL(bmp3, mask3); |
|
1070 indibtn->SetRect(outerrect); |
|
1071 //indibtn->Hide(EFalse); |
|
1072 } |
|
1073 else |
|
1074 { |
|
1075 CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignRight); |
|
1076 AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved); |
|
1077 AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved); |
|
1078 AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved); |
|
1079 AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved); |
|
1080 |
|
1081 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256); |
|
1082 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
|
1083 |
|
1084 TInt bigger = imgrect.Height() > textrect.Height() ? imgrect.Height() : textrect.Height(); |
|
1085 TRect indirect(imgrect.iTl, TSize(imgrect.Width() + textrect.Width(), bigger)); |
|
1086 |
|
1087 // label like indicator |
|
1088 CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>(aIndicator); |
|
1089 indilabel->SetBitmapL(bmp3); |
|
1090 indilabel->SetMaskBitmapL(mask3); |
|
1091 indilabel->SetRect(indirect); |
|
1092 //indilabel->Hide(EFalse); |
|
1093 } |
|
1094 |
|
1095 CleanupStack::PopAndDestroy( mask2 ); |
|
1096 CleanupStack::PopAndDestroy( bmp2 ); |
|
1097 CleanupStack::PopAndDestroy( mask1 ); |
|
1098 CleanupStack::PopAndDestroy( bmp1 ); |
|
1099 } |
|
1100 |
|
1101 |
|
1102 void CGenericItutWindow::UpdateIndicatorL(TUint8* aData) |
|
1103 { |
|
1104 if ( iLayoutOwner->UiMgr()->CurrentState()->StateType() == |
|
1105 CGenericItutUiMgrBase::EStateComposition || |
|
1106 iLayoutOwner->UiMgr()->CurrentState()->StateType() == |
|
1107 CGenericItutUiMgrBase::EStatePredict ) |
|
1108 { |
|
1109 return; |
|
1110 } |
|
1111 |
|
1112 RDesReadStream readStream; |
|
1113 |
|
1114 TFepIndicatorInfo indicatorData; |
|
1115 |
|
1116 TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) ); |
|
1117 readStream.Open(countPtr); |
|
1118 CleanupClosePushL(readStream); |
|
1119 |
|
1120 indicatorData.iIndicatorImgID = readStream.ReadInt32L(); |
|
1121 indicatorData.iIndicatorMaskID = readStream.ReadInt32L(); |
|
1122 indicatorData.iIndicatorTextImgID = readStream.ReadInt32L(); |
|
1123 indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L(); |
|
1124 |
|
1125 CleanupStack::PopAndDestroy(&readStream); |
|
1126 |
|
1127 if (indicatorData.iIndicatorImgID != 0 && |
|
1128 indicatorData.iIndicatorMaskID != 0 && |
|
1129 indicatorData.iIndicatorTextImgID != 0 && |
|
1130 indicatorData.iIndicatorTextMaskID != 0) |
|
1131 { |
|
1132 iDataMgr->SetIndicatorData(indicatorData); |
|
1133 iImDimensionSet = ETrue; |
|
1134 |
|
1135 |
|
1136 CFepUiBaseCtrl* temp = NULL; |
|
1137 |
|
1138 |
|
1139 if (iLayoutOwner->UiMgr()->CurrentState()->StateType() == |
|
1140 CGenericItutUiMgrBase::EStateSpelling) |
|
1141 { |
|
1142 temp = Control(ECtrlIdSpellIndicator); |
|
1143 Control(ECtrlIdIndicator)->Hide(ETrue); |
|
1144 SetIndicatorImageL(temp, |
|
1145 indicatorData.iIndicatorImgID, |
|
1146 indicatorData.iIndicatorMaskID, |
|
1147 indicatorData.iIndicatorTextImgID, |
|
1148 indicatorData.iIndicatorTextMaskID); |
|
1149 if( temp->Hiden() ) |
|
1150 { |
|
1151 temp->Hide( EFalse ); |
|
1152 } |
|
1153 else |
|
1154 { |
|
1155 iLayoutOwner->RootControl()->ReDrawRect(temp->Rect()); |
|
1156 iLayoutOwner->RootControl()->UpdateArea( temp->Rect() ); |
|
1157 } |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 temp = Control(ECtrlIdIndicator); |
|
1162 Control(ECtrlIdSpellIndicator)->Hide(ETrue); |
|
1163 SetIndicatorImageL(temp, |
|
1164 indicatorData.iIndicatorImgID, |
|
1165 indicatorData.iIndicatorMaskID, |
|
1166 indicatorData.iIndicatorTextImgID, |
|
1167 indicatorData.iIndicatorTextMaskID); |
|
1168 if( temp->Hiden() ) |
|
1169 { |
|
1170 temp->Hide( EFalse ); |
|
1171 } |
|
1172 else |
|
1173 { |
|
1174 temp->ClearRect( temp->Rect() ); |
|
1175 temp->Draw(); |
|
1176 temp->UpdateArea( temp->Rect() ); |
|
1177 iLayoutOwner->RootControl()->ReDrawRect( temp->Rect() ); |
|
1178 } |
|
1179 } |
|
1180 } |
|
1181 } |
|
1182 |
|
1183 void CGenericItutWindow::CalIndicatorRect(const TRect& aBoundRect, |
|
1184 TRect& aRealRect1, |
|
1185 TRect& aRealRect2, |
|
1186 TIndicatorAlign aAlign) |
|
1187 { |
|
1188 if (!iImDimensionSet) |
|
1189 { |
|
1190 return; |
|
1191 } |
|
1192 |
|
1193 TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight; |
|
1194 TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight; |
|
1195 TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, |
|
1196 aBoundRect.Size().iHeight ); |
|
1197 TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, |
|
1198 aBoundRect.Size().iHeight ); |
|
1199 // check if the length of img > bound rect width |
|
1200 TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth; |
|
1201 if( nTotalWidth > aBoundRect.Size().iWidth ) |
|
1202 { |
|
1203 TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth; |
|
1204 imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect; |
|
1205 imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth; |
|
1206 imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText; |
|
1207 // make sure the height of two rect is equal |
|
1208 imgSizeIndi.iHeight = imgSizeText.iHeight; |
|
1209 |
|
1210 /* TInt n = (nTotalWidth - aBoundRect.Size().iWidth) / 2; |
|
1211 imgSizeText.iWidth -= n; |
|
1212 imgSizeIndi.iWidth -= n; |
|
1213 imgSizeText.iHeight -= n / imgAspectText; |
|
1214 imgSizeIndi.iHeight -= n / imgAspectIndi; |
|
1215 */ |
|
1216 } |
|
1217 if( aAlign == EIndiAlignRight ) |
|
1218 { |
|
1219 aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY), |
|
1220 imgSizeText); |
|
1221 aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
1222 imgSizeIndi); |
|
1223 } |
|
1224 else if( aAlign == EIndiAlignCenter ) |
|
1225 { |
|
1226 TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2; |
|
1227 TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2; |
|
1228 aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, |
|
1229 aBoundRect.iTl.iY + offsetY), |
|
1230 imgSizeText ); |
|
1231 aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
1232 imgSizeIndi ); |
|
1233 } |
|
1234 else if( aAlign == EIndiAlignLeft ) |
|
1235 { |
|
1236 aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi ); |
|
1237 aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText ); |
|
1238 } |
|
1239 } |
|
1240 |
|
1241 void CGenericItutWindow::SetPromptTextL(TUint8* aData) |
|
1242 { |
|
1243 RDesReadStream readStream; |
|
1244 |
|
1245 TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt)); |
|
1246 readStream.Open(countPtr); |
|
1247 CleanupClosePushL(readStream); |
|
1248 const TInt dataCount = readStream.ReadInt32L(); |
|
1249 const TInt textCount = readStream.ReadInt32L(); |
|
1250 CleanupStack::PopAndDestroy(&readStream); |
|
1251 |
|
1252 TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
1253 readStream.Open(ptr); |
|
1254 CleanupClosePushL(readStream); |
|
1255 |
|
1256 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
1257 TPtr8 dataBufPtr = dataBuf->Des(); |
|
1258 readStream.ReadL(dataBufPtr, dataCount); |
|
1259 |
|
1260 TFepPromptText* pIcfData = |
|
1261 reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
1262 |
|
1263 HBufC* textBuf; |
|
1264 if (textCount > 0) |
|
1265 { |
|
1266 textBuf = HBufC::NewLC(textCount/2); |
|
1267 TPtr textBufPtr = textBuf->Des(); |
|
1268 readStream.ReadL(textBufPtr, textCount/2); |
|
1269 |
|
1270 const HBufC* icfPromptText = iICF->PromptText(); |
|
1271 |
|
1272 if (!icfPromptText || icfPromptText->Compare(textBuf->Des()) != 0 ) |
|
1273 { |
|
1274 iICF->SetPromptTextL( textBuf->Des(), pIcfData->iCleanContent ); |
|
1275 } |
|
1276 |
|
1277 CleanupStack::PopAndDestroy(textBuf); |
|
1278 } |
|
1279 else |
|
1280 { |
|
1281 iICF->SetPromptTextL(KNullDesC, pIcfData->iCleanContent); |
|
1282 } |
|
1283 |
|
1284 CleanupStack::PopAndDestroy(dataBuf); |
|
1285 CleanupStack::PopAndDestroy(&readStream); |
|
1286 } |
|
1287 |
|
1288 TInt CGenericItutWindow::PenInputType() |
|
1289 { |
|
1290 return EPluginInputModeItut; |
|
1291 } |
|
1292 |
|
1293 void CGenericItutWindow::SetCtrlRect(CFepUiBaseCtrl* aCtrl, TInt aRectIdx) |
|
1294 { |
|
1295 aCtrl->SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectIdx))); |
|
1296 } |
|
1297 |
|
1298 TInt CGenericItutWindow::SizeChanged(TBool aIcfOverlap) |
|
1299 { |
|
1300 // resize all controls |
|
1301 SetCtrlRect(iStandardItutKp, EKeypadRect); |
|
1302 |
|
1303 iStandardItutKp->SetTextLineLayout( |
|
1304 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)), |
|
1305 EPosLeft); |
|
1306 iStandardItutKp->SetTextLineLayout( |
|
1307 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)), |
|
1308 EPosRight1); |
|
1309 iStandardItutKp->SetTextLineLayout( |
|
1310 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
|
1311 EPosRight2); |
|
1312 iStandardItutKp->SetTextLineLayout( |
|
1313 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
|
1314 EPosRight3); |
|
1315 |
|
1316 RPointerArray<CVirtualKey>& keys = |
|
1317 const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray()); |
|
1318 RArray<TRect>& cellRects = |
|
1319 TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects)); |
|
1320 |
|
1321 for (TInt i = 0 ; i < keys.Count(); i++) |
|
1322 { |
|
1323 keys[i]->SetRect(cellRects[i]); |
|
1324 TRect innerrect = cellRects[i]; |
|
1325 innerrect.Shrink(TSize(4, 4)); |
|
1326 keys[i]->SetInnerRect(innerrect); |
|
1327 } |
|
1328 // set key background image size |
|
1329 TSize curSize = cellRects[0].Size(); |
|
1330 if( iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal) ) |
|
1331 { |
|
1332 TSize size = iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels(); |
|
1333 if( curSize != size ) |
|
1334 { |
|
1335 for ( TInt i = 0; i <= EKeyBmpLastType; i++ ) |
|
1336 { |
|
1337 if( iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) ) |
|
1338 { |
|
1339 AknIconUtils::SetSize( |
|
1340 iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), |
|
1341 curSize, EAspectRatioNotPreserved ); |
|
1342 } |
|
1343 } |
|
1344 } |
|
1345 } |
|
1346 iMatchSelection->SetPageInfoTextLineLayout( iDataMgr->iSelectionPageTextLine ); |
|
1347 iMatchSelection->SizeChanged( |
|
1348 iDataMgr->iSelectionItemSize, |
|
1349 iDataMgr->iSelectionHorMargin, |
|
1350 iDataMgr->iSelectionVerMargin, |
|
1351 iDataMgr->iSelectionNaviSize, |
|
1352 iDataMgr->iSelectionNaviInnerSize); |
|
1353 |
|
1354 // should set textline when it is defined in laf |
|
1355 CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
1356 TRgb textcolor = GetMatchListTextColor(); |
|
1357 iMatchSelection->SetTextProperty( |
|
1358 TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)), GetMatchListTextColor()); |
|
1359 |
|
1360 iBackgroundCtrl->SizeChanged( |
|
1361 TItutDataConverter::AnyToRect(iDataMgr->RequestData( ELayoutRect ) ) ); |
|
1362 iBackgroundCtrl->GetSubBgItem(0).iRect = TItutDataConverter::AnyToRect( |
|
1363 iDataMgr->RequestData(ESpellQueryPaneRect) ); |
|
1364 |
|
1365 TRAP_IGNORE(ApplyVariantLafDataL(ETrue); |
|
1366 iLayoutOwner->HandleCommand(EItutExtCmdSizeChanged, NULL)); |
|
1367 |
|
1368 |
|
1369 if (iChnCtrlInited) |
|
1370 { |
|
1371 SetCtrlRect(iSpell, ESpellRect); |
|
1372 iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont))); |
|
1373 |
|
1374 ResizeCandidateList(iSpellCandsList, EDropdownListSpellLTPos, ETrue); |
|
1375 ResizeCandidateList(iCandsList, EDropdownListCandsLTPos, ETrue); |
|
1376 ResizeCandidateList(iPuncCandsList, EDropdownListPuncLTPos, EFalse); |
|
1377 } |
|
1378 |
|
1379 if (aIcfOverlap && !iMatchSelection->Hiden()) |
|
1380 { |
|
1381 iICF->SetOverLapState(ETrue, iMatchSelection->Rect()); |
|
1382 } |
|
1383 |
|
1384 return KErrNone; |
|
1385 } |
|
1386 |
|
1387 TBool CGenericItutWindow::ControlSizeChanged(const TInt aControlId, |
|
1388 const TInt aRect, |
|
1389 const TInt aInnerRect, |
|
1390 TBool aIsReloadImages) |
|
1391 { |
|
1392 CAknFepCtrlCommonButton* temp = CommonButtonControl(aControlId); |
|
1393 if( !temp ) |
|
1394 return EFalse; |
|
1395 |
|
1396 |
|
1397 TRect rect; |
|
1398 TRect innerRect; |
|
1399 |
|
1400 rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRect)); |
|
1401 innerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRect)); |
|
1402 |
|
1403 TBool bSizedChanged = (rect.Size() != temp->Rect().Size()) && |
|
1404 (innerRect.Size() != temp->ForgroundBmpRect().Size()); |
|
1405 temp->SizeChanged(rect, innerRect, aIsReloadImages); |
|
1406 |
|
1407 return bSizedChanged; |
|
1408 } |
|
1409 |
|
1410 void CGenericItutWindow::ApplyVariantLafDataL(TBool aResolutionChange) |
|
1411 { |
|
1412 if (aResolutionChange) |
|
1413 { |
|
1414 CAknFepCtrlCommonButton* indibutton = CommonButtonControl(ECtrlIdIndicator); |
|
1415 |
|
1416 SetIndicatorImageL(indibutton, |
|
1417 iDataMgr->IndicatorData().iIndicatorImgID, |
|
1418 iDataMgr->IndicatorData().iIndicatorMaskID, |
|
1419 iDataMgr->IndicatorData().iIndicatorTextImgID, |
|
1420 iDataMgr->IndicatorData().iIndicatorTextMaskID); |
|
1421 } |
|
1422 |
|
1423 CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
1424 iICF->Hide(ETrue); |
|
1425 |
|
1426 if( iDataMgr->IsChinese() ) |
|
1427 { |
|
1428 iICF->SetTextMargin ( iDataMgr->iIcfTextLeftMarginCn, |
|
1429 iDataMgr->iIcfTextRightMarginCn, |
|
1430 iDataMgr->iIcfTextTopMarginCn, |
|
1431 iDataMgr->iIcfTextBottomMarginCn ); |
|
1432 |
|
1433 iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMarginCn ); |
|
1434 |
|
1435 iICF->SizeChangedL(TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)), |
|
1436 //icffont->HeightInPixels(), |
|
1437 iDataMgr->iIcfTextHeightCn, |
|
1438 icffont->FontMaxHeight(), |
|
1439 icffont); |
|
1440 } |
|
1441 else |
|
1442 { |
|
1443 iICF->SetTextMargin ( iDataMgr->iIcfTextLeftMargin, |
|
1444 iDataMgr->iIcfTextRightMargin, |
|
1445 iDataMgr->iIcfTextTopMargin, |
|
1446 iDataMgr->iIcfTextBottomMargin ); |
|
1447 |
|
1448 iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin ); |
|
1449 |
|
1450 iICF->SizeChangedL(TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)), |
|
1451 //icffont->HeightInPixels(), |
|
1452 iDataMgr->iIcfTextHeight, |
|
1453 icffont->FontMaxHeight(), |
|
1454 icffont); |
|
1455 } |
|
1456 |
|
1457 iICF->Hide(EFalse); |
|
1458 |
|
1459 if( iDataMgr->IsChinese() ) |
|
1460 { |
|
1461 ControlSizeChanged(ECtrlIdArrowUp, EArrowUpRect, EUpInnerRect, ETrue); |
|
1462 ControlSizeChanged(ECtrlIdArrowDown, EArrowDownRect, EDownInnerRect, ETrue); |
|
1463 } |
|
1464 |
|
1465 TBool bSizeChanged = EFalse; |
|
1466 ControlSizeChanged(ECtrlIdArrowLeft, EArrowLeftRect, ELeftInnerRect, ETrue); |
|
1467 ControlSizeChanged(ECtrlIdArrowRight, EArrowRightRect, ERightInnerRect, ETrue); |
|
1468 ControlSizeChanged(ECtrlIdSwitch, ESwitchRect, ESwitchInnerRect, ETrue); |
|
1469 bSizeChanged = ControlSizeChanged(ECtrlIdBackspace, EBackspaceRect, EBackspaceInnerRect, ETrue); |
|
1470 ControlSizeChanged(ECtrlIdOptions, EOptionsRect, EOptionInnerRect, ETrue); |
|
1471 ControlSizeChanged(ECtrlIdClose, ECloseRect, ECloseInnerRect, ETrue); |
|
1472 |
|
1473 // resize all controls |
|
1474 SetCtrlRect(iStandardItutKp, EKeypadRect); |
|
1475 |
|
1476 // Handle control res when language direction changing here. |
|
1477 if( iDataMgr->IsLangDirectionSwitch() || |
|
1478 ( bSizeChanged && iDataMgr->IsRtoLLanguage() ) ) |
|
1479 { |
|
1480 HandleButtonResOnLangDirChange( ECtrlIdBackspace ); |
|
1481 iDataMgr->SetLangDirectionSwitch( EFalse ); |
|
1482 } |
|
1483 } |
|
1484 |
|
1485 void CGenericItutWindow::ResizeCandidateList(CFepCtrlDropdownList* aList, |
|
1486 TInt aLTPosIdx, TBool aExpandable) |
|
1487 { |
|
1488 if (!aList) |
|
1489 { |
|
1490 return; |
|
1491 } |
|
1492 |
|
1493 TInt unitWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth)); |
|
1494 TInt unitHeight = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitHeight)); |
|
1495 TInt horizontalMargin = |
|
1496 TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin)); |
|
1497 TInt verticalMargin = |
|
1498 TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin)); |
|
1499 //TInt naviWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListNaviWidth)); |
|
1500 TInt naviWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth)); |
|
1501 CFont* listfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EDropdownListFont)); |
|
1502 TPoint listLTPos = TItutDataConverter::AnyToPoint(iDataMgr->RequestData(aLTPosIdx)); |
|
1503 |
|
1504 aList->SizeChanged(unitWidth, |
|
1505 unitHeight, |
|
1506 naviWidth, |
|
1507 listLTPos); |
|
1508 |
|
1509 aList->SetCellMargin(horizontalMargin, verticalMargin); |
|
1510 |
|
1511 if (aExpandable) |
|
1512 { |
|
1513 TInt naviSpinBtnHeight = |
|
1514 TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListSpinBtnHeight)); |
|
1515 |
|
1516 aList->SetSpinBtnHeight(naviSpinBtnHeight); |
|
1517 } |
|
1518 } |
|
1519 |
|
1520 void CGenericItutWindow::OnSkinChange() |
|
1521 { |
|
1522 CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
1523 TRgb textcolor = GetMatchListTextColor(); |
|
1524 iMatchSelection->SetTextProperty(itemfont, textcolor); |
|
1525 |
|
1526 // when skin change all control with skin image should be reload. |
|
1527 TRAP_IGNORE(ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP )); |
|
1528 |
|
1529 // reconstruct shift icon when skin changed |
|
1530 TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ReConstructL()); |
|
1531 TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ResizeL(iDataMgr->iShiftIconRect.Size())); |
|
1532 |
|
1533 //Skin change will case the reconstuction of the button graphic. |
|
1534 //When language is RToL, it should be mirrored again. |
|
1535 if( iDataMgr->IsRtoLLanguage() ) |
|
1536 { |
|
1537 HandleButtonResOnLangDirChange( ECtrlIdBackspace ); |
|
1538 } |
|
1539 } |
|
1540 |
|
1541 |
|
1542 void CGenericItutWindow::CalculateFrameRects(const TRect aRect, |
|
1543 TRect& aOuterRect, |
|
1544 TRect& aInnerRect ) |
|
1545 { |
|
1546 TRect windowRect = aRect; |
|
1547 |
|
1548 TAknLayoutRect topLeft; |
|
1549 topLeft.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_2()); |
|
1550 |
|
1551 TAknLayoutRect bottomRight; |
|
1552 bottomRight.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_5()); |
|
1553 |
|
1554 aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
|
1555 aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
|
1556 } |
|
1557 |
|
1558 void CGenericItutWindow::EnterMatchSelectionState(TBool aOn) |
|
1559 { |
|
1560 TBuf<4> buf; |
|
1561 buf.Append(reinterpret_cast<TText*>(&aOn), sizeof(TBool)/sizeof(TText)); |
|
1562 iLayoutOwner->SignalOwner(ESignalEnterMatchSelection, buf); |
|
1563 } |
|
1564 |
|
1565 void CGenericItutWindow::ResetIndicatorL(CFepUiBaseCtrl* aIndicator) |
|
1566 { |
|
1567 SetIndicatorImageL(aIndicator, |
|
1568 iDataMgr->IndicatorData().iIndicatorImgID, |
|
1569 iDataMgr->IndicatorData().iIndicatorMaskID, |
|
1570 iDataMgr->IndicatorData().iIndicatorTextImgID, |
|
1571 iDataMgr->IndicatorData().iIndicatorTextMaskID); |
|
1572 } |
|
1573 |
|
1574 CAknFepCtrlCommonButton* CGenericItutWindow::CommonButtonControl(const TInt aControlId) |
|
1575 { |
|
1576 CFepUiBaseCtrl* ctrl = NULL; |
|
1577 ctrl = Control(aControlId); |
|
1578 |
|
1579 if (!ctrl) |
|
1580 { |
|
1581 return NULL; |
|
1582 } |
|
1583 |
|
1584 if (!ctrl->IsKindOfControl(ECtrlButton)) |
|
1585 |
|
1586 { |
|
1587 return NULL; |
|
1588 } |
|
1589 |
|
1590 return static_cast<CAknFepCtrlCommonButton*>(ctrl); |
|
1591 } |
|
1592 |
|
1593 void CGenericItutWindow::DisplayInputmodeSwitchL() |
|
1594 { |
|
1595 TRect rect = Control(ECtrlIdSwitch)->Rect(); |
|
1596 |
|
1597 TRAP_IGNORE( iInputModeSwitch->PopUpSwitchListL(rect) ); |
|
1598 } |
|
1599 |
|
1600 CFepUiBaseCtrl* CGenericItutWindow::Control(const TInt aCtrlId) |
|
1601 { |
|
1602 CFepUiBaseCtrl* ctrl = NULL; |
|
1603 RPointerArray<CFepUiBaseCtrl> todo; |
|
1604 TInt current = 0; |
|
1605 TBool found = EFalse; |
|
1606 |
|
1607 todo.Append(iLayoutOwner->RootControl()); |
|
1608 CControlGroup* temp; |
|
1609 |
|
1610 while (current < todo.Count() && !found) |
|
1611 { |
|
1612 ctrl = todo[current]; |
|
1613 |
|
1614 if(ctrl->ControlId() == aCtrlId) //Find control |
|
1615 { |
|
1616 found = ETrue; |
|
1617 } |
|
1618 else |
|
1619 { |
|
1620 if(ctrl->IsKindOfControl(ECtrlControlGroup)) |
|
1621 { |
|
1622 temp = static_cast<CControlGroup*>(ctrl); |
|
1623 for (int i = 0; i < temp->NumOfControls(); i++) |
|
1624 { |
|
1625 todo.Append(temp->At(i)); |
|
1626 } |
|
1627 } |
|
1628 |
|
1629 current++; |
|
1630 } |
|
1631 } |
|
1632 |
|
1633 todo.Close(); |
|
1634 |
|
1635 return found ? ctrl : NULL; |
|
1636 } |
|
1637 |
|
1638 TBool CGenericItutWindow::IsChineseMode() |
|
1639 { |
|
1640 TInt immode = iDataMgr->InputMode(); |
|
1641 TBool chineseMode = EFalse; |
|
1642 |
|
1643 if (immode == EPinyin || immode == EStroke || immode == EZhuyin) |
|
1644 { |
|
1645 chineseMode = ETrue; |
|
1646 } |
|
1647 |
|
1648 return chineseMode; |
|
1649 } |
|
1650 |
|
1651 void CGenericItutWindow::ConstructKeyImageFromResourceL( TInt aKeyImageResID ) |
|
1652 { |
|
1653 TResourceReader reader; |
|
1654 CCoeEnv::Static()->CreateResourceReaderLC( reader, aKeyImageResID ); |
|
1655 |
|
1656 TPtrC bmpFileName = reader.ReadTPtrC(); |
|
1657 TInt32 imgMajorSkinId = reader.ReadInt32(); |
|
1658 TAknsItemID id; |
|
1659 |
|
1660 RArray<TRect>& cellRects = |
|
1661 TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects)); |
|
1662 TSize keySize = cellRects[0].Size(); |
|
1663 for (TInt index = 0; index <= EKeyBmpLastType ; index += 2) |
|
1664 { |
|
1665 // Get the image ids and mask ids from resource |
|
1666 TInt bmpId = reader.ReadInt16(); |
|
1667 TInt bmpMskId = reader.ReadInt16(); |
|
1668 |
|
1669 // read skin item id |
|
1670 const TInt skinitemid = reader.ReadInt16(); |
|
1671 id.Set(TInt(imgMajorSkinId), skinitemid); |
|
1672 |
|
1673 if (bmpId != KInvalidBmp) |
|
1674 { |
|
1675 CFbsBitmap* bmp = NULL; |
|
1676 CFbsBitmap* maskbmp = NULL; |
|
1677 |
|
1678 if (bmpMskId != KInvalidBmp) |
|
1679 { |
|
1680 AknsUtils::CreateIconL(AknsUtils::SkinInstance(), |
|
1681 id, |
|
1682 bmp, |
|
1683 maskbmp, |
|
1684 bmpFileName, |
|
1685 bmpId, |
|
1686 bmpMskId); |
|
1687 |
|
1688 // set maskbmp and size |
|
1689 AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved ); |
|
1690 iStandardItutKp->SetNonIrregularKeyBitmapL( |
|
1691 TVirtualKeyBmpType(EKeyBmpNormal + index + 1), maskbmp ); |
|
1692 } |
|
1693 else |
|
1694 { |
|
1695 AknsUtils::CreateIconL(AknsUtils::SkinInstance(), |
|
1696 id, |
|
1697 bmp, |
|
1698 bmpFileName, |
|
1699 bmpId); |
|
1700 } |
|
1701 // set bmp and size |
|
1702 AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved ); |
|
1703 iStandardItutKp->SetNonIrregularKeyBitmapL( |
|
1704 TVirtualKeyBmpType(EKeyBmpNormal + index), bmp ); |
|
1705 } |
|
1706 } |
|
1707 // Pop and destroy reader |
|
1708 CleanupStack::PopAndDestroy( 1 ); |
|
1709 } |
|
1710 |
|
1711 void CGenericItutWindow::HandleButtonResOnLangDirChange( TInt aControlId ) |
|
1712 { |
|
1713 TRAP_IGNORE(HandleButtonResOnLangDirChangeL(aControlId)); |
|
1714 } |
|
1715 void CGenericItutWindow::HandleButtonResOnLangDirChangeL( TInt aControlId ) |
|
1716 { |
|
1717 CAknFepCtrlCommonButton* ctrl = CommonButtonControl(aControlId); |
|
1718 if( ctrl && iBmpRotator) |
|
1719 { |
|
1720 TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis; |
|
1721 User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmp() , |
|
1722 rotChoice ) ); |
|
1723 User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmpMask() , |
|
1724 rotChoice ) ); |
|
1725 } |
|
1726 } |
|
1727 |
|
1728 void CGenericItutWindow::SetHardKeyOneSymbol(TUint8* aData) |
|
1729 { |
|
1730 TRAP_IGNORE(SetHardKeyOneSymbolL(aData)); |
|
1731 } |
|
1732 void CGenericItutWindow::SetHardKeyOneSymbolL(TUint8* aData) |
|
1733 { |
|
1734 //Read stream |
|
1735 RDesReadStream readStream; |
|
1736 |
|
1737 TPtr8 countPtr( aData, 3*sizeof(TInt), 3*sizeof(TInt) ); |
|
1738 readStream.Open(countPtr); |
|
1739 CleanupClosePushL(readStream); |
|
1740 |
|
1741 iSymbolData.iSymbol1 = readStream.ReadInt32L(); |
|
1742 iSymbolData.iSymbol2 = readStream.ReadInt32L(); |
|
1743 iSymbolData.iSymbol3 = readStream.ReadInt32L(); |
|
1744 |
|
1745 CleanupStack::PopAndDestroy(&readStream); |
|
1746 } |
|
1747 |
|
1748 void CGenericItutWindow::SetUnicodesForHardKey1(CVirtualKey* aKey, const TDesC& aMapData) |
|
1749 { |
|
1750 TRAP_IGNORE(SetUnicodesForHardKey1L(aKey, aMapData)); |
|
1751 } |
|
1752 void CGenericItutWindow::SetUnicodesForHardKey1L(CVirtualKey* aKey, const TDesC& aMapData) |
|
1753 { |
|
1754 RPointerArray<HBufC> unicodesArr1; |
|
1755 RArray<TInt> unicodesInt; |
|
1756 |
|
1757 unicodesInt.Append(iSymbolData.iSymbol1); |
|
1758 unicodesInt.Append(iSymbolData.iSymbol2); |
|
1759 unicodesInt.Append(iSymbolData.iSymbol3); |
|
1760 |
|
1761 TInt curMode = TItutDataConverter::AnyToInt( |
|
1762 iLayoutOwner->DataMgr()->RequestData(EInputMode)); |
|
1763 |
|
1764 TInt curLang = TItutDataConverter::AnyToInt( |
|
1765 iLayoutOwner->DataMgr()->RequestData(ELanguage)); |
|
1766 |
|
1767 TInt latinOnly = TItutDataConverter::AnyToInt( |
|
1768 iLayoutOwner->DataMgr()->RequestData(ELatinOnly)); |
|
1769 |
|
1770 HBufC* symbols = HBufC::NewL( 20 ); |
|
1771 for (TInt i = 0; i <= 2; i++) |
|
1772 { |
|
1773 symbols->Des().Append( unicodesInt[i] ); |
|
1774 if (EHindi == curMode || |
|
1775 (ELatin == curMode && curLang == ELangThai && !latinOnly)) |
|
1776 { |
|
1777 continue; |
|
1778 } |
|
1779 else |
|
1780 { |
|
1781 symbols->Des().Append( KSpaceUnicode ); |
|
1782 } |
|
1783 } |
|
1784 |
|
1785 HBufC* number = HBufC::NewL( 1 ); |
|
1786 number->Des().Append( aMapData ); |
|
1787 unicodesArr1.AppendL(number); |
|
1788 unicodesArr1.AppendL(symbols); |
|
1789 |
|
1790 aKey->SetUnicodesL(unicodesArr1); |
|
1791 |
|
1792 unicodesArr1.Close(); |
|
1793 unicodesInt.Close(); |
|
1794 |
|
1795 } |
|
1796 // End Of File |