|
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: Implementation of vkb window class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 |
|
21 |
|
22 #include <peninputvkbwindow.rsg> |
|
23 #include <peninputvkbwindowconfiginfo_01.rsg> |
|
24 #include <aknfeppeninputenums.h> |
|
25 #include <peninputinputcontextfield.h> |
|
26 #include <peninputpluginutils.h> |
|
27 #include <peninputcommonlayoutext.h> |
|
28 #include <peninputvkbctrllayout.h> |
|
29 #include <peninputvkbctrlext.h> |
|
30 #include <peninputeventbutton.h> |
|
31 #include <peninputdragbutton.h> |
|
32 #include <peninputrepeatbutton.h> |
|
33 #include <peninputmultimodebutton.h> |
|
34 #include <peninputrangebar.h> |
|
35 #include <peninputdataconverter.h> |
|
36 #include <peninputdataprovider.h> |
|
37 #include <peninputclientlayoutinfo.h> |
|
38 #include <peninputlayoutchoicelist.h> |
|
39 #include <peninputlongpressbutton.h> |
|
40 #include <bautils.h> |
|
41 #include <aknlayoutscalable_apps.cdl.h> |
|
42 #include <peninputlayoutbubblectrl.h> |
|
43 #include <peninputscrollablelist.h> |
|
44 |
|
45 #include <e32keys.h> |
|
46 #include <AknIconUtils.h> |
|
47 #include <AknLayoutDef.h> |
|
48 #include <AknUtils.h> |
|
49 #include <aknlayoutscalable_avkon.cdl.h> |
|
50 #include <AknsUtils.h> |
|
51 #include <AknFepGlobalEnums.h> |
|
52 #include <peninputlayoutinputmodechoice.h> |
|
53 #include <peninputlayoutmultilineicf.h> |
|
54 #include <s32mem.h> |
|
55 // User includes |
|
56 #include "peninputgenericvkb.hrh" |
|
57 #include "peninputgenericvkbwindow.h" |
|
58 #include "peninputgenericvkbenum.h" |
|
59 #include "peninputrangebarinfo.h" |
|
60 #include "peninputgenericvkblafdatamgr.h" |
|
61 #include "peninputgenericvkblangmeritpair.h" |
|
62 #include "peninputgenericvkblayout.h" |
|
63 |
|
64 // Constants |
|
65 const TInt KPeninputVkbWndInvalidIndex = -1; |
|
66 const TInt KInvalidImg = -1 ; |
|
67 const TInt KKeyCodeSize = 1; |
|
68 |
|
69 const TInt KTooltipLeftMargin = 10; |
|
70 const TInt KTooltipTopMargin = 0; |
|
71 const TInt KTooltipRightMargin = 10; |
|
72 const TInt KTooltipBottomMargin = 0; |
|
73 |
|
74 _LIT( KVkbWindowResourceFile, |
|
75 "z:\\resource\\plugins\\peninputvkbwindow.RSC" ); |
|
76 _LIT( KConfigurationResourceFile, |
|
77 "z:\\resource\\plugins\\peninputvkbwindowconfiginfo_" ); |
|
78 _LIT( KResourceFileExtName, ".RSC" ); |
|
79 |
|
80 _LIT(KEmptyString, ""); |
|
81 |
|
82 // ======== MEMBER FUNCTIONS ======== |
|
83 |
|
84 // -------------------------------------------------------------------------- |
|
85 // CPeninputGenericVkbWindow::CPeninputGenericVkbWindow |
|
86 // (other items were commented in a header) |
|
87 // -------------------------------------------------------------------------- |
|
88 // |
|
89 CPeninputGenericVkbWindow::CPeninputGenericVkbWindow( |
|
90 CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext, |
|
91 MPeninputUiStateMgr* aUiStateMgr ) |
|
92 : CPeninputLayoutWindowExt( aUiLayout, aLayoutContext ), |
|
93 iUiStateMgr(aUiStateMgr), |
|
94 iPopupInited(EFalse), |
|
95 iPopupSet(EFalse), |
|
96 iLafMgr(NULL), |
|
97 iFirstConstruct(ETrue), |
|
98 iIndiWithText( EFalse ), |
|
99 iUSRscFileExist( EFalse ) |
|
100 { |
|
101 } |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CPeninputGenericVkbWindow::NewL |
|
105 // (other items were commented in a header) |
|
106 // -------------------------------------------------------------------------- |
|
107 // |
|
108 CPeninputGenericVkbWindow* CPeninputGenericVkbWindow::NewL( |
|
109 CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext, |
|
110 MPeninputUiStateMgr* aUiStateMgr ) |
|
111 { |
|
112 CPeninputGenericVkbWindow* self = |
|
113 new ( ELeave ) CPeninputGenericVkbWindow( aUiLayout, aLayoutContext, aUiStateMgr ); |
|
114 CleanupStack::PushL( self ); |
|
115 self->ConstructL(); |
|
116 CleanupStack::Pop( self ); |
|
117 |
|
118 return self; |
|
119 } |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CPeninputGenericVkbWindow::~CPeninputGenericVkbWindow |
|
123 // (other items were commented in a header) |
|
124 // -------------------------------------------------------------------------- |
|
125 // |
|
126 CPeninputGenericVkbWindow::~CPeninputGenericVkbWindow() |
|
127 { |
|
128 delete iIdle; |
|
129 iUnits.Close(); |
|
130 |
|
131 delete iLafMgr; |
|
132 iLafMgr = NULL; |
|
133 delete iBmpRotator; |
|
134 iAccentCmdList.Close(); |
|
135 } |
|
136 void CPeninputGenericVkbWindow::ConstructL() |
|
137 { |
|
138 iHandleRangeShortPress = ETrue; |
|
139 iBmpRotator = CPeninputSyncBitmapRotator::NewL(); |
|
140 iLafMgr = CPeninputGenericVkbLafMgr::NewL(); |
|
141 iLafMgr->SetInputModeL(TPluginInputMode (iLayoutContext->LayoutType())); |
|
142 CPeninputLayoutWindowExt::ConstructL(); |
|
143 |
|
144 // Save whether American rsc file exist or not |
|
145 TBuf<KMaxFileLength> usUSRscFileName; |
|
146 usUSRscFileName= KConfigurationResourceFile(); |
|
147 usUSRscFileName.AppendNum( ELangAmerican ); |
|
148 usUSRscFileName.Append( KResourceFileExtName ); |
|
149 |
|
150 RFs fileSession; |
|
151 User::LeaveIfError( fileSession.Connect() ); |
|
152 CleanupClosePushL( fileSession ); |
|
153 if ( BaflUtils::FileExists( fileSession , usUSRscFileName )) |
|
154 { |
|
155 iUSRscFileExist = ETrue; |
|
156 } |
|
157 CleanupStack::PopAndDestroy( 1 ); |
|
158 // For addition of ITI features, add a candidate list in vkb window |
|
159 CreateCandidateListL(); |
|
160 } |
|
161 |
|
162 // -------------------------------------------------------------------------- |
|
163 // CPeninputGenericVkbWindow::HandleControlEvent |
|
164 // (other items were commented in a header) |
|
165 // -------------------------------------------------------------------------- |
|
166 // |
|
167 void CPeninputGenericVkbWindow::HandleControlEvent( TInt aEventType, |
|
168 CFepUiBaseCtrl* aCtrl, |
|
169 const TDesC& aEventData ) |
|
170 { |
|
171 // Call this function in base class |
|
172 CPeninputLayoutWindowExt::HandleControlEvent( aEventType, aCtrl, |
|
173 aEventData ); |
|
174 |
|
175 TInt* data = ( TInt* ) aEventData.Ptr(); |
|
176 |
|
177 switch ( aEventType ) |
|
178 { |
|
179 case EPeninputLayoutEventMultiRange: |
|
180 { |
|
181 if ( aCtrl->ControlId() == EPeninutWindowCtrlIdMultiRangeBtn ) |
|
182 { |
|
183 if ( iHandleRangeShortPress ) |
|
184 { |
|
185 HandleRangeButtonShortPress(); |
|
186 } |
|
187 } |
|
188 iHandleRangeShortPress = ETrue; |
|
189 } |
|
190 break; |
|
191 case EPeninputLayoutEventMultiRangeLongPress: |
|
192 { |
|
193 if ( aCtrl->ControlId() == EPeninutWindowCtrlIdMultiRangeBtn ) |
|
194 { |
|
195 // Before pop up list, cancel down event, and set range button un-highlight. |
|
196 TRAP_IGNORE( aCtrl->CancelPointerDownL()); |
|
197 static_cast<CAknFepCtrlCommonButton*>(aCtrl)->SetHighlight( EFalse ); |
|
198 PopupChoiceList(); |
|
199 } |
|
200 } |
|
201 break; |
|
202 case EPeninputLayoutVkbEventResetShift: |
|
203 { |
|
204 HandleShiftAndCapslockBtnClicked(); |
|
205 } |
|
206 break; |
|
207 case EPenInputLayoutEventClosePopup: |
|
208 { |
|
209 if ( iPopupWnd && !iPopupWnd->Hiden() ) |
|
210 { |
|
211 iPopupWnd->CloseWindow(); |
|
212 if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ ) |
|
213 { |
|
214 ResetAccentButton(); |
|
215 } |
|
216 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
217 } |
|
218 } |
|
219 break; |
|
220 case EEventChoiceSelected: |
|
221 { |
|
222 CFepUiBaseCtrl* btn = Control( EPeninutWindowCtrlIdMultiRangeBtn ); |
|
223 |
|
224 if ( btn ) |
|
225 { |
|
226 iHandleRangeShortPress = EFalse; |
|
227 TRAP_IGNORE( btn->HandlePointerUpEventL( btn->Rect().iBr ) ); |
|
228 iHandleRangeShortPress = ETrue; |
|
229 } |
|
230 CFepLayoutChoiceList::SEvent* event = |
|
231 ( CFepLayoutChoiceList::SEvent* ) aEventData.Ptr(); |
|
232 |
|
233 if ( event->iIndex != KPeninputVkbWndInvalidIndex ) |
|
234 { |
|
235 if (aCtrl->ControlId() == EPeninutWindowCtrlIdAccentPopupWindow) |
|
236 { |
|
237 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
238 { |
|
239 TRAP_IGNORE( HandleRangeListSelectedL( aCtrl, aEventData )); |
|
240 } |
|
241 else |
|
242 { |
|
243 TInt currentRange = CPeninputDataConverter::AnyToInt( |
|
244 iLayoutContext->RequestData(EPeninputDataTypeCurrentRange)); |
|
245 TInt currentAccent = CPeninputDataConverter::AnyToInt( |
|
246 iLayoutContext->RequestData(EPeninputDataTypeCurrentAccent)); |
|
247 |
|
248 if ((currentRange == ERangeAccent) && (currentAccent == event->iIndex)) |
|
249 { |
|
250 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
251 return; |
|
252 } |
|
253 |
|
254 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &(event->iIndex)); |
|
255 |
|
256 // Active range, update rangebar and vkb layout |
|
257 //ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * event->iIndex); |
|
258 (currentRange == ERangeAccent) ? ChangeRange(ERangeAccent, |
|
259 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, EFalse) : |
|
260 ChangeRange(ERangeAccent, |
|
261 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, ETrue); |
|
262 } |
|
263 } |
|
264 else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow) |
|
265 { |
|
266 if (iLayoutContext->LayoutType() != event->iCommand) |
|
267 { |
|
268 TBool switchByMode = ETrue; |
|
269 TInt mode = event->iCommand; |
|
270 |
|
271 TBuf<8> buf; |
|
272 buf.Append(reinterpret_cast<TText*>(&switchByMode), |
|
273 sizeof(TBool)/sizeof(TText)); |
|
274 buf.Append(reinterpret_cast<TText*>(&mode), sizeof(TInt)/sizeof(TText)); |
|
275 UiLayout()->SignalOwner(ESignalLayoutUIChanged,buf); |
|
276 } |
|
277 } |
|
278 else if ( aCtrl->ControlId() == EPentinputHwrCandidateList ) |
|
279 { |
|
280 TRAP_IGNORE( HandleCandidateListSelectedL( aCtrl, aEventData ) ); |
|
281 } |
|
282 } |
|
283 else |
|
284 { |
|
285 if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ ) |
|
286 { |
|
287 ResetAccentButton(); |
|
288 } |
|
289 } |
|
290 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
291 } |
|
292 break; |
|
293 case EPeninputLayoutEventToHwr: |
|
294 { |
|
295 TRAP_IGNORE( UpdateICFTextL() ); |
|
296 TRAP_IGNORE(PopupSwitchWindowL()); |
|
297 } |
|
298 break; |
|
299 case EEventVirtualKeyLatched: |
|
300 { |
|
301 HandleVirtualKeyLatchedEvent(aEventType, aCtrl, aEventData); |
|
302 } |
|
303 break; |
|
304 case EEventVirtualKeyUnLatched: |
|
305 { |
|
306 HBufC* newCharBuf = HBufC::New( 2*iNewDeadKeyBuf.Length() ); |
|
307 if( newCharBuf ) |
|
308 { |
|
309 CPeninputGenericVkbLayout* layout |
|
310 = static_cast<CPeninputGenericVkbLayout*>( UiLayout() ); |
|
311 if( layout->IsEnableITIOnFSQ() ) |
|
312 { |
|
313 // If ITI is open, double same keys should be send for one dead key, |
|
314 // core will handle them as one key. |
|
315 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
316 } |
|
317 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
318 } |
|
319 |
|
320 // Submit DeadKey |
|
321 UiLayout()->SignalOwner(ESignalKeyEvent, *newCharBuf); |
|
322 delete newCharBuf; |
|
323 |
|
324 TBool deadKeyChange = EFalse; |
|
325 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
326 iNewDeadKeyBuf = KNullDesC; |
|
327 } |
|
328 break; |
|
329 case EPeninputLayoutEventBack: |
|
330 { |
|
331 TInt latchedFlag = CPeninputDataConverter::AnyToInt |
|
332 (iLayoutContext->RequestData(EAkninputDataTypeLatchedSet)); |
|
333 // If one DeadKey is latched, only unlatch the DeadKey and reset the iNewDeadKeyBuf |
|
334 // Don't delete the visible charater in ICF |
|
335 if(latchedFlag) |
|
336 { |
|
337 UnLatchDeadKey(iNewDeadKeyBuf); |
|
338 |
|
339 TBool deadKeyChange = EFalse; |
|
340 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
341 iNewDeadKeyBuf = KNullDesC; |
|
342 } |
|
343 } |
|
344 break; |
|
345 case EPeninputLayoutEventEnter: |
|
346 case EPeninputLayoutEventSpace: |
|
347 { |
|
348 TInt latchedFlag = CPeninputDataConverter::AnyToInt |
|
349 (iLayoutContext->RequestData(EAkninputDataTypeLatchedSet)); |
|
350 if(latchedFlag) |
|
351 { |
|
352 HBufC* newCharBuf = HBufC::New( aEventData.Length() + 2*iNewDeadKeyBuf.Length() ); |
|
353 if( newCharBuf ) |
|
354 { |
|
355 CPeninputGenericVkbLayout* layout |
|
356 = static_cast<CPeninputGenericVkbLayout*>( UiLayout() ); |
|
357 if( layout->IsEnableITIOnFSQ() ) |
|
358 { |
|
359 // If ITI is open, double same keys should be send for one dead key, |
|
360 // core will handle them as one key. |
|
361 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
362 } |
|
363 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
364 newCharBuf->Des().Append( aEventData ); |
|
365 } |
|
366 |
|
367 UnLatchDeadKey(iNewDeadKeyBuf); |
|
368 |
|
369 TBool deadKeyChange = EFalse; |
|
370 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
371 |
|
372 // Submit DeadKey + Space or Enter at the same time |
|
373 |
|
374 if( newCharBuf != NULL ) |
|
375 { |
|
376 UiLayout()->SignalOwner(ESignalKeyEvent,*newCharBuf); |
|
377 } |
|
378 iNewDeadKeyBuf = KNullDesC; |
|
379 delete newCharBuf; |
|
380 } |
|
381 } |
|
382 break; |
|
383 |
|
384 /* case EPeninputLayoutEventLeftArrow: |
|
385 SimulateRawEvent(EStdKeyLeftArrow,TRawEvent::EKeyDown); |
|
386 SimulateRawEvent(EStdKeyLeftArrow,TRawEvent::EKeyUp); |
|
387 break; |
|
388 |
|
389 case EPeninputLayoutEventRightArrow: |
|
390 SimulateRawEvent(EStdKeyRightArrow,TRawEvent::EKeyDown); |
|
391 SimulateRawEvent(EStdKeyRightArrow,TRawEvent::EKeyUp); |
|
392 break;*/ |
|
393 |
|
394 default: |
|
395 break; |
|
396 } |
|
397 } |
|
398 |
|
399 // -------------------------------------------------------------------------- |
|
400 // CPeninputGenericVkbWindow::SimulateRawEvent |
|
401 // (other items were commented in a header) |
|
402 // -------------------------------------------------------------------------- |
|
403 // |
|
404 void CPeninputGenericVkbWindow::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
|
405 { |
|
406 TRawEvent event; |
|
407 event.Set(aType,aScanCode); |
|
408 |
|
409 TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16)); |
|
410 |
|
411 UiLayout()->SignalOwner(ESignalSimulateEvent,eventPtr); |
|
412 } |
|
413 |
|
414 // -------------------------------------------------------------------------- |
|
415 // CPeninputGenericVkbWindow::GetWindowConfigResId |
|
416 // (other items were commented in a header) |
|
417 // -------------------------------------------------------------------------- |
|
418 // |
|
419 TInt CPeninputGenericVkbWindow::GetWindowConfigResId() |
|
420 { |
|
421 return R_PENINPUT_LAYOUT_CONFIG_INFO; |
|
422 } |
|
423 |
|
424 // -------------------------------------------------------------------------- |
|
425 // CPeninputGenericVkbWindow::GetWindowResId |
|
426 // (other items were commented in a header) |
|
427 // -------------------------------------------------------------------------- |
|
428 // |
|
429 TInt CPeninputGenericVkbWindow::GetWindowResId() |
|
430 { |
|
431 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
432 { |
|
433 return R_PENINPUT_LAYOUT_FSQ_WINDOW_INFO; |
|
434 } |
|
435 return R_PENINPUT_LAYOUT_VKB_WINDOW_INFO; |
|
436 } |
|
437 |
|
438 // -------------------------------------------------------------------------- |
|
439 // CPeninputGenericVkbWindow::GetNumKeymappingResId |
|
440 // (other items were commented in a header) |
|
441 // -------------------------------------------------------------------------- |
|
442 // |
|
443 TInt CPeninputGenericVkbWindow::GetNumKeymappingResId() |
|
444 { |
|
445 return R_PENINPUT_LAYOUT_KEY_MAPPING_STRING_LIST; |
|
446 } |
|
447 |
|
448 // -------------------------------------------------------------------------- |
|
449 // CPeninputGenericVkbWindow::GetWindowConfigResFileName |
|
450 // (other items were commented in a header) |
|
451 // -------------------------------------------------------------------------- |
|
452 // |
|
453 const TDesC& CPeninputGenericVkbWindow::GetWindowConfigResFileName( |
|
454 TInt aLangID ) |
|
455 { |
|
456 if ( aLangID <= 0 ) |
|
457 { |
|
458 return KNullDesC; |
|
459 } |
|
460 |
|
461 if ( aLangID == ELangFrench ) |
|
462 { |
|
463 |
|
464 TBuf<KMaxFileLength> canadianfrenchresfilename; |
|
465 canadianfrenchresfilename= KConfigurationResourceFile(); |
|
466 canadianfrenchresfilename.AppendNum( ELangCanadianFrench ); |
|
467 canadianfrenchresfilename.Append( KResourceFileExtName ); |
|
468 |
|
469 RFile file; |
|
470 TInt rs = file.Open( CCoeEnv::Static()->FsSession(),canadianfrenchresfilename, EFileRead ); |
|
471 if ( rs == KErrNone ) |
|
472 { |
|
473 file.Close(); |
|
474 aLangID = ELangCanadianFrench; |
|
475 } |
|
476 } |
|
477 // If US Rsc file exist, use it instead of English rsc file |
|
478 if(( aLangID == ELangEnglish ) && ( iUSRscFileExist )) |
|
479 { |
|
480 aLangID = ELangAmerican; |
|
481 } |
|
482 iResourceFilename.Zero(); |
|
483 // Generate resource file name according to language id |
|
484 iResourceFilename = KConfigurationResourceFile(); |
|
485 |
|
486 if ( aLangID < 10 ) |
|
487 { |
|
488 iResourceFilename.AppendNum( 0 ); |
|
489 iResourceFilename.AppendNum( aLangID ); |
|
490 } |
|
491 else |
|
492 { |
|
493 iResourceFilename.AppendNum( aLangID ); |
|
494 } |
|
495 iResourceFilename.Append( KResourceFileExtName ); |
|
496 |
|
497 return iResourceFilename; |
|
498 } |
|
499 |
|
500 // -------------------------------------------------------------------------- |
|
501 // CPeninputGenericVkbWindow::GetWindowResFileName |
|
502 // (other items were commented in a header) |
|
503 // -------------------------------------------------------------------------- |
|
504 // |
|
505 const TDesC& CPeninputGenericVkbWindow::GetWindowResFileName() |
|
506 { |
|
507 return KVkbWindowResourceFile(); |
|
508 } |
|
509 |
|
510 // -------------------------------------------------------------------------- |
|
511 // CPeninputGenericVkbWindow::CreateAllControls |
|
512 // (other items were commented in a header) |
|
513 // -------------------------------------------------------------------------- |
|
514 // |
|
515 void CPeninputGenericVkbWindow::CreateAllControlsL() |
|
516 { |
|
517 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
518 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
519 iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine(); |
|
520 iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine(); |
|
521 |
|
522 icf->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
523 icf->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
524 //Change the ID when ID into release |
|
525 icf->MsgBubbleCtrl()->SetBitmapParam(NULL, |
|
526 NULL, |
|
527 KAknsIIDQsnFrInputPreviewSideL, |
|
528 KAknsIIDQsnFrInputPreviewMiddle, |
|
529 KAknsIIDQsnFrInputPreviewSideR); |
|
530 icf->MsgBubbleCtrl()->SetTextL( KEmptyString ); |
|
531 icf->InfoBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
532 icf->InfoBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
533 icf->InfoBubbleCtrl()->SetBitmapParam(NULL, |
|
534 NULL, |
|
535 KAknsIIDQsnFrInputPreviewSideL, |
|
536 KAknsIIDQsnFrInputPreviewMiddle, |
|
537 KAknsIIDQsnFrInputPreviewSideR); |
|
538 if (iLayoutContext->LayoutType() == EPluginInputModeFSQ) |
|
539 { |
|
540 icf->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
541 icf->SetInfoBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
542 } |
|
543 |
|
544 if ( !( iLayoutContext->LayoutType() == EPluginInputModeFSQ )) |
|
545 { |
|
546 // Range bar |
|
547 AddRangeBarL(); |
|
548 } |
|
549 |
|
550 // Vkb control |
|
551 iVkbCtrl = CPeninputVkbCtrlExt::NewL( TRect(), UiLayout(), |
|
552 EPeninutWindowCtrlIdVkbCtrl, NULL ); |
|
553 iVkbCtrl->SetResourceId( R_PENINPUT_LAYOUT_VKB_KEYBOARD ); |
|
554 iVkbCtrl->ConstructFromResourceL(); |
|
555 iVkbCtrl->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 ); |
|
556 iVkbLayout->SetVkbKeyboard( iVkbCtrl ); |
|
557 if (iLayoutContext->LayoutType() != EPluginInputModeFSQ) |
|
558 { |
|
559 iVkbCtrl->SetIrregularKeyBoard(ETrue); |
|
560 iVkbLayout->SetIrregularResourceId(R_AKN_FEP_VKB_IRREGULAR_BITMAP); |
|
561 iVkbLayout->ConstructFromIrregularResourceL(); |
|
562 } |
|
563 else |
|
564 { |
|
565 iVkbCtrl->SetIrregularKeyBoard(EFalse); |
|
566 iVkbLayout->SetNonIrregularResourceId(R_AKN_FEP_VKB_NONIRREGULAR_BITMAP); |
|
567 iVkbLayout->ConstructFromNonIrregularResourceL(); |
|
568 } |
|
569 |
|
570 // Add bubble support |
|
571 iVkbCtrl->ShowBubble(ETrue); |
|
572 iVkbCtrl->SetGowithPointerDown(ETrue); |
|
573 iVkbCtrl->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); //Change the ID when ID into release |
|
574 |
|
575 //set key to be 9 piece graphics |
|
576 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
577 { |
|
578 iVkbCtrl->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal ); |
|
579 iVkbCtrl->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed ); |
|
580 iVkbCtrl->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive ); |
|
581 } |
|
582 |
|
583 AddControlL( iVkbCtrl ); |
|
584 iVkbCtrl->AddEventObserver( UiLayout() ); |
|
585 |
|
586 AddButtonL( EPeninutWindowCtrlIdEnterBtn, |
|
587 EPeninputLayoutEventEnter, |
|
588 R_PENINPUT_LAYOUT_VKB_ENTER, |
|
589 EKeyEnter ); |
|
590 |
|
591 // Shift and capslock merged button |
|
592 |
|
593 CAknFepCtrlMultiModeButton* button = |
|
594 CAknFepCtrlMultiModeButton::NewLC( UiLayout(), |
|
595 EPeninutWindowCtrlIdShiftBtn ); |
|
596 if ( button ) |
|
597 { |
|
598 // Read resource |
|
599 TResourceReader reader; |
|
600 |
|
601 CCoeEnv::Static()->CreateResourceReaderLC( reader, |
|
602 R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK ); |
|
603 button->SetResourceId( R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK ); |
|
604 button->ConstructFromResourceL(); |
|
605 // Pop and destroy reader |
|
606 CleanupStack::PopAndDestroy( 1 ); |
|
607 |
|
608 // Add into the control pool |
|
609 AddControlL( button ); |
|
610 |
|
611 button->AddEventObserver( UiLayout() ); |
|
612 } |
|
613 CleanupStack::Pop( button ); |
|
614 // Space button |
|
615 CAknFepCtrlEventButton* spaceButton = static_cast<CAknFepCtrlEventButton*> |
|
616 (Control(EPeninutWindowCtrlIdSpaceBtn)); |
|
617 // Create 3-pieces color icon for space button |
|
618 CPenInput3PiecesColorIcons* colorIcons = |
|
619 CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1, |
|
620 R_AKN_FEP_VKB_SPACE_ICON2, |
|
621 R_AKN_FEP_VKB_SPACE_ICON3 ); |
|
622 spaceButton->Set3PiecesColorIcons( colorIcons ); |
|
623 |
|
624 //set background of space button to be 9 piece graphics |
|
625 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
626 { |
|
627 spaceButton->SetImageFrameId( KAknsIIDQsnFrKeypadButtonFrNormal, |
|
628 KAknsIIDQsnFrKeypadButtonFrPressed, |
|
629 KAknsIIDQsnFrKeypadButtonFrInactive ); |
|
630 } |
|
631 |
|
632 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
633 { |
|
634 // Switch to hwr button |
|
635 AddButtonL( EPeninutWindowCtrlIdMultiRangeBtn, |
|
636 EPeninputLayoutEventMultiRange, |
|
637 R_PENINPUT_LAYOUT_FSQ_MULTIRANGE ); |
|
638 } |
|
639 else |
|
640 { |
|
641 // Switch to hwr button |
|
642 AddButtonL( EPeninutWindowCtrlIdSwitchToHwrBtn, |
|
643 EPeninputLayoutEventToHwr, |
|
644 R_PENINPUT_LAYOUT_VKB_HWR ); |
|
645 } |
|
646 |
|
647 // Add popup window |
|
648 AddPopupWindowL(); |
|
649 |
|
650 } |
|
651 |
|
652 // -------------------------------------------------------------------------- |
|
653 // CPeninputGenericVkbWindow::ChangeUnitSize |
|
654 // (other items were commented in a header) |
|
655 // -------------------------------------------------------------------------- |
|
656 // |
|
657 const TRect CPeninputGenericVkbWindow::ChangeUnitSize() |
|
658 { |
|
659 return TRect(); |
|
660 } |
|
661 |
|
662 // -------------------------------------------------------------------------- |
|
663 // CPeninputGenericVkbWindow::ChangeClientSize |
|
664 // (other items were commented in a header) |
|
665 // -------------------------------------------------------------------------- |
|
666 // |
|
667 void CPeninputGenericVkbWindow::ChangeClientSize() |
|
668 { |
|
669 if ( !iPopupWnd->Hiden() ) |
|
670 { |
|
671 iPopupWnd->CloseWindow(); |
|
672 if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ ) |
|
673 { |
|
674 ResetAccentButton(); |
|
675 } |
|
676 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
677 } |
|
678 |
|
679 PopupWindowSizeChange(); |
|
680 |
|
681 TInt clientLayoutId = CPeninputDataConverter::AnyToInt |
|
682 ( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) ); |
|
683 CPeninputClientLayoutInfo* clientLayout = |
|
684 ConfigInfo()->FindClientLayoutInfo( clientLayoutId ); |
|
685 |
|
686 if ( clientLayout ) |
|
687 { |
|
688 ReorganizeControls( clientLayout->LayoutID(), EFalse ); |
|
689 } |
|
690 |
|
691 UpdateArea( iVkbCtrl->Rect(), EFalse ); |
|
692 } |
|
693 void CPeninputGenericVkbWindow::SetVkbLayoutSize() |
|
694 { |
|
695 TRect outrect,innerrect; |
|
696 iLafMgr->GetPreviewWndRect(outrect,innerrect); |
|
697 iVkbCtrl->SetTextFormat(iLafMgr->PreviewWndText()); //Read laf |
|
698 iVkbCtrl->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
699 iVkbCtrl->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
700 innerrect.iTl.iY - outrect.iTl.iY, |
|
701 outrect.iBr.iX - innerrect.iBr.iX, |
|
702 outrect.iBr.iY - innerrect.iBr.iY); |
|
703 |
|
704 TInt vkbLayoutid = CPeninputDataConverter::AnyToInt |
|
705 ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) ); |
|
706 CPeninputVkbLayoutInfo* vkbLayout = |
|
707 ConfigInfo()->FindVkbLayoutInfo( vkbLayoutid ); |
|
708 |
|
709 // Calculate current vkblayout according current layout |
|
710 if ( vkbLayout ) |
|
711 { |
|
712 const TInt columns = vkbLayout->Columns(); |
|
713 const TInt rows = vkbLayout->Rows(); |
|
714 TRect keyRect; |
|
715 TRect charRect; |
|
716 |
|
717 //iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(rows,columns)); |
|
718 |
|
719 |
|
720 for (TInt exter = 0; exter < rows; exter ++) |
|
721 { |
|
722 for (TInt inter = 0; inter < columns; inter ++ ) |
|
723 { |
|
724 iLafMgr->GetKeyRect(inter,exter, keyRect, charRect); |
|
725 vkbLayout->SetKeyInfo(exter,inter,keyRect,charRect,iLafMgr->KeyTextFont()); |
|
726 } |
|
727 } |
|
728 |
|
729 if ( iVkbCtrl->IsIrregularKeyBoard() ) |
|
730 { |
|
731 TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size(); |
|
732 TSize size = iVkbCtrl->IrregularKeyBitmap(EKeyLeftDown, |
|
733 EKeyStateNormal)->SizeInPixels(); |
|
734 if ( curSize != size ) |
|
735 { |
|
736 for ( TInt i = 0; i <= EKeyRightUp; i++ ) |
|
737 { |
|
738 for ( TInt j = 0; j <= EKeyStateDimmedMask; j++ ) |
|
739 { |
|
740 AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap( |
|
741 (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), |
|
742 curSize, EAspectRatioNotPreserved ); |
|
743 |
|
744 AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap( |
|
745 (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), |
|
746 curSize, EAspectRatioNotPreserved ); |
|
747 } |
|
748 } |
|
749 } |
|
750 } |
|
751 else |
|
752 { |
|
753 TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size(); |
|
754 TSize size = iVkbCtrl->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels(); |
|
755 if( curSize != size ) |
|
756 { |
|
757 for ( TInt i = 0; i <= EKeyBmpLastType; i++ ) |
|
758 { |
|
759 if( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) ) |
|
760 { |
|
761 AknIconUtils::SetSize( |
|
762 iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), |
|
763 curSize, EAspectRatioNotPreserved ); |
|
764 } |
|
765 } |
|
766 } |
|
767 } |
|
768 } |
|
769 } |
|
770 |
|
771 // -------------------------------------------------------------------------- |
|
772 // CPeninputGenericVkbWindow::ReorganizeControls |
|
773 // (other items were commented in a header) |
|
774 // -------------------------------------------------------------------------- |
|
775 // |
|
776 void CPeninputGenericVkbWindow::ReorganizeControls( TInt aClientLayoutId, |
|
777 TBool aNeedReset ) |
|
778 { |
|
779 CPeninputClientLayoutInfo* clientLayout = |
|
780 ConfigInfo()->FindClientLayoutInfo( aClientLayoutId ); |
|
781 RPointerArray<CPeninputControlInfo>& controlList = |
|
782 clientLayout->ControlInfoList(); |
|
783 |
|
784 const TInt keyColumns = clientLayout->Columns(); |
|
785 const TInt keyRows = clientLayout->Rows(); |
|
786 |
|
787 if( iLastUsedTotalColumns == keyColumns && |
|
788 iLastUsedTotalRows == keyRows ) |
|
789 { |
|
790 return; |
|
791 } |
|
792 |
|
793 iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(keyRows,keyColumns)); |
|
794 |
|
795 iLastUsedTotalColumns = keyColumns; |
|
796 iLastUsedTotalRows = keyRows; |
|
797 |
|
798 TRect winRect( Rect().iTl, iLafMgr->EntirePaneRect().Size()); |
|
799 |
|
800 SetWindowRect(winRect); |
|
801 //ReorgnizeTitleBar(); |
|
802 ReorgnizeICFAndButtons(); |
|
803 |
|
804 const TInt count = controlList.Count(); |
|
805 TInt controlID = 0; |
|
806 CFepUiBaseCtrl* ctrl = NULL; |
|
807 TRect rect; |
|
808 TRect inRect; |
|
809 TRect exRect; |
|
810 |
|
811 TPoint winPoint = Rect().iTl; |
|
812 TPoint LafPoint = iLafMgr->EntirePaneRect().iTl; |
|
813 |
|
814 TInt x = winPoint.iX - LafPoint.iX; |
|
815 TInt y = winPoint.iY - LafPoint.iY; |
|
816 |
|
817 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
818 { |
|
819 x = 0; |
|
820 y = 0; |
|
821 } |
|
822 for ( TInt i = 0; i < count; i++ ) |
|
823 { |
|
824 controlID = controlList[i]->ControlID(); |
|
825 ctrl = Control( controlID ); |
|
826 |
|
827 if ( ctrl ) |
|
828 { |
|
829 AddNotOwnedControl( ctrl ); |
|
830 if ( ( ctrl->ControlType() | ECtrlButton ) == ECtrlButton ) |
|
831 { |
|
832 |
|
833 iLafMgr->GetButtonRect(TPeninputCommonCtrlID(ctrl->ControlId()),exRect ,inRect); |
|
834 |
|
835 exRect.Move(x, y); |
|
836 inRect.Move(x, y); |
|
837 if( controlID == EPeninutWindowCtrlIdShiftBtn) |
|
838 { |
|
839 ( static_cast<CAknFepCtrlMultiModeButton*> (ctrl) )-> |
|
840 SizeChanged( exRect, inRect, ETrue ); |
|
841 } |
|
842 else |
|
843 { |
|
844 if (TPeninputCommonCtrlID(ctrl->ControlId()) == EPeninutWindowCtrlIdSpaceBtn) |
|
845 { |
|
846 // config 3 pieces icon info |
|
847 TRect iconsFrameRect, middleIconRect; |
|
848 iLafMgr->GetSpaceButtonExLayoutInfo( iconsFrameRect, middleIconRect ); |
|
849 iconsFrameRect.Move( x, y ); |
|
850 middleIconRect.Move( x, y ); |
|
851 inRect = iconsFrameRect; |
|
852 |
|
853 ( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SetDraw3PieceFrameInfo( |
|
854 TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL, |
|
855 KAknsIIDQgnIndiInputSpaceMiddle, |
|
856 KAknsIIDQgnIndiInputSpaceR, |
|
857 middleIconRect)); |
|
858 } |
|
859 ( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SizeChanged( exRect, |
|
860 inRect, |
|
861 ETrue ); |
|
862 } |
|
863 } |
|
864 else if ( ctrl->ControlId() == EPeninutWindowCtrlIdVkbCtrl ) |
|
865 { |
|
866 iVkbCtrl->SetFont( iLafMgr->KeyTextFont() ); |
|
867 iVkbCtrl->SetTextLineLayout( iLafMgr->KeyTextLayout() ); |
|
868 iVkbCtrl->SetTextFormat( iLafMgr->PreviewWndText() ); //Read laf |
|
869 if (aNeedReset) |
|
870 { |
|
871 iVkbCtrl->Reset(); |
|
872 } |
|
873 |
|
874 rect = iLafMgr->KeypadRect(); |
|
875 |
|
876 rect.Move(x, y); |
|
877 |
|
878 ( static_cast<CPeninputVkbCtrlExt*> (ctrl) )->SizeChanged(rect); |
|
879 } |
|
880 |
|
881 else if ( ctrl->ControlId() == EPeninutWindowCtrlIdRangeBar ) |
|
882 { |
|
883 TRAP_IGNORE(SetRangeBarSizeL(x, y)); |
|
884 } |
|
885 } |
|
886 } |
|
887 |
|
888 // Addition for ITI features, read LAF data for candidate list |
|
889 const TPeninputCandidateListLayoutData& candidateListLAF = |
|
890 iLafMgr->CandidateListLayoutData(); |
|
891 iCandidateList->SizeChanged( candidateListLAF.iSelectionItemSize, |
|
892 candidateListLAF.iSelectionHorMargin, |
|
893 candidateListLAF.iSelectionVerMargin, |
|
894 candidateListLAF.iSelectionNaviSize, |
|
895 candidateListLAF.iSelectionNaviInnerSize ); |
|
896 iCandidateList->SetPageInfoTextLineLayout |
|
897 ( candidateListLAF.iSelectionPageTextLine ); |
|
898 |
|
899 |
|
900 const CFont* itemFont = candidateListLAF.iFont; |
|
901 TRgb textColor = CandidateListTextColor(); |
|
902 if ( itemFont ) |
|
903 { |
|
904 // Set font defined in LAF |
|
905 iCandidateList->SetTextProperty( itemFont, textColor ); |
|
906 } |
|
907 else |
|
908 { |
|
909 // If font in LAF is NULL, set ICF text font to candidate list |
|
910 iCandidateList->SetTextProperty( iLafMgr->ICFTextFont(), textColor ); |
|
911 } |
|
912 |
|
913 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
914 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
915 if ( icf ) |
|
916 { |
|
917 // read LAF data for tooltip box |
|
918 const TPeninputTooltipBoxLayoutData& tooltipBoxLAF |
|
919 = iLafMgr->TooltipBoxLayoutData(); |
|
920 icf->TooltipBubbleCtrl()->SetTextFormat( tooltipBoxLAF.iTooltipTextLayout ); |
|
921 icf->TooltipBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG55 ); |
|
922 icf->TooltipBubbleCtrl()->SetBitmapParam(NULL, |
|
923 NULL, |
|
924 KAknsIIDQsnFrInputPreviewSideL, |
|
925 KAknsIIDQsnFrInputPreviewMiddle, |
|
926 KAknsIIDQsnFrInputPreviewSideR); |
|
927 icf->TooltipBubbleCtrl()->SetFrameDiff( KTooltipLeftMargin, |
|
928 KTooltipTopMargin, |
|
929 KTooltipRightMargin, |
|
930 KTooltipBottomMargin ); |
|
931 // read color from skin for autocompletion part |
|
932 icf->SetAutoCompleteTextColor( AutoCompletionPartColor() ); |
|
933 } |
|
934 } |
|
935 |
|
936 void CPeninputGenericVkbWindow::SetRangeBarSizeL(TInt x, TInt y) |
|
937 { |
|
938 TRect exRect; |
|
939 exRect = iLafMgr->RangbarRect(); |
|
940 exRect.Move(x, y); |
|
941 // Get range bar display cell rects |
|
942 TRect rect, innerRect; |
|
943 RArray<TRect> displayCellRects, dispalyCellInnerRects; |
|
944 CleanupClosePushL( displayCellRects ); |
|
945 CleanupClosePushL( dispalyCellInnerRects ); |
|
946 for( TInt i = 0; i < iLafMgr->RangbarCellCount(); i++ ) |
|
947 { |
|
948 iLafMgr->RangbarCellAt( i, rect, innerRect ); |
|
949 rect.Move(x, y); |
|
950 displayCellRects.AppendL( rect ); |
|
951 innerRect.Move(x, y); |
|
952 dispalyCellInnerRects.AppendL( innerRect ); |
|
953 } |
|
954 iRangeBar->SetDispalyCellRectsL( displayCellRects, dispalyCellInnerRects ); |
|
955 CleanupStack::PopAndDestroy(2); |
|
956 iRangeBar->SizeChanged( exRect ); |
|
957 } |
|
958 |
|
959 // -------------------------------------------------------------------------- |
|
960 // CPeninputGenericVkbWindow::SetControlsFont |
|
961 // (other items were commented in a header) |
|
962 // -------------------------------------------------------------------------- |
|
963 // |
|
964 void CPeninputGenericVkbWindow::SetControlsFont() |
|
965 { |
|
966 /* |
|
967 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
968 |
|
969 const CFont* icfFont = iLafMgr->ICFTextFont(); |
|
970 |
|
971 // set icf margin |
|
972 TPeninputICFConfig icfConfig; |
|
973 iLafMgr->GetICFConfig( icfConfig ); |
|
974 icf->SetTextMargin( icfConfig.iLeftMargin, |
|
975 icfConfig.iRightMargin, |
|
976 icfConfig.iTopMargin, |
|
977 0 ); |
|
978 |
|
979 TRAP_IGNORE(icf->SizeChangedL( |
|
980 icf->Rect(), |
|
981 icfConfig.iTextLineHeight, |
|
982 icfFont->FontMaxHeight(), |
|
983 icfFont)); |
|
984 */ |
|
985 } |
|
986 |
|
987 // -------------------------------------------------------------------------- |
|
988 // CPeninputGenericVkbWindow::AddPopupWindowL |
|
989 // (other items were commented in a header) |
|
990 // -------------------------------------------------------------------------- |
|
991 // |
|
992 void CPeninputGenericVkbWindow::AddPopupWindowL() |
|
993 { |
|
994 iPopupWnd = CPeninputCommonChoiceList::NewL( UiLayout(), |
|
995 EPeninutWindowCtrlIdAccentPopupWindow, |
|
996 KAknsIIDQsnFrList, |
|
997 KAknsIIDQsnFrPopupSub ); |
|
998 |
|
999 |
|
1000 |
|
1001 iPopupWnd->AddEventObserver( UiLayout() ); |
|
1002 |
|
1003 AddControlL( iPopupWnd ); |
|
1004 iIdle = CIdle::NewL(CActive::EPriorityIdle ); |
|
1005 iIdle ->Start(TCallBack(BackgroundTaskL,this)); |
|
1006 } |
|
1007 |
|
1008 // -------------------------------------------------------------------------- |
|
1009 // CPeninputGenericVkbWindow::PopupChoiceList |
|
1010 // (other items were commented in a header) |
|
1011 // -------------------------------------------------------------------------- |
|
1012 // |
|
1013 void CPeninputGenericVkbWindow::PopupChoiceList() |
|
1014 { |
|
1015 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
1016 { |
|
1017 TRAP_IGNORE( PopupRangeListL()); |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 CFepUiBaseCtrl* accentBtn = Control( EPeninutWindowCtrlIdAccentedBtn ); |
|
1022 |
|
1023 if ( accentBtn ) |
|
1024 { |
|
1025 if(!iPopupInited) |
|
1026 TRAP_IGNORE(DoIdleConstructL()); |
|
1027 iPopupWnd->Display( accentBtn->Rect() ); |
|
1028 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup ); |
|
1029 } |
|
1030 } |
|
1031 } |
|
1032 // --------------------------------------------------------------------------- |
|
1033 // Show range list |
|
1034 // --------------------------------------------------------------------------- |
|
1035 // |
|
1036 void CPeninputGenericVkbWindow::PopupRangeListL() |
|
1037 { |
|
1038 if ( !iPopupInited ) |
|
1039 { |
|
1040 TRAP_IGNORE( DoIdleConstructL() ); |
|
1041 } |
|
1042 |
|
1043 |
|
1044 iPopupWnd->ClearItemsL(); |
|
1045 RArray<CFepLayoutChoiceList::SItem> items; |
|
1046 PrepareRangeListItems( items ); |
|
1047 TInt count = items.Count(); |
|
1048 for ( TInt i = 0; i < count; i++ ) |
|
1049 { |
|
1050 iPopupWnd->AddItemL( items[i] ); |
|
1051 } |
|
1052 items.Close(); |
|
1053 |
|
1054 if ( iPopupWnd->ItemsCount() < 1 ) |
|
1055 { |
|
1056 return; |
|
1057 } |
|
1058 |
|
1059 if ( iPopupWnd->ItemsCount() < 2 ) |
|
1060 { |
|
1061 const CFepLayoutChoiceList::SItem* item = iPopupWnd->ItemByIndex( 0 ); |
|
1062 CFepLayoutChoiceList::SEvent event; |
|
1063 event.iIndex = 0; |
|
1064 event.iCommand = item->iCommand; |
|
1065 TPtrC ptr; |
|
1066 ptr.Set(reinterpret_cast<TText*>(&event), sizeof(event)); |
|
1067 HandleRangeListSelectedL( iPopupWnd, ptr ); |
|
1068 return; |
|
1069 } |
|
1070 |
|
1071 CFepUiBaseCtrl* btn = Control( EPeninutWindowCtrlIdMultiRangeBtn ); |
|
1072 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
|
1073 iPopupWnd->SetCurrentFocusedIndex( - 1 ); //no active item |
|
1074 iPopupWnd->Display( btn->Rect() ); |
|
1075 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup ); |
|
1076 } |
|
1077 |
|
1078 // --------------------------------------------------------------------------- |
|
1079 // Handle range list event |
|
1080 // --------------------------------------------------------------------------- |
|
1081 // |
|
1082 void CPeninputGenericVkbWindow::HandleRangeListSelectedL( CFepUiBaseCtrl* /*aCtrl*/, |
|
1083 const TDesC& aData ) |
|
1084 { |
|
1085 CFepLayoutChoiceList::SEvent* event = |
|
1086 (CFepLayoutChoiceList::SEvent*)aData.Ptr(); |
|
1087 |
|
1088 TInt index = -1; |
|
1089 TInt range = ERangeInvalid; |
|
1090 |
|
1091 if ( event->iCommand == EPeninputVkbLayoutNativeChar ) |
|
1092 { |
|
1093 range = ERangeNative; |
|
1094 } |
|
1095 |
|
1096 else if ( event->iCommand == EPeninputVkbLayoutNativeNumber ) |
|
1097 { |
|
1098 range = ERangeNativeNumber; |
|
1099 } |
|
1100 |
|
1101 else if ( event->iCommand == EPeninputVkbLayoutLatinChar ) |
|
1102 { |
|
1103 range = ERangeEnglish; |
|
1104 } |
|
1105 |
|
1106 else if ( event->iCommand == EPeninputVkbLayoutLatinNumber ) |
|
1107 { |
|
1108 range = ERangeNumber; |
|
1109 } |
|
1110 |
|
1111 else if ( event->iCommand == EPeninputVkbLayoutSymbol ) |
|
1112 { |
|
1113 range = ERangeSymbol; |
|
1114 } |
|
1115 |
|
1116 else if ( event->iCommand == EPeninputVkbLayoutAccented1 ) |
|
1117 { |
|
1118 index = 0; |
|
1119 range = ERangeAccent; |
|
1120 } |
|
1121 |
|
1122 else if ( event->iCommand == EPeninputVkbLayoutAccented2 ) |
|
1123 { |
|
1124 index = 1; |
|
1125 range = ERangeAccent; |
|
1126 } |
|
1127 |
|
1128 else if ( event->iCommand == EPeninputVkbLayoutAccented3 ) |
|
1129 { |
|
1130 index = 2; |
|
1131 range = ERangeAccent; |
|
1132 } |
|
1133 |
|
1134 TInt currentRange = IntContext( EPeninputDataTypeCurrentRange ); |
|
1135 TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent ); |
|
1136 |
|
1137 if ( currentRange == range ) |
|
1138 { |
|
1139 if ( range != ERangeAccent || currentAccent == index ) |
|
1140 { |
|
1141 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
1142 return; |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &index ); |
|
1147 |
|
1148 if ( range != ERangeAccent ) |
|
1149 { |
|
1150 ChangeRange( range ); |
|
1151 } |
|
1152 else |
|
1153 { |
|
1154 ChangeRange( ERangeAccent, |
|
1155 EPeninputVkbLayoutAccented1 + 2 * index, ETrue ); |
|
1156 } |
|
1157 UpdateRangeCtrlsL(); |
|
1158 } |
|
1159 |
|
1160 // --------------------------------------------------------------------------- |
|
1161 // Update state of range button |
|
1162 // --------------------------------------------------------------------------- |
|
1163 // |
|
1164 void CPeninputGenericVkbWindow::UpdateRangeCtrlsL() |
|
1165 { |
|
1166 CAknFepCtrlCommonButton* rangeBtn = |
|
1167 static_cast<CAknFepCtrlCommonButton*>( |
|
1168 Control(EPeninutWindowCtrlIdMultiRangeBtn)); |
|
1169 if ( !rangeBtn ) |
|
1170 { |
|
1171 return; |
|
1172 } |
|
1173 |
|
1174 RArray<CFepLayoutChoiceList::SItem> items; |
|
1175 PrepareRangeListItems( items ); |
|
1176 TInt count = items.Count(); |
|
1177 items.Close(); |
|
1178 |
|
1179 TInt languageId = IntContext( EPeninputDataTypeInputLanguage ); |
|
1180 TInt range = IntContext( EPeninputDataTypeCurrentRange ); |
|
1181 |
|
1182 TInt resId = -1; |
|
1183 TInt aplhaRangeResId = -1; |
|
1184 TInt numberRangeResId = -1; |
|
1185 GetRangeIconResource( languageId, aplhaRangeResId, numberRangeResId ); |
|
1186 |
|
1187 if ( range == ERangeEnglish || range == ERangeNative ) |
|
1188 { |
|
1189 resId = aplhaRangeResId; |
|
1190 } |
|
1191 else |
|
1192 { |
|
1193 resId = numberRangeResId; |
|
1194 } |
|
1195 |
|
1196 if( rangeBtn->ResourceId() != resId ) |
|
1197 { |
|
1198 rangeBtn->SetResourceId( resId ); |
|
1199 rangeBtn->ConstructFromResourceL(); |
|
1200 } |
|
1201 |
|
1202 rangeBtn->SetDimmed( count < 1 ); |
|
1203 } |
|
1204 |
|
1205 // --------------------------------------------------------------------------- |
|
1206 // Get resource ids of range button icon |
|
1207 // --------------------------------------------------------------------------- |
|
1208 // |
|
1209 void CPeninputGenericVkbWindow::GetRangeIconResource( TInt aLangId, |
|
1210 TInt& aAlphaRange, |
|
1211 TInt& aOtherRange ) |
|
1212 { |
|
1213 switch ( aLangId ) |
|
1214 { |
|
1215 case ELangRussian: //Cyrillic |
|
1216 case ELangBulgarian: |
|
1217 case ELangUkrainian: |
|
1218 { |
|
1219 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_ALPHA; |
|
1220 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_NUMERIC; |
|
1221 } |
|
1222 break; |
|
1223 case ELangGreek: //Greek |
|
1224 case ELangCyprusGreek: |
|
1225 { |
|
1226 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_ALPHA; |
|
1227 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_NUMERIC; |
|
1228 } |
|
1229 break; |
|
1230 case ELangHebrew: //Hebrew |
|
1231 { |
|
1232 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_ALPHA; |
|
1233 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_NUMERIC; |
|
1234 } |
|
1235 break; |
|
1236 case ELangArabic: //Arabic |
|
1237 case ELangFarsi: //Farsi |
|
1238 case ELangUrdu: //Urdu |
|
1239 { |
|
1240 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_ALPHA; |
|
1241 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_NUMERIC; |
|
1242 } |
|
1243 break; |
|
1244 case ELangThai: //Thai |
|
1245 { |
|
1246 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_ALPHA; |
|
1247 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_NUMERIC; |
|
1248 } |
|
1249 break; |
|
1250 default: //others |
|
1251 { |
|
1252 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_ALPHA; |
|
1253 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_NUMERIC; |
|
1254 } |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 // --------------------------------------------------------------------------- |
|
1259 // Prepare range list items |
|
1260 // --------------------------------------------------------------------------- |
|
1261 // |
|
1262 void CPeninputGenericVkbWindow::PrepareRangeListItems( |
|
1263 RArray<CFepLayoutChoiceList::SItem>& aRangeItems ) |
|
1264 { |
|
1265 aRangeItems.Reset(); |
|
1266 TInt currentRange = IntContext( EPeninputDataTypeCurrentRange ); |
|
1267 TInt permittedRange = IntContext( EPeninputDataTypePermittedRange ); |
|
1268 TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent ); |
|
1269 TInt currentLanguage = IntContext( EPeninputDataTypeInputLanguage ); |
|
1270 |
|
1271 CPeninputRangeBarInfo* rbinfo= ConfigInfo()->RangeBarInfo(); |
|
1272 CPeninputRangeInfo* rgninfo = NULL; |
|
1273 |
|
1274 //add accent items |
|
1275 if ( permittedRange & ERangeAccent ) |
|
1276 { |
|
1277 rgninfo = rbinfo->FindRange( ERangeAccent ); |
|
1278 if ( rgninfo ) |
|
1279 { |
|
1280 for ( TInt i = 0; i < iAccentCmdList.Count(); i++ ) |
|
1281 { |
|
1282 if( currentRange != ERangeAccent || currentAccent != i ) |
|
1283 { |
|
1284 aRangeItems.Append( iAccentCmdList[i] ); |
|
1285 } |
|
1286 } |
|
1287 } |
|
1288 } |
|
1289 |
|
1290 //add range items |
|
1291 CFepLayoutChoiceList::SItem item; |
|
1292 |
|
1293 if ( permittedRange & ERangeNative ) |
|
1294 { |
|
1295 rgninfo = rbinfo->FindRange( ERangeNative ); |
|
1296 if ( rgninfo && currentRange != ERangeNative ) |
|
1297 { |
|
1298 item.iCommand = EPeninputVkbLayoutNativeChar; |
|
1299 item.iText.Copy( iRangeLabels.iLabelNativeChar ); |
|
1300 aRangeItems.Append( item ); |
|
1301 } |
|
1302 } |
|
1303 |
|
1304 if (( permittedRange & ERangeNativeNumber ) && ( currentRange != ERangeNumber ) |
|
1305 && (( ELangArabic == currentLanguage ) || ( ELangFarsi == currentLanguage ) |
|
1306 || ( ELangUrdu == currentLanguage ))) |
|
1307 { |
|
1308 rgninfo = rbinfo->FindRange( ERangeNativeNumber ); |
|
1309 if ( rgninfo && currentRange != ERangeNativeNumber ) |
|
1310 { |
|
1311 item.iCommand = EPeninputVkbLayoutNativeNumber; |
|
1312 item.iText.Copy( iRangeLabels.iLabelNativeNumber ); |
|
1313 aRangeItems.Append( item ); |
|
1314 } |
|
1315 } |
|
1316 else if(( permittedRange & ERangeNumber ) && ( currentRange != ERangeNumber ) |
|
1317 && !(( ELangThai == currentLanguage ) && ( currentRange == ERangeNativeNumber ))) |
|
1318 { |
|
1319 rgninfo = rbinfo->FindRange( ERangeNumber ); |
|
1320 if ( rgninfo && currentRange != ERangeNumber ) |
|
1321 { |
|
1322 item.iCommand = EPeninputVkbLayoutLatinNumber; |
|
1323 item.iText.Copy( iRangeLabels.iLabelLatinNumber ); |
|
1324 aRangeItems.Append( item ); |
|
1325 } |
|
1326 } |
|
1327 else |
|
1328 { |
|
1329 // Do nothing |
|
1330 } |
|
1331 |
|
1332 if ( permittedRange & ERangeEnglish ) |
|
1333 { |
|
1334 rgninfo = rbinfo->FindRange( ERangeEnglish ); |
|
1335 if ( rgninfo && currentRange != ERangeEnglish ) |
|
1336 { |
|
1337 item.iCommand = EPeninputVkbLayoutLatinChar; |
|
1338 item.iText.Copy( iRangeLabels.iLabelLatinChar ); |
|
1339 aRangeItems.Append( item ); |
|
1340 } |
|
1341 } |
|
1342 |
|
1343 } |
|
1344 |
|
1345 // --------------------------------------------------------------------------- |
|
1346 // Load range labels for range list |
|
1347 // --------------------------------------------------------------------------- |
|
1348 // |
|
1349 void CPeninputGenericVkbWindow::ConstructRangeLabelListL( TInt /*aLangId*/ ) |
|
1350 { |
|
1351 iRangeLabels.iLabelNativeChar.Zero(); |
|
1352 iRangeLabels.iLabelNativeNumber.Zero(); |
|
1353 iRangeLabels.iLabelLatinChar.Zero(); |
|
1354 iRangeLabels.iLabelLatinNumber.Zero(); |
|
1355 iRangeLabels.iLabelSymbol.Zero(); |
|
1356 iRangeLabels.iLabelAccent.Zero(); |
|
1357 |
|
1358 TInt resid = R_PENINPUT_LAYOUT_VKB_RANGES; |
|
1359 |
|
1360 TResourceReader reader; |
|
1361 CCoeEnv::Static()->CreateResourceReaderLC( reader, resid ); |
|
1362 TPtrC ptr1 = reader.ReadTPtrC(); |
|
1363 TPtrC ptr2 = reader.ReadTPtrC(); |
|
1364 TPtrC ptr3 = reader.ReadTPtrC(); |
|
1365 TPtrC ptr4 = reader.ReadTPtrC(); |
|
1366 TPtrC ptr5 = reader.ReadTPtrC(); |
|
1367 TPtrC ptr6 = reader.ReadTPtrC(); |
|
1368 |
|
1369 iRangeLabels.iLabelNativeChar.Copy( ptr1 ); |
|
1370 iRangeLabels.iLabelNativeNumber.Copy( ptr2 ); |
|
1371 iRangeLabels.iLabelLatinChar.Copy( ptr3 ); |
|
1372 iRangeLabels.iLabelLatinNumber.Copy( ptr4 ); |
|
1373 iRangeLabels.iLabelSymbol.Copy( ptr5 ); |
|
1374 iRangeLabels.iLabelAccent.Copy( ptr6 ); |
|
1375 |
|
1376 CleanupStack::PopAndDestroy( 1 ); //reader |
|
1377 } |
|
1378 |
|
1379 // --------------------------------------------------------------------------- |
|
1380 // Utils to get context value |
|
1381 // --------------------------------------------------------------------------- |
|
1382 // |
|
1383 TInt CPeninputGenericVkbWindow::IntContext( TPeninputDataType aDataIndex ) |
|
1384 { |
|
1385 return CPeninputDataConverter::AnyToInt( |
|
1386 iLayoutContext->RequestData( aDataIndex )); |
|
1387 } |
|
1388 |
|
1389 // -------------------------------------------------------------------------- |
|
1390 // CPeninputGenericVkbWindow::ResetAccentButton |
|
1391 // (other items were commented in a header) |
|
1392 // -------------------------------------------------------------------------- |
|
1393 // |
|
1394 void CPeninputGenericVkbWindow::ResetAccentButton() |
|
1395 { |
|
1396 TInt curRange = CPeninputDataConverter::AnyToInt |
|
1397 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1398 |
|
1399 if ( iRangeBar ) |
|
1400 { |
|
1401 iRangeBar->ActiveRange( curRange ); |
|
1402 } |
|
1403 } |
|
1404 |
|
1405 // -------------------------------------------------------------------------- |
|
1406 // CPeninputGenericVkbWindow::PopupWindowSizeChange |
|
1407 // (other items were commented in a header) |
|
1408 // -------------------------------------------------------------------------- |
|
1409 // |
|
1410 void CPeninputGenericVkbWindow::PopupWindowSizeChange() |
|
1411 { |
|
1412 if (CPeninputDataConverter::AnyToInt( |
|
1413 iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) || (!iPopupSet)) |
|
1414 { |
|
1415 // if size changing, or popup window's property has not been set yet |
|
1416 TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine(); |
|
1417 iAppWndRect = appWnd.Rect(); |
|
1418 |
|
1419 TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine(); |
|
1420 TAknLayoutRect mainPaneRect; |
|
1421 mainPaneRect.LayoutRect(iAppWndRect, mainPane); |
|
1422 |
|
1423 TAknWindowLineLayout choiceWnd = |
|
1424 AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine(); |
|
1425 TAknLayoutRect choiceRect; |
|
1426 choiceRect.LayoutRect(mainPaneRect.Rect(), choiceWnd); |
|
1427 |
|
1428 iPopupItemRect = TRect(0, 0, choiceRect.Rect().Width(), |
|
1429 AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH); |
|
1430 |
|
1431 iChoiceTextLayout = |
|
1432 AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine(); |
|
1433 } |
|
1434 |
|
1435 const CFont* font = AknLayoutUtils::FontFromId(iChoiceTextLayout.iFont, NULL); |
|
1436 iPopupWnd->SetFont(font); |
|
1437 iPopupWnd->SetItemRect(iPopupItemRect, iPopupItemRect); |
|
1438 |
|
1439 TInt leftMargin = iChoiceTextLayout.il; |
|
1440 |
|
1441 iPopupWnd->SetMarginAndBaseline(leftMargin, font->HeightInPixels()); |
|
1442 |
|
1443 iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(iChoiceTextLayout.iC)); |
|
1444 |
|
1445 AknIconUtils::SetSize(iPopupWndBgImg, TSize(iPopupItemRect.Width(), |
|
1446 iPopupItemRect.Height()*3), EAspectRatioNotPreserved); |
|
1447 AknIconUtils::SetSize(iPopupWndFocusImg, TSize(iPopupItemRect.Width(), |
|
1448 iPopupItemRect.Height()* 3), EAspectRatioNotPreserved); |
|
1449 |
|
1450 iPopupSet = ETrue; |
|
1451 } |
|
1452 |
|
1453 |
|
1454 // -------------------------------------------------------------------------- |
|
1455 // CPeninputGenericVkbWindow::GetPopupWndInfoFromRes |
|
1456 // (other items were commented in a header) |
|
1457 // -------------------------------------------------------------------------- |
|
1458 // |
|
1459 void CPeninputGenericVkbWindow::GetPopupWndInfoFromResL( TResourceReader aRes, |
|
1460 const TRect& aRect ) |
|
1461 { |
|
1462 TPtrC bmpFileName = aRes.ReadTPtrC(); |
|
1463 TInt32 imgMajorSkinId = aRes.ReadInt32(); |
|
1464 |
|
1465 TAknsItemID id; |
|
1466 |
|
1467 MAknsSkinInstance* skininstance = UiLayout()->SkinInstance(); |
|
1468 |
|
1469 TInt popWinBmpId = aRes.ReadInt16(); |
|
1470 TInt popWinBmpMaskId = aRes.ReadInt16(); |
|
1471 TInt popWinBmpSkinId = aRes.ReadInt16(); |
|
1472 |
|
1473 id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId ); |
|
1474 |
|
1475 if ( popWinBmpId != KInvalidImg ) |
|
1476 { |
|
1477 AknsUtils::CreateIconL( skininstance, |
|
1478 id, |
|
1479 iPopupWndBgImg, |
|
1480 bmpFileName, |
|
1481 popWinBmpId ); |
|
1482 |
|
1483 AknIconUtils::SetSize( iPopupWndBgImg, TSize( aRect.Width(), |
|
1484 aRect.Height() * 3 ), EAspectRatioNotPreserved ); |
|
1485 iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg ); |
|
1486 } |
|
1487 |
|
1488 TInt focusBmpId = aRes.ReadInt16(); |
|
1489 TInt focusBmpMaskId = aRes.ReadInt16(); |
|
1490 TInt focusBmpSkinId = aRes.ReadInt16(); |
|
1491 |
|
1492 id.Set( TInt( imgMajorSkinId ), focusBmpSkinId ); |
|
1493 |
|
1494 if ( focusBmpId != KInvalidImg ) |
|
1495 { |
|
1496 AknsUtils::CreateIconL( skininstance, |
|
1497 id, |
|
1498 iPopupWndFocusImg, |
|
1499 bmpFileName, |
|
1500 focusBmpId ); |
|
1501 |
|
1502 AknIconUtils::SetSize( iPopupWndFocusImg, TSize( aRect.Width(), |
|
1503 aRect.Height() * 3 ), EAspectRatioNotPreserved ); |
|
1504 iPopupWnd->SetFocusBmp( iPopupWndFocusImg ); |
|
1505 } |
|
1506 } |
|
1507 |
|
1508 // -------------------------------------------------------------------------- |
|
1509 // CAknFepVkbClientArea::AddRangeBarL |
|
1510 // (other items were commented in a header) |
|
1511 // -------------------------------------------------------------------------- |
|
1512 // |
|
1513 void CPeninputGenericVkbWindow::AddRangeBarL() |
|
1514 { |
|
1515 // Range bar |
|
1516 iRangeBar = CAknFepCtrlRangeBar::NewL( UiLayout(), |
|
1517 EPeninutWindowCtrlIdRangeBar, |
|
1518 CAknFepCtrlRangeBar::EBtnGroupHorizontal ); |
|
1519 |
|
1520 // Set event id |
|
1521 iRangeBar->SetEventIdForRange( EPeninputLayoutEventRange ); |
|
1522 iRangeBar->SetEventIdForCase( EPeninputLayoutEventRangeLoop ); |
|
1523 |
|
1524 AddControlL( iRangeBar ); |
|
1525 iRangeBar->AddEventObserver(UiLayout()); |
|
1526 } |
|
1527 |
|
1528 // -------------------------------------------------------------------------- |
|
1529 // CPeninputGenericVkbWindow::AddButtonL |
|
1530 // (other items were commented in a header) |
|
1531 // -------------------------------------------------------------------------- |
|
1532 // |
|
1533 CAknFepCtrlEventButton* CPeninputGenericVkbWindow::AddButtonL( |
|
1534 const TInt aControlId, const TInt aEventId, const TInt aResId, |
|
1535 const TInt aUnicode, const TBool aIsRepeat ) |
|
1536 { |
|
1537 CAknFepCtrlEventButton* button = NULL; |
|
1538 |
|
1539 if ( aIsRepeat ) |
|
1540 { |
|
1541 button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId, |
|
1542 aEventId, aUnicode ); |
|
1543 } |
|
1544 else |
|
1545 { |
|
1546 if ( aControlId == EPeninutWindowCtrlIdMultiRangeBtn ) |
|
1547 { |
|
1548 button = CAknFepCtrlLongPressButton::NewL( UiLayout(), aControlId, |
|
1549 aEventId, aUnicode, |
|
1550 KAknsIIDQsnFrFunctionButtonNormal, |
|
1551 KAknsIIDQsnFrFunctionButtonPressed, |
|
1552 KAknsIIDQsnFrFunctionButtonInactive ); |
|
1553 } |
|
1554 else |
|
1555 { |
|
1556 button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId, |
|
1557 aEventId, aUnicode, |
|
1558 KAknsIIDQsnFrFunctionButtonNormal, |
|
1559 KAknsIIDQsnFrFunctionButtonPressed, |
|
1560 KAknsIIDQsnFrFunctionButtonInactive ); |
|
1561 } |
|
1562 } |
|
1563 |
|
1564 CleanupStack::PushL( button ); |
|
1565 if ( button ) |
|
1566 { |
|
1567 // Read resource |
|
1568 TResourceReader reader; |
|
1569 |
|
1570 CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); |
|
1571 button->SetResourceId( aResId ); |
|
1572 button->ConstructFromResourceL(); |
|
1573 // Pop and destroy reader |
|
1574 CleanupStack::PopAndDestroy( 1 ); |
|
1575 |
|
1576 // Add into the control pool |
|
1577 AddControlL( button ); |
|
1578 button->AddEventObserver(UiLayout()); |
|
1579 |
|
1580 } |
|
1581 CleanupStack::Pop( button ); |
|
1582 |
|
1583 return button; |
|
1584 } |
|
1585 |
|
1586 // -------------------------------------------------------------------------- |
|
1587 // CPeninputGenericVkbWindow::DoCaseChange |
|
1588 // (other items were commented in a header) |
|
1589 // -------------------------------------------------------------------------- |
|
1590 // |
|
1591 void CPeninputGenericVkbWindow::DoCaseChange( TInt aNewCase ) |
|
1592 { |
|
1593 TInt curCase = CPeninputDataConverter::AnyToInt |
|
1594 ( iLayoutContext->RequestData( EPeninputDataTypeCase ) ); |
|
1595 |
|
1596 if ( aNewCase == curCase ) |
|
1597 { |
|
1598 return; |
|
1599 } |
|
1600 |
|
1601 TInt curRange = CPeninputDataConverter::AnyToInt |
|
1602 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1603 |
|
1604 if ((( curRange == ERangeAccent ) || ( ( curRange == ERangeEnglish ) |
|
1605 || ( ( curRange == ERangeNative ) && ( ConfigInfo()->CaseSensitive()) ) ) ) ) |
|
1606 { |
|
1607 // Set shift and caplock button |
|
1608 TInt shfit; |
|
1609 TInt capslock; |
|
1610 |
|
1611 CPeninputDataConverter::ShiftCapslockByCase( aNewCase, |
|
1612 shfit, capslock ); |
|
1613 |
|
1614 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shfit ); |
|
1615 //ChangeButtonStatus( shfit, EPeninutWindowCtrlIdShiftBtn ); |
|
1616 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock ); |
|
1617 //ChangeButtonStatus( capslock, EPeninutWindowCtrlIdCapslockBtn ); |
|
1618 iLayoutContext->SetData( EPeninputDataTypeCase, &aNewCase ); |
|
1619 ChangeMergedButtonStatus( shfit, capslock ); |
|
1620 |
|
1621 TInt vkblayout = ConfigInfo()->ShiftCapsSingleVkbLayoutByCase |
|
1622 ( curRange, aNewCase ); |
|
1623 |
|
1624 if ( curRange == ERangeAccent ) |
|
1625 { |
|
1626 TInt curAccentIndex = CPeninputDataConverter::AnyToInt |
|
1627 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) ); |
|
1628 vkblayout = vkblayout + curAccentIndex * 2; |
|
1629 } |
|
1630 |
|
1631 ChangeVkbLayout( vkblayout ); |
|
1632 } |
|
1633 } |
|
1634 |
|
1635 // --------------------------------------------------------------------------- |
|
1636 // CPeninputGenericVkbWindow::BackgroundConstructL |
|
1637 // Do background construct. |
|
1638 // --------------------------------------------------------------------------- |
|
1639 // |
|
1640 TInt CPeninputGenericVkbWindow::BackgroundTaskL(TAny* aPtr) |
|
1641 { |
|
1642 CPeninputGenericVkbWindow* self = static_cast<CPeninputGenericVkbWindow*>(aPtr); |
|
1643 self->DoIdleConstructL(); |
|
1644 return EFalse; // only run once |
|
1645 } |
|
1646 |
|
1647 |
|
1648 void CPeninputGenericVkbWindow::DoIdleConstructL() |
|
1649 { |
|
1650 if(iPopupInited) |
|
1651 return; |
|
1652 |
|
1653 |
|
1654 // Read resource |
|
1655 TResourceReader reader; |
|
1656 |
|
1657 CCoeEnv::Static()->CreateResourceReaderLC( reader, |
|
1658 R_PENINPUT_LAYOUT_VKB_POPUP_WINDOW ); |
|
1659 |
|
1660 GetPopupWndInfoFromResL(reader, iPopupItemRect); |
|
1661 |
|
1662 // Pop and destroy reader |
|
1663 CleanupStack::PopAndDestroy( 1 ); |
|
1664 |
|
1665 } |
|
1666 |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // CPeninputGenericVkbWindow::ConstructFromResourceL |
|
1669 // (other items were commented in a header). |
|
1670 // ----------------------------------------------------------------------------- |
|
1671 // |
|
1672 void CPeninputGenericVkbWindow::ConstructFromResourceL() |
|
1673 { |
|
1674 CPeninputLayoutWindowExt::ConstructFromResourceL(); |
|
1675 if( iVkbLayout && !iFirstConstruct ) |
|
1676 { |
|
1677 if( iVkbCtrl->IsIrregularKeyBoard() ) |
|
1678 iVkbLayout->ConstructFromIrregularResourceL(); |
|
1679 else |
|
1680 iVkbLayout->ConstructFromNonIrregularResourceL(); |
|
1681 |
|
1682 //SetVkbLayoutSize(); |
|
1683 |
|
1684 if( IsRtoLLanguage( iLanguage ) ) |
|
1685 { |
|
1686 //Mirror backspace graphic |
|
1687 HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn ); |
|
1688 } |
|
1689 } |
|
1690 |
|
1691 iFirstConstruct = EFalse; |
|
1692 } |
|
1693 |
|
1694 // ----------------------------------------------------------------------------- |
|
1695 // CPeninputGenericVkbWindow::SetSwitchlistLanguage |
|
1696 // (other items were commented in a header). |
|
1697 // ----------------------------------------------------------------------------- |
|
1698 // |
|
1699 void CPeninputGenericVkbWindow::SetSwitchlistLanguage(TInt aLang) |
|
1700 { |
|
1701 ASSERT( IsValidLanguage( aLang ) ); |
|
1702 //Check language input direction change |
|
1703 TBool isLangDirectionChange = EFalse; |
|
1704 if( IsValidLanguage( iLanguage ) ) |
|
1705 isLangDirectionChange = IsRtoLLanguage( aLang ) ^ IsRtoLLanguage( iLanguage ); |
|
1706 else |
|
1707 isLangDirectionChange = IsRtoLLanguage( aLang ); |
|
1708 |
|
1709 if( aLang ==ELangHebrew || |
|
1710 aLang == ELangGreek || |
|
1711 aLang == ELangHindi || |
|
1712 aLang == ELangMarathi ) |
|
1713 { |
|
1714 iLafMgr->SetLafOption( (TPeninputVkbLafOption) |
|
1715 ( iLafMgr->OptionType() &(~EOption3CellRange) ) ); |
|
1716 } |
|
1717 else |
|
1718 { |
|
1719 iLafMgr->SetLafOption( (TPeninputVkbLafOption) |
|
1720 ( iLafMgr->OptionType() | EOption3CellRange) ); |
|
1721 } |
|
1722 |
|
1723 if( isLangDirectionChange ) |
|
1724 { |
|
1725 //Mirror backspace graphic |
|
1726 HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn ); |
|
1727 } |
|
1728 |
|
1729 iLanguage = aLang; |
|
1730 } |
|
1731 |
|
1732 // ----------------------------------------------------------------------------- |
|
1733 // CPeninputGenericVkbWindow::SetSwitchlistSecretFlag |
|
1734 // (other items were commented in a header). |
|
1735 // ----------------------------------------------------------------------------- |
|
1736 // |
|
1737 void CPeninputGenericVkbWindow::SetSwitchlistSecretFlag(TBool aSecret) |
|
1738 { |
|
1739 CPeninputLayoutInputmodelChoice* choiceList = |
|
1740 static_cast<CPeninputLayoutInputmodelChoice*>( |
|
1741 Control(EPeninutWindowCtrlIdSwitcherPopupWindow )); |
|
1742 |
|
1743 if ( choiceList ) |
|
1744 { |
|
1745 choiceList->SetSecretEditor( aSecret ); |
|
1746 } |
|
1747 //disable or enable arrow keys of FSQ in secret editor. |
|
1748 } |
|
1749 |
|
1750 // --------------------------------------------------------------------------- |
|
1751 // CPeninputGenericVkbWindow::DimArrowKeys |
|
1752 // (other items were commented in a header). |
|
1753 // --------------------------------------------------------------------------- |
|
1754 // |
|
1755 void CPeninputGenericVkbWindow::DimArrowKeys( TBool aDimArrow ) |
|
1756 { |
|
1757 if(iLayoutContext->LayoutType() == EPluginInputModeFSQ |
|
1758 && iArrowLeftButton && iArrowRightButton) |
|
1759 { |
|
1760 iArrowLeftButton->SetDimmed( aDimArrow ); |
|
1761 iArrowRightButton->SetDimmed( aDimArrow ); |
|
1762 } |
|
1763 } |
|
1764 |
|
1765 void CPeninputGenericVkbWindow::DimEnterKey( TBool aDimmed ) |
|
1766 { |
|
1767 CAknFepCtrlEventButton* enterBtn = static_cast<CAknFepCtrlEventButton*> |
|
1768 ( Control(EPeninutWindowCtrlIdEnterBtn) ); |
|
1769 if(iLayoutContext->LayoutType() == EPluginInputModeFSQ |
|
1770 && enterBtn ) |
|
1771 { |
|
1772 enterBtn->SetDimmed( aDimmed ); |
|
1773 } |
|
1774 } |
|
1775 |
|
1776 // --------------------------------------------------------------------------- |
|
1777 // CAknFepVkbWindow::PopupAccentWindow |
|
1778 // (other items were commented in a header). |
|
1779 // --------------------------------------------------------------------------- |
|
1780 // |
|
1781 void CPeninputGenericVkbWindow::PopupSwitchWindowL() |
|
1782 { |
|
1783 CFepUiBaseCtrl* accentBtn = Control(EPeninutWindowCtrlIdSwitchToHwrBtn); |
|
1784 |
|
1785 if ( accentBtn ) |
|
1786 { |
|
1787 if (!iPopupInited) |
|
1788 { |
|
1789 DoIdleConstructL(); |
|
1790 } |
|
1791 TRect rect = accentBtn->Rect(); |
|
1792 static_cast<CPeninputLayoutInputmodelChoice*> |
|
1793 (Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->PopUpSwitchListL( accentBtn->Rect() ); |
|
1794 } |
|
1795 } |
|
1796 |
|
1797 // --------------------------------------------------------------------------- |
|
1798 // CPeninputGenericVkbWindow::SetDeadKey |
|
1799 // (Set DeadKey) |
|
1800 // --------------------------------------------------------------------------- |
|
1801 // |
|
1802 void CPeninputGenericVkbWindow::SetDeadKey() |
|
1803 { |
|
1804 // Get VKB list |
|
1805 RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo; |
|
1806 vkbListInfo = iVkbLayout->VkbLayoutInfoList(); |
|
1807 TInt vkbListNum = vkbListInfo.Count(); |
|
1808 |
|
1809 CPeninputVkbKeyInfo* pVKBKeyInfo; |
|
1810 CVirtualKey* pKey; |
|
1811 TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair); |
|
1812 for(TInt i = 0; i < vkbListNum; i++) |
|
1813 { |
|
1814 for(TInt j = 0; j < count; j++) |
|
1815 { |
|
1816 if(vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeChar || |
|
1817 vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeCharShift) |
|
1818 { |
|
1819 pVKBKeyInfo = vkbListInfo[i]->FindKey( KSupportLanguages[j].iDeadKey ); |
|
1820 if(pVKBKeyInfo) |
|
1821 { |
|
1822 // Set the DeadKey as a latch button |
|
1823 pKey = pVKBKeyInfo->Key(); |
|
1824 pKey->SetLatchKey(ETrue); |
|
1825 } |
|
1826 } |
|
1827 } |
|
1828 } |
|
1829 } |
|
1830 |
|
1831 |
|
1832 // --------------------------------------------------------------------------- |
|
1833 // CPeninputGenericVkbWindow::UnLatchDeadKey |
|
1834 // (Unlatch the DeadKey) |
|
1835 // --------------------------------------------------------------------------- |
|
1836 // |
|
1837 void CPeninputGenericVkbWindow::UnLatchDeadKey( const TDesC& abuf ) |
|
1838 { |
|
1839 RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo; |
|
1840 vkbListInfo = iVkbLayout->VkbLayoutInfoList(); |
|
1841 TInt vkbListNum = vkbListInfo.Count(); |
|
1842 |
|
1843 CPeninputVkbKeyInfo* pVKBKeyInfo; |
|
1844 CVirtualKey* pKey; |
|
1845 TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair); |
|
1846 for(TInt i = 0; i < vkbListNum; i++) |
|
1847 { |
|
1848 for(TInt j = 0; j < count; j++) |
|
1849 { |
|
1850 // Only NativeChar and NativeCharShift layout contain DeadKey |
|
1851 if(vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeChar || |
|
1852 vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeCharShift) |
|
1853 { |
|
1854 // Find the DeadKey in NativeChar or NativeCharShift layout |
|
1855 pVKBKeyInfo = vkbListInfo[i]->FindKey( KSupportLanguages[j].iDeadKey ); |
|
1856 if(pVKBKeyInfo) |
|
1857 { |
|
1858 pKey = pVKBKeyInfo->Key(); |
|
1859 if(pKey->Latched()) |
|
1860 { |
|
1861 if(abuf == KNullDesC) |
|
1862 { |
|
1863 // When focus change, the latched key will be released |
|
1864 TBool deadKeyChange = EFalse; |
|
1865 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
1866 pKey->SetLatched(EFalse); |
|
1867 TRect rect = pKey->Rect(); |
|
1868 rect.Move( iVkbCtrl->Rect().iTl ); |
|
1869 UpdateArea( rect, EFalse ); |
|
1870 return; |
|
1871 } |
|
1872 if(abuf[0] == KSupportLanguages[j].iDeadKey) |
|
1873 { |
|
1874 // When another DeadKey is clicked, the old one will be released |
|
1875 pKey->SetLatched(EFalse); |
|
1876 TRect rect = pKey->Rect(); |
|
1877 rect.Move( iVkbCtrl->Rect().iTl ); |
|
1878 UpdateArea( rect, EFalse ); |
|
1879 return; |
|
1880 } |
|
1881 } |
|
1882 } |
|
1883 } |
|
1884 } |
|
1885 } |
|
1886 } |
|
1887 |
|
1888 // --------------------------------------------------------------------------- |
|
1889 // CPeninputGenericVkbWindow::HandleAccentCharEvent |
|
1890 // (Unlatch the DeadKey) |
|
1891 // --------------------------------------------------------------------------- |
|
1892 // |
|
1893 TBool CPeninputGenericVkbWindow::HandleAccentCharEvent( TInt /*aEventType*/, |
|
1894 const TDesC& aEventData, |
|
1895 const TDesC& aDeadKey, |
|
1896 HBufC* anewCharBuf ) |
|
1897 { |
|
1898 // Get the unicode of virtual key char |
|
1899 TBuf<16> buf; |
|
1900 TKeyEvent* event = (TKeyEvent*) aEventData.Ptr(); |
|
1901 buf.Append(event->iCode); |
|
1902 TBool rs = EFalse; |
|
1903 |
|
1904 // Caculate the accent char number |
|
1905 TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair); |
|
1906 TInt i = 0; |
|
1907 if(aDeadKey.Compare( KNullDesC ) != 0) // One DeadKey is latched |
|
1908 { |
|
1909 for(i = 0; i < count; i++) |
|
1910 { |
|
1911 if((aDeadKey[0] == KSupportLanguages[i].iDeadKey) && |
|
1912 (buf[0] == KSupportLanguages[i].iChar)) |
|
1913 { |
|
1914 if(anewCharBuf) |
|
1915 { |
|
1916 anewCharBuf->Des().Append(KSupportLanguages[i].iAccentedChar); |
|
1917 rs = ETrue; |
|
1918 } |
|
1919 break; |
|
1920 } |
|
1921 } |
|
1922 } |
|
1923 return rs; |
|
1924 } |
|
1925 |
|
1926 |
|
1927 // --------------------------------------------------------------------------- |
|
1928 // CPeninputGenericVkbWindow::HandleVirtualKeyLatchedEvent |
|
1929 // (Handle virtual key latched event). |
|
1930 // --------------------------------------------------------------------------- |
|
1931 // |
|
1932 void CPeninputGenericVkbWindow::HandleVirtualKeyLatchedEvent(TInt /*aEventType*/, |
|
1933 CFepUiBaseCtrl* /*aCtrl*/, |
|
1934 const TDesC& aEventData ) |
|
1935 { |
|
1936 TBuf<16> deadKey(KNullDesC); |
|
1937 TKeyEvent* event = (TKeyEvent*) aEventData.Ptr(); |
|
1938 deadKey.Append(event->iCode); |
|
1939 |
|
1940 TInt latchedFlag = CPeninputDataConverter::AnyToInt( |
|
1941 iLayoutContext->RequestData(EAkninputDataTypeLatchedSet)); |
|
1942 if(latchedFlag) |
|
1943 { |
|
1944 // Update the new and old DeadKey buffer |
|
1945 iOldDeadKeyBuf = iNewDeadKeyBuf; |
|
1946 iNewDeadKeyBuf = deadKey; |
|
1947 |
|
1948 HBufC* newCharBuf = HBufC::New( 2*iOldDeadKeyBuf.Length() ); |
|
1949 if( newCharBuf ) |
|
1950 { |
|
1951 CPeninputGenericVkbLayout* layout |
|
1952 = static_cast<CPeninputGenericVkbLayout*>( UiLayout() ); |
|
1953 if( layout->IsEnableITIOnFSQ() ) |
|
1954 { |
|
1955 // If ITI is open, double same keys should be send for one dead key, |
|
1956 // core will handle them as one key. |
|
1957 newCharBuf->Des().Append( iOldDeadKeyBuf ); |
|
1958 } |
|
1959 newCharBuf->Des().Append( iOldDeadKeyBuf ); |
|
1960 } |
|
1961 |
|
1962 // Submit old DeadKey |
|
1963 UiLayout()->SignalOwner(ESignalKeyEvent, *newCharBuf); |
|
1964 delete newCharBuf; |
|
1965 |
|
1966 // Unlatch the previous DeadKey |
|
1967 UnLatchDeadKey(iOldDeadKeyBuf); |
|
1968 |
|
1969 |
|
1970 } |
|
1971 else |
|
1972 { |
|
1973 iNewDeadKeyBuf = deadKey; |
|
1974 |
|
1975 // Set DeadKey state to latched |
|
1976 TBool deadKeyChange = ETrue; |
|
1977 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
1978 } |
|
1979 } |
|
1980 |
|
1981 // --------------------------------------------------------------------------- |
|
1982 // CPeninputCommonLayout::HandleVirtualKeyUpEvent |
|
1983 // (Handle virtual key up event). |
|
1984 // --------------------------------------------------------------------------- |
|
1985 // |
|
1986 TBool CPeninputGenericVkbWindow::HandleVirtualKeyUpEvent(TInt aEventType, |
|
1987 CFepUiBaseCtrl* /*aCtrl*/, |
|
1988 const TDesC& aEventData ) |
|
1989 { |
|
1990 // Get DeadKey state |
|
1991 TInt latchedFlag = CPeninputDataConverter::AnyToInt( |
|
1992 iLayoutContext->RequestData(EAkninputDataTypeLatchedSet)); |
|
1993 if(latchedFlag) |
|
1994 { |
|
1995 TBool ret = EFalse; |
|
1996 |
|
1997 TRAP_IGNORE(ret = HandleDeadKeyL(aEventType,aEventData)) |
|
1998 |
|
1999 if(ret) |
|
2000 { |
|
2001 return ETrue; |
|
2002 } |
|
2003 else |
|
2004 { |
|
2005 // When the DeadKey can not combine with current character, |
|
2006 // Sumit current DeadKey |
|
2007 UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf ); |
|
2008 } |
|
2009 } |
|
2010 |
|
2011 iNewDeadKeyBuf = KNullDesC; |
|
2012 return EFalse; |
|
2013 } |
|
2014 |
|
2015 TBool CPeninputGenericVkbWindow::HandleDeadKeyL(TInt aEventType, |
|
2016 const TDesC& aEventData ) |
|
2017 { |
|
2018 // Set DeadKey to unlatched state |
|
2019 TBool deadKeyChange = EFalse; |
|
2020 iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); |
|
2021 UnLatchDeadKey(iNewDeadKeyBuf); |
|
2022 |
|
2023 CPeninputGenericVkbLayout* layout |
|
2024 = static_cast<CPeninputGenericVkbLayout*>( UiLayout() ); |
|
2025 if ( layout->IsEnableITIOnFSQ() ) |
|
2026 { |
|
2027 TBuf<KKeyCodeSize> buf; |
|
2028 TKeyEvent* event = (TKeyEvent*) aEventData.Ptr(); |
|
2029 buf.Append(event->iCode); |
|
2030 |
|
2031 HBufC* newCharBuf = HBufC::New( iNewDeadKeyBuf.Length() + buf.Length() ); |
|
2032 if( newCharBuf ) |
|
2033 { |
|
2034 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
2035 newCharBuf->Des().Append( buf ); |
|
2036 } |
|
2037 |
|
2038 // Submit DeadKey + Key at the same time |
|
2039 UiLayout()->SignalOwner(ESignalKeyEvent,*newCharBuf); |
|
2040 |
|
2041 delete newCharBuf; |
|
2042 |
|
2043 return ETrue; |
|
2044 } |
|
2045 |
|
2046 // Get the accent char |
|
2047 HBufC* newCharBuf = HBufC::NewL(1); |
|
2048 if(HandleAccentCharEvent(aEventType, |
|
2049 aEventData, |
|
2050 iNewDeadKeyBuf, |
|
2051 newCharBuf)) |
|
2052 { |
|
2053 // Send ths accent key to FEP |
|
2054 UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf); |
|
2055 iNewDeadKeyBuf = KNullDesC; |
|
2056 delete newCharBuf; |
|
2057 return ETrue; |
|
2058 } |
|
2059 delete newCharBuf; |
|
2060 |
|
2061 return EFalse; |
|
2062 } |
|
2063 |
|
2064 void CPeninputGenericVkbWindow::SetLafLayOut(TInt aRows, TInt aColumns) |
|
2065 { |
|
2066 iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(aRows,aColumns)); |
|
2067 } |
|
2068 |
|
2069 |
|
2070 void CPeninputGenericVkbWindow::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl) |
|
2071 { |
|
2072 AddControlL(aCtrl); |
|
2073 } |
|
2074 |
|
2075 TBool CPeninputGenericVkbWindow::CreateCustomControlL( TInt16 aControlId, TInt32 aImageId ) |
|
2076 { |
|
2077 TBool create = ETrue; |
|
2078 switch ( aControlId ) |
|
2079 { |
|
2080 case EPeninutWindowCtrlIdMoveBtn: |
|
2081 { |
|
2082 if ( !iMoveButton ) |
|
2083 { |
|
2084 iMoveButton = CAknFepCtrlDragButton::NewL(UiLayout(), EPeninutWindowCtrlIdMoveBtn); |
|
2085 AddControlL(iMoveButton); |
|
2086 iMoveButton->AddPositionObserver(this); |
|
2087 iMoveButton->AddEventObserver( UiLayout() ); |
|
2088 iMoveButton->SetResourceId( aImageId ); |
|
2089 iMoveButton->SetImageFrameId(KAknsIIDQsnFrFunctionButtonNormal, |
|
2090 KAknsIIDQsnFrFunctionButtonPressed, |
|
2091 KAknsIIDQsnFrFunctionButtonInactive); |
|
2092 UiLayout()->EnableLayoutMoving( static_cast<CDragBar*>( iMoveButton ) ); |
|
2093 } |
|
2094 iMoveButton->ConstructFromResourceL(); |
|
2095 } |
|
2096 break; |
|
2097 case EPeninupWindowCtrlIdArrowLeftBtn: |
|
2098 { |
|
2099 if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ ) |
|
2100 { |
|
2101 break; |
|
2102 } |
|
2103 |
|
2104 if (!iArrowLeftButton) |
|
2105 { |
|
2106 |
|
2107 iArrowLeftButton = CAknFepCtrlRepeatButton::NewL( |
|
2108 UiLayout(), aControlId, EPeninputLayoutEventLeftArrow, EKeyLeftArrow, |
|
2109 KAknsIIDQsnFrFunctionButtonNormal, |
|
2110 KAknsIIDQsnFrFunctionButtonPressed, |
|
2111 KAknsIIDQsnFrFunctionButtonInactive ); |
|
2112 |
|
2113 AddControlL(iArrowLeftButton); |
|
2114 iArrowLeftButton->AddEventObserver(UiLayout()); |
|
2115 iArrowLeftButton->SetResourceId( aImageId ); |
|
2116 } |
|
2117 |
|
2118 iArrowLeftButton->ConstructFromResourceL(); |
|
2119 } |
|
2120 break; |
|
2121 case EPeninupWindowCtrlIdArrowRightBtn: |
|
2122 { |
|
2123 if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ ) |
|
2124 { |
|
2125 break; |
|
2126 } |
|
2127 |
|
2128 if (!iArrowRightButton) |
|
2129 { |
|
2130 iArrowRightButton = CAknFepCtrlRepeatButton::NewL( |
|
2131 UiLayout(), aControlId, EPeninputLayoutEventRightArrow, EKeyRightArrow, |
|
2132 KAknsIIDQsnFrFunctionButtonNormal, |
|
2133 KAknsIIDQsnFrFunctionButtonPressed, |
|
2134 KAknsIIDQsnFrFunctionButtonInactive ); |
|
2135 |
|
2136 AddControlL(iArrowRightButton); |
|
2137 iArrowRightButton->AddEventObserver(UiLayout()); |
|
2138 iArrowRightButton->SetResourceId( aImageId ); |
|
2139 |
|
2140 } |
|
2141 iArrowRightButton->ConstructFromResourceL(); |
|
2142 } |
|
2143 break; |
|
2144 default: |
|
2145 { |
|
2146 create = EFalse; |
|
2147 } |
|
2148 } |
|
2149 return create; |
|
2150 } |
|
2151 |
|
2152 void CPeninputGenericVkbWindow::SetPromptTextL(TUint8* aData) |
|
2153 { |
|
2154 RDesReadStream readStream; |
|
2155 |
|
2156 TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt)); |
|
2157 readStream.Open(countPtr); |
|
2158 CleanupClosePushL(readStream); |
|
2159 const TInt dataCount = readStream.ReadInt32L(); |
|
2160 const TInt textCount = readStream.ReadInt32L(); |
|
2161 CleanupStack::PopAndDestroy(&readStream); |
|
2162 |
|
2163 TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
2164 readStream.Open(ptr); |
|
2165 CleanupClosePushL(readStream); |
|
2166 |
|
2167 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
2168 TPtr8 dataBufPtr = dataBuf->Des(); |
|
2169 readStream.ReadL(dataBufPtr, dataCount); |
|
2170 |
|
2171 TFepPromptText* pIcfData = |
|
2172 reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
2173 |
|
2174 HBufC* textBuf; |
|
2175 if (textCount > 0) |
|
2176 { |
|
2177 textBuf = HBufC::NewLC(textCount/2); |
|
2178 TPtr textBufPtr = textBuf->Des(); |
|
2179 readStream.ReadL(textBufPtr, textCount/2); |
|
2180 static_cast<CFepLayoutMultiLineIcf*> |
|
2181 (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL |
|
2182 (textBuf->Des(), pIcfData->iCleanContent); |
|
2183 CleanupStack::PopAndDestroy(textBuf); |
|
2184 } |
|
2185 else |
|
2186 { |
|
2187 static_cast<CFepLayoutMultiLineIcf*> |
|
2188 (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL(KNullDesC, pIcfData->iCleanContent); |
|
2189 } |
|
2190 |
|
2191 CleanupStack::PopAndDestroy(dataBuf); |
|
2192 CleanupStack::PopAndDestroy(&readStream); |
|
2193 } |
|
2194 |
|
2195 void CPeninputGenericVkbWindow::UpdateLafData() |
|
2196 { |
|
2197 TRAP_IGNORE( iLafMgr->UpdateLafDataL() ); |
|
2198 } |
|
2199 |
|
2200 void CPeninputGenericVkbWindow::ReorgnizeICFAndButtons() |
|
2201 { |
|
2202 TRect rect; |
|
2203 |
|
2204 TPoint winPoint = Rect().iTl; |
|
2205 TPoint LafPoint = iLafMgr->EntirePaneRect().iTl; |
|
2206 |
|
2207 TInt x = winPoint.iX - LafPoint.iX; |
|
2208 TInt y = winPoint.iY - LafPoint.iY; |
|
2209 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
2210 { |
|
2211 x = 0; |
|
2212 y = 0; |
|
2213 } |
|
2214 |
|
2215 TRect inRect; |
|
2216 TRect exRect; |
|
2217 |
|
2218 |
|
2219 rect = iLafMgr->ICFRect(); |
|
2220 rect.Move(x, y); |
|
2221 |
|
2222 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2223 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2224 |
|
2225 const CFont* icfFont = iLafMgr->ICFTextFont(); |
|
2226 |
|
2227 // set icf margin |
|
2228 TPeninputICFConfig icfConfig; |
|
2229 iLafMgr->GetICFConfig( icfConfig ); |
|
2230 icf->SetTextMargin( icfConfig.iLeftMargin, |
|
2231 icfConfig.iRightMargin, |
|
2232 icfConfig.iTopMargin, |
|
2233 0 ); |
|
2234 icf->SetLineSpace( icfConfig.iLineSpaceMargin ); |
|
2235 TRAP_IGNORE(icf->SizeChangedL( |
|
2236 rect, |
|
2237 icfConfig.iTextLineHeight, |
|
2238 icfFont->FontMaxHeight(), |
|
2239 icfFont)); |
|
2240 |
|
2241 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
2242 { |
|
2243 iLafMgr->GetButtonRect( |
|
2244 EPeninutWindowCtrlIdMultiRangeBtn, exRect, inRect ); |
|
2245 exRect.Move(x, y); |
|
2246 inRect.Move(x, y); |
|
2247 static_cast<CAknFepCtrlEventButton*> |
|
2248 ( Control( EPeninutWindowCtrlIdMultiRangeBtn ))->SizeChanged( |
|
2249 exRect, inRect, ETrue ); |
|
2250 |
|
2251 TRAP_IGNORE( icf->MsgBubbleCtrl()->SetTextL( KEmptyString )); |
|
2252 iIndiWithText = EFalse; |
|
2253 IndiBubbleWithoutText(); |
|
2254 } |
|
2255 |
|
2256 iLafMgr->GetButtonRect(EPeninutWindowCtrlIdOptionBtn,exRect ,inRect); |
|
2257 exRect.Move(x, y); |
|
2258 inRect.Move(x, y); |
|
2259 static_cast<CAknFepCtrlEventButton*> |
|
2260 ( Control( EPeninutWindowCtrlIdOptionBtn ) )->SizeChanged( exRect, inRect, ETrue ); |
|
2261 |
|
2262 iLafMgr->GetButtonRect(EPeninutWindowCtrlIdCloseBtn,exRect ,inRect); |
|
2263 exRect.Move(x, y); |
|
2264 inRect.Move(x, y); |
|
2265 static_cast<CAknFepCtrlCommonButton*> |
|
2266 ( Control( EPeninutWindowCtrlIdCloseBtn ) )->SizeChanged( exRect, inRect, ETrue ); |
|
2267 |
|
2268 iLafMgr->GetButtonRect(EPeninutWindowCtrlIdBackspaceBtn,exRect ,inRect); |
|
2269 exRect.Move(x, y); |
|
2270 inRect.Move(x, y); |
|
2271 |
|
2272 // Check size change of bk button, need for mirroring when arabic |
|
2273 CAknFepCtrlCommonButton* bkBtn = static_cast<CAknFepCtrlCommonButton*> |
|
2274 ( Control( EPeninutWindowCtrlIdBackspaceBtn ) ); |
|
2275 TBool bBKSizeChanged = EFalse; |
|
2276 if( exRect.Size() != bkBtn->Rect().Size() && |
|
2277 inRect.Size() != bkBtn->ForgroundBmpRect().Size() ) |
|
2278 { |
|
2279 bBKSizeChanged = ETrue; |
|
2280 } |
|
2281 bkBtn->SizeChanged( exRect, inRect, ETrue ); |
|
2282 |
|
2283 |
|
2284 iLafMgr->GetButtonRect(EPeninutWindowCtrlIdSpaceBtn,exRect ,inRect); |
|
2285 inRect = exRect; |
|
2286 inRect.Shrink(10, 0); |
|
2287 |
|
2288 exRect.Move(x, y); |
|
2289 inRect.Move(x, y); |
|
2290 static_cast<CAknFepCtrlCommonButton*> |
|
2291 ( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SizeChanged( exRect, inRect, ETrue ); |
|
2292 |
|
2293 TRect spaceIconRect = inRect; |
|
2294 spaceIconRect.Shrink(10, 0); |
|
2295 static_cast<CAknFepCtrlCommonButton*> |
|
2296 ( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SetDraw3PieceFrameInfo( |
|
2297 TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL, |
|
2298 KAknsIIDQgnIndiInputSpaceMiddle, |
|
2299 KAknsIIDQgnIndiInputSpaceR, |
|
2300 spaceIconRect)); |
|
2301 |
|
2302 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
2303 { |
|
2304 iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowLeftBtn,exRect ,inRect); |
|
2305 exRect.Move(x, y); |
|
2306 inRect.Move(x, y); |
|
2307 iArrowLeftButton->SizeChanged( exRect, inRect, ETrue ); |
|
2308 |
|
2309 iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowRightBtn,exRect ,inRect); |
|
2310 exRect.Move(x, y); |
|
2311 inRect.Move(x, y); |
|
2312 iArrowRightButton->SizeChanged( exRect, inRect, ETrue ); |
|
2313 } |
|
2314 else |
|
2315 { |
|
2316 iLafMgr->GetButtonRect(EPeninutWindowCtrlIdMoveBtn,exRect ,inRect); |
|
2317 exRect.Move(x, y); |
|
2318 inRect.Move(x, y); |
|
2319 static_cast<CAknFepCtrlDragButton*> |
|
2320 ( Control( EPeninutWindowCtrlIdMoveBtn ) )->SizeChanged( exRect, inRect, ETrue ); |
|
2321 } |
|
2322 |
|
2323 //If backspace size changed when language is RtoL mirror should be used |
|
2324 if( bBKSizeChanged && IsRtoLLanguage( iLanguage ) ) |
|
2325 { |
|
2326 //Mirror backspace graphic |
|
2327 HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn ); |
|
2328 } |
|
2329 |
|
2330 } |
|
2331 void CPeninputGenericVkbWindow::ShowBubble(TInt aShow) |
|
2332 { |
|
2333 if (aShow > 0) |
|
2334 { |
|
2335 iVkbCtrl->ShowBubble(ETrue); |
|
2336 } |
|
2337 else |
|
2338 { |
|
2339 iVkbCtrl->ShowBubble(EFalse); |
|
2340 } |
|
2341 } |
|
2342 |
|
2343 void CPeninputGenericVkbWindow::ConstructAccentListL(TInt aLang) |
|
2344 { |
|
2345 iPopupWnd->ClearItemsL(); |
|
2346 |
|
2347 if (aLang == ELangVietnamese) |
|
2348 { |
|
2349 _LIT( KVietAccentList1, "\x00E0 - \x013A" ); |
|
2350 _LIT( KVietAccentList2, "\x013C - \x017E" ); |
|
2351 |
|
2352 CFepLayoutChoiceList::SItem item; |
|
2353 |
|
2354 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2355 item.iText.Copy( KVietAccentList1 ); |
|
2356 iPopupWnd->AddItemL( item ); |
|
2357 |
|
2358 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2359 item.iText.Copy( KVietAccentList2 ); |
|
2360 iPopupWnd->AddItemL( item ); |
|
2361 } |
|
2362 // 10X3 |
|
2363 else if (aLang == ELangEnglish |
|
2364 || aLang == ELangAmerican |
|
2365 || aLang == ELangDutch |
|
2366 || aLang == ELangTagalog |
|
2367 || aLang == ELangIndonesian |
|
2368 || aLang == ELangMalay) |
|
2369 { |
|
2370 _LIT( KVietAccentList1, "\x00E0 - \x0121" ); |
|
2371 _LIT( KVietAccentList2, "\x0123 - \x014F" ); |
|
2372 _LIT( KVietAccentList3, "\x0151 - \x017E" ); |
|
2373 |
|
2374 CFepLayoutChoiceList::SItem item; |
|
2375 |
|
2376 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2377 item.iText.Copy( KVietAccentList1 ); |
|
2378 iPopupWnd->AddItemL( item ); |
|
2379 |
|
2380 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2381 item.iText.Copy( KVietAccentList2 ); |
|
2382 iPopupWnd->AddItemL( item ); |
|
2383 |
|
2384 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2385 item.iText.Copy( KVietAccentList3 ); |
|
2386 iPopupWnd->AddItemL( item ); |
|
2387 } |
|
2388 //10X4 |
|
2389 else |
|
2390 { |
|
2391 // Add item |
|
2392 TResourceReader reader; |
|
2393 CFepLayoutChoiceList::SItem item; |
|
2394 |
|
2395 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2396 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 ); |
|
2397 TPtrC p1 = reader.ReadTPtrC(); |
|
2398 item.iText.Copy( p1 ); |
|
2399 iPopupWnd->AddItemL( item ); |
|
2400 CleanupStack::PopAndDestroy( 1 ); |
|
2401 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2402 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 ); |
|
2403 TPtrC p2 = reader.ReadTPtrC(); |
|
2404 item.iText.Copy( p2 ); |
|
2405 iPopupWnd->AddItemL( item ); |
|
2406 CleanupStack::PopAndDestroy( 1 ); |
|
2407 |
|
2408 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2409 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 ); |
|
2410 TPtrC p3 = reader.ReadTPtrC(); |
|
2411 item.iText.Copy( p3 ); |
|
2412 iPopupWnd->AddItemL( item ); |
|
2413 CleanupStack::PopAndDestroy( 1 ); |
|
2414 } |
|
2415 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
|
2416 iPopupInited = ETrue; |
|
2417 iPopupSet = ETrue; |
|
2418 } |
|
2419 // --------------------------------------------------------------------------- |
|
2420 // Load accent labels for range list |
|
2421 // --------------------------------------------------------------------------- |
|
2422 // |
|
2423 void CPeninputGenericVkbWindow::ConstructFSQAccentListL( TInt aLangId ) |
|
2424 { |
|
2425 iAccentCmdList.Reset(); |
|
2426 |
|
2427 TBool is10x3 = ( aLangId == ELangEnglish ) || ( aLangId == ELangAmerican ) |
|
2428 || ( aLangId == ELangDutch) || (aLangId == ELangTagalog ) |
|
2429 || ( aLangId == ELangIndonesian) || (aLangId == ELangMalay ); |
|
2430 |
|
2431 if ( aLangId == ELangVietnamese ) |
|
2432 { |
|
2433 _LIT( KVietAccentList1, "\x00E0 - \x013A" ); |
|
2434 _LIT( KVietAccentList2, "\x013C - \x017E" ); |
|
2435 |
|
2436 CFepLayoutChoiceList::SItem item; |
|
2437 |
|
2438 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2439 item.iText.Copy( KVietAccentList1 ); |
|
2440 iAccentCmdList.Append( item ); |
|
2441 |
|
2442 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2443 item.iText.Copy( KVietAccentList2 ); |
|
2444 iAccentCmdList.Append( item ); |
|
2445 } |
|
2446 else if( aLangId == ELangRussian || aLangId == ELangUkrainian || aLangId == ELangBulgarian ) |
|
2447 { |
|
2448 _LIT( KCyrillicAccent, "\x00E0 - \x017E" ); |
|
2449 CFepLayoutChoiceList::SItem item; |
|
2450 |
|
2451 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2452 item.iText.Copy( KCyrillicAccent ); |
|
2453 iAccentCmdList.Append( item ); |
|
2454 } |
|
2455 // 10X3 |
|
2456 else if ( is10x3 ) |
|
2457 { |
|
2458 _LIT( KVietAccentList1, "\x00E0 - \x0121" ); |
|
2459 _LIT( KVietAccentList2, "\x0123 - \x014F" ); |
|
2460 _LIT( KVietAccentList3, "\x0151 - \x017E" ); |
|
2461 |
|
2462 CFepLayoutChoiceList::SItem item; |
|
2463 |
|
2464 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2465 item.iText.Copy( KVietAccentList1 ); |
|
2466 iAccentCmdList.Append( item ); |
|
2467 |
|
2468 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2469 item.iText.Copy( KVietAccentList2 ); |
|
2470 iAccentCmdList.Append( item ); |
|
2471 |
|
2472 |
|
2473 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2474 item.iText.Copy( KVietAccentList3 ); |
|
2475 iAccentCmdList.Append( item ); |
|
2476 } |
|
2477 //10X4 |
|
2478 else |
|
2479 { |
|
2480 // Add item |
|
2481 TResourceReader reader; |
|
2482 CFepLayoutChoiceList::SItem item; |
|
2483 |
|
2484 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2485 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 ); |
|
2486 TPtrC p1 = reader.ReadTPtrC(); |
|
2487 item.iText.Copy( p1 ); |
|
2488 iAccentCmdList.Append( item ); |
|
2489 CleanupStack::PopAndDestroy( 1 ); //reader |
|
2490 |
|
2491 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2492 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 ); |
|
2493 TPtrC p2 = reader.ReadTPtrC(); |
|
2494 item.iText.Copy( p2 ); |
|
2495 iAccentCmdList.Append( item ); |
|
2496 CleanupStack::PopAndDestroy( 1 ); //reader |
|
2497 |
|
2498 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2499 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 ); |
|
2500 TPtrC p3 = reader.ReadTPtrC(); |
|
2501 item.iText.Copy( p3 ); |
|
2502 iAccentCmdList.Append( item ); |
|
2503 CleanupStack::PopAndDestroy( 1 );//reader |
|
2504 } |
|
2505 |
|
2506 iPopupInited = ETrue; |
|
2507 iPopupSet = ETrue; |
|
2508 } |
|
2509 void CPeninputGenericVkbWindow::UpdateICFTextL() |
|
2510 { |
|
2511 CFepLayoutMultiLineIcf* icf = |
|
2512 static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2513 if( icf ) |
|
2514 { |
|
2515 icf->UpdateSecretTextL(); |
|
2516 } |
|
2517 } |
|
2518 |
|
2519 void CPeninputGenericVkbWindow::HandleButtonResOnLangDirChange( TInt aControlId ) |
|
2520 { |
|
2521 TRAP_IGNORE(HandleButtonResOnLangDirChangeL(aControlId)); |
|
2522 } |
|
2523 void CPeninputGenericVkbWindow::HandleButtonResOnLangDirChangeL( TInt aControlId ) |
|
2524 { |
|
2525 CAknFepCtrlCommonButton* ctrl = static_cast<CAknFepCtrlCommonButton*>( |
|
2526 Control(aControlId) ); |
|
2527 if( ctrl && iBmpRotator) |
|
2528 { |
|
2529 TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis; |
|
2530 User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmp() , |
|
2531 rotChoice ) ); |
|
2532 User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmpMask() , |
|
2533 rotChoice ) ); |
|
2534 } |
|
2535 } |
|
2536 |
|
2537 // -------------------------------------------------------------------------- |
|
2538 // Show tooltip of ICF |
|
2539 // -------------------------------------------------------------------------- |
|
2540 // |
|
2541 void CPeninputGenericVkbWindow::ShowTooltipL( const TDesC& aText, TInt aLangCode ) |
|
2542 { |
|
2543 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2544 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2545 CPeninputGenericVkbLayout* layout |
|
2546 = static_cast<CPeninputGenericVkbLayout*>( UiLayout() ); |
|
2547 if ( !icf || !( layout->IsEnableITIOnFSQ() ) ) |
|
2548 { |
|
2549 return; |
|
2550 } |
|
2551 |
|
2552 // Calculate tooltip width |
|
2553 const TPeninputTooltipBoxLayoutData& tooltipBoxLAF |
|
2554 = iLafMgr->TooltipBoxLayoutData(); |
|
2555 TRect tooltipRect = tooltipBoxLAF.iRect; |
|
2556 // Calculate inner rect |
|
2557 TRect innerRect = tooltipRect; |
|
2558 innerRect.iTl += TPoint( KTooltipLeftMargin, KTooltipTopMargin ); |
|
2559 innerRect.iBr -= TPoint( KTooltipRightMargin, KTooltipBottomMargin ); |
|
2560 const CFont* font = tooltipBoxLAF.iFont; |
|
2561 // Set inner width in terms of text width |
|
2562 innerRect.SetWidth( font->TextWidthInPixels( aText ) ); |
|
2563 tooltipRect.iTl |
|
2564 = innerRect.iTl - TPoint( KTooltipLeftMargin, KTooltipTopMargin ); |
|
2565 tooltipRect.iBr |
|
2566 = innerRect.iBr + TPoint( KTooltipRightMargin, KTooltipBottomMargin ); |
|
2567 // Set tooltip rect in terms of inner rect |
|
2568 icf->ShowTooltipL( aText, tooltipRect, aLangCode ); |
|
2569 } |
|
2570 |
|
2571 // -------------------------------------------------------------------------- |
|
2572 // Hide tooltip of ICF |
|
2573 // -------------------------------------------------------------------------- |
|
2574 // |
|
2575 void CPeninputGenericVkbWindow::HideTooltip() |
|
2576 { |
|
2577 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2578 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2579 if ( !icf ) |
|
2580 { |
|
2581 return; |
|
2582 } |
|
2583 icf->HideTooltip(); |
|
2584 } |
|
2585 |
|
2586 // -------------------------------------------------------------------------- |
|
2587 // Hide candidate list |
|
2588 // -------------------------------------------------------------------------- |
|
2589 // |
|
2590 void CPeninputGenericVkbWindow::HideCandidateList() |
|
2591 { |
|
2592 if ( !iCandidateList ) |
|
2593 { |
|
2594 return; |
|
2595 } |
|
2596 iCandidateList->Hide( ETrue ); |
|
2597 } |
|
2598 |
|
2599 // -------------------------------------------------------------------------- |
|
2600 // Show candidate list |
|
2601 // -------------------------------------------------------------------------- |
|
2602 // |
|
2603 void CPeninputGenericVkbWindow::ShowCandidateListL( TInt aAlign, const CDesCArray* aItemArray, |
|
2604 TInt aActiveIndex ) |
|
2605 { |
|
2606 if ( !iCandidateList ) |
|
2607 { |
|
2608 return; |
|
2609 } |
|
2610 iCandidateList->ClearItemsL(); |
|
2611 iCandidateList->SetTextAlignment((CGraphicsContext::TTextAlign) aAlign); |
|
2612 |
|
2613 if ( aItemArray ) |
|
2614 { |
|
2615 CFepLayoutChoiceList::SItem item; |
|
2616 item.iCommand = 0; |
|
2617 |
|
2618 for (TInt i = 0; i < aItemArray->Count(); ++i) |
|
2619 { |
|
2620 if ((*aItemArray)[i].Length() <= item.iText.MaxLength()) |
|
2621 { |
|
2622 item.iText.Copy((*aItemArray)[i]); |
|
2623 } |
|
2624 else |
|
2625 { |
|
2626 // Given longer than maxlength, display the part of less than max |
|
2627 item.iText.Copy((*aItemArray)[i].Left(item.iText.MaxLength())); |
|
2628 } |
|
2629 |
|
2630 iCandidateList->AddItemL( item ); |
|
2631 } |
|
2632 } |
|
2633 iCandidateList->SetCurrentFocusedIndex( aActiveIndex ); |
|
2634 |
|
2635 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2636 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2637 |
|
2638 TPoint posBelow( 0, 0 ); |
|
2639 TPoint posRight( 0, 0 ); |
|
2640 posBelow = posRight = icf->Rect().iTl; |
|
2641 icf->InlineTextPos( posBelow, posRight ); |
|
2642 TPoint tlPos = posRight; |
|
2643 iCandidateList->Display( TRect( tlPos, tlPos ), |
|
2644 CFepLayoutPopupWnd::EDispBottomRight ); |
|
2645 } |
|
2646 |
|
2647 // -------------------------------------------------------------------------- |
|
2648 // Handle candidate list selected events. |
|
2649 // -------------------------------------------------------------------------- |
|
2650 // |
|
2651 void CPeninputGenericVkbWindow::HandleCandidateListSelectedL |
|
2652 ( CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
2653 { |
|
2654 if ( aCtrl != iCandidateList ) |
|
2655 { |
|
2656 return; |
|
2657 } |
|
2658 |
|
2659 CFepLayoutChoiceList::SEvent* event = |
|
2660 (CFepLayoutChoiceList::SEvent*)aEventData.Ptr(); |
|
2661 if ( event->iIndex != KErrNotFound ) |
|
2662 { |
|
2663 TPtrC ptr; |
|
2664 ptr.Set( reinterpret_cast<TUint16*>(&( event->iIndex ) ), |
|
2665 sizeof( TInt ) ); |
|
2666 UiLayout()->SignalOwner( ESignalSelectCandidate, ptr ); |
|
2667 } |
|
2668 } |
|
2669 |
|
2670 // -------------------------------------------------------------------------- |
|
2671 // Create a candidate list control. |
|
2672 // -------------------------------------------------------------------------- |
|
2673 // |
|
2674 void CPeninputGenericVkbWindow::CreateCandidateListL() |
|
2675 { |
|
2676 iCandidateList = CFepLayoutScrollableList::NewL( |
|
2677 UiLayout(), |
|
2678 EPentinputHwrCandidateList, |
|
2679 TSize( 0, 0 ), |
|
2680 0, |
|
2681 0, |
|
2682 TSize( 0, 0 ), |
|
2683 TSize( 0, 0 ) ); |
|
2684 |
|
2685 iCandidateList->SetImgFrId(KAknsIIDQsnFrPopupSub, |
|
2686 KAknsIIDQsnFrFunctionButtonNormal, |
|
2687 KAknsIIDQsnFrFunctionButtonPressed, |
|
2688 KAknsIIDQsnFrFunctionButtonInactive, |
|
2689 KAknsIIDQsnFrList, |
|
2690 KAknsIIDQsnFrPopupSub); |
|
2691 |
|
2692 iCandidateList->SetResourceId(R_PENINPUT_FSQ_CANDIDATE_LIST); |
|
2693 iCandidateList->ConstructFromResourceL(); |
|
2694 iCandidateList->SetPageInfoResID( R_PENINPUT_FSQ_CANDIDATE_LIST_PAGE_NUM ); |
|
2695 iCandidateList->AddEventObserver( UiLayout() ); |
|
2696 AddControlL(iCandidateList); |
|
2697 } |
|
2698 |
|
2699 // -------------------------------------------------------------------------- |
|
2700 // Retrieve text color from skin for candidiate list. |
|
2701 // -------------------------------------------------------------------------- |
|
2702 // |
|
2703 TRgb CPeninputGenericVkbWindow::CandidateListTextColor() |
|
2704 { |
|
2705 MAknsSkinInstance* skininstance = UiLayout()->SkinInstance(); |
|
2706 TRgb matchlistcolor = KRgbBlack; |
|
2707 AknsUtils::GetCachedColor( skininstance, |
|
2708 matchlistcolor, |
|
2709 KAknsIIDQsnTextColors, |
|
2710 EAknsCIQsnTextColorsCG43 ); |
|
2711 return matchlistcolor; |
|
2712 } |
|
2713 |
|
2714 // -------------------------------------------------------------------------- |
|
2715 // Retrieve text color from skin for autocompletion part. |
|
2716 // -------------------------------------------------------------------------- |
|
2717 // |
|
2718 TRgb CPeninputGenericVkbWindow::AutoCompletionPartColor() |
|
2719 { |
|
2720 MAknsSkinInstance* skininstance = UiLayout()->SkinInstance(); |
|
2721 TRgb matchlistcolor = KRgbBlack; |
|
2722 AknsUtils::GetCachedColor( skininstance, |
|
2723 matchlistcolor, |
|
2724 KAknsIIDQsnTextColors, |
|
2725 EAknsCIQsnTextColorsCG64 ); |
|
2726 return matchlistcolor; |
|
2727 } |
|
2728 |
|
2729 void CPeninputGenericVkbWindow::SetIndiBubbleImageL( const TInt aImgID1, |
|
2730 const TInt aMaskID1, |
|
2731 const TInt aImgID2, |
|
2732 const TInt aMaskID2 ) |
|
2733 { |
|
2734 MAknsSkinInstance* skininstance = UiLayout()->SkinInstance(); |
|
2735 |
|
2736 CFbsBitmap* bmp1 = NULL; |
|
2737 CFbsBitmap* mask1 = NULL; |
|
2738 |
|
2739 TInt colorIndex = EAknsCIQsnIconColorsCG30; |
|
2740 |
|
2741 AknsUtils::CreateColorIconL(skininstance, |
|
2742 KAknsIIDQsnIconColors, |
|
2743 KAknsIIDQsnIconColors, |
|
2744 colorIndex, |
|
2745 bmp1, |
|
2746 mask1, |
|
2747 AknIconUtils::AvkonIconFileName(), |
|
2748 aImgID1, |
|
2749 aMaskID1, |
|
2750 KRgbGray); |
|
2751 CleanupStack::PushL( bmp1 ); |
|
2752 CleanupStack::PushL( mask1 ); |
|
2753 |
|
2754 AknIconUtils::GetContentDimensions(bmp1, iIndicatorSize); |
|
2755 |
|
2756 CFbsBitmap* bmp2 = NULL; |
|
2757 CFbsBitmap* mask2 = NULL; |
|
2758 AknsUtils::CreateColorIconL(skininstance, |
|
2759 KAknsIIDQsnIconColors, |
|
2760 KAknsIIDQsnIconColors, |
|
2761 colorIndex, |
|
2762 bmp2, |
|
2763 mask2, |
|
2764 AknIconUtils::AvkonIconFileName(), |
|
2765 aImgID2, |
|
2766 aMaskID2, |
|
2767 KRgbGray); |
|
2768 |
|
2769 CleanupStack::PushL( bmp2 ); |
|
2770 CleanupStack::PushL( mask2 ); |
|
2771 |
|
2772 AknIconUtils::GetContentDimensions(bmp2, iIndicatorTextSize); |
|
2773 |
|
2774 TRect boundRect; |
|
2775 if ( iIndiWithText ) |
|
2776 { |
|
2777 boundRect = iLafMgr->IndiIconRectWithText(); |
|
2778 } |
|
2779 else |
|
2780 { |
|
2781 boundRect = iLafMgr->IndiIconRectWithoutText(); |
|
2782 } |
|
2783 |
|
2784 TRect imgrect, textrect; |
|
2785 |
|
2786 CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter); |
|
2787 AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved); |
|
2788 AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved); |
|
2789 AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved); |
|
2790 AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved); |
|
2791 |
|
2792 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, bmp1->DisplayMode()); |
|
2793 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
|
2794 |
|
2795 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2796 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2797 icf->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, |
|
2798 KAknsIIDQsnFrInputPreviewSideL, |
|
2799 KAknsIIDQsnFrInputPreviewMiddle, |
|
2800 KAknsIIDQsnFrInputPreviewSideR ); |
|
2801 |
|
2802 CleanupStack::PopAndDestroy( mask2 ); |
|
2803 CleanupStack::PopAndDestroy( bmp2 ); |
|
2804 CleanupStack::PopAndDestroy( mask1 ); |
|
2805 CleanupStack::PopAndDestroy( bmp1 ); |
|
2806 } |
|
2807 |
|
2808 void CPeninputGenericVkbWindow::CalIndicatorRect(const TRect& aBoundRect, |
|
2809 TRect& aRealRect1, |
|
2810 TRect& aRealRect2, |
|
2811 TIndicatorAlign aAlign) |
|
2812 { |
|
2813 TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight; |
|
2814 TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight; |
|
2815 TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, |
|
2816 aBoundRect.Size().iHeight ); |
|
2817 TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, |
|
2818 aBoundRect.Size().iHeight ); |
|
2819 // check if the length of img > bound rect width |
|
2820 TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth; |
|
2821 if( nTotalWidth > aBoundRect.Size().iWidth ) |
|
2822 { |
|
2823 TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth; |
|
2824 imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect; |
|
2825 imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth; |
|
2826 imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText; |
|
2827 // make sure the height of two rect is equal |
|
2828 imgSizeIndi.iHeight = imgSizeText.iHeight; |
|
2829 } |
|
2830 if( aAlign == EIndiAlignRight ) |
|
2831 { |
|
2832 aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY), |
|
2833 imgSizeText); |
|
2834 aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
2835 imgSizeIndi); |
|
2836 } |
|
2837 else if( aAlign == EIndiAlignCenter ) |
|
2838 { |
|
2839 TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2; |
|
2840 TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2; |
|
2841 aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, |
|
2842 aBoundRect.iTl.iY + offsetY), |
|
2843 imgSizeText ); |
|
2844 aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
2845 imgSizeIndi ); |
|
2846 } |
|
2847 else if( aAlign == EIndiAlignLeft ) |
|
2848 { |
|
2849 aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi ); |
|
2850 aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText ); |
|
2851 } |
|
2852 } |
|
2853 |
|
2854 void CPeninputGenericVkbWindow::IndiBubbleWithText() |
|
2855 { |
|
2856 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2857 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2858 if ( icf ) |
|
2859 { |
|
2860 TAknTextLineLayout textLine = iLafMgr->IndiText(); |
|
2861 TRect bubbleRect = iLafMgr->IndiPaneRectWithText(); |
|
2862 TRect iconRect = iLafMgr->IndiIconRectWithText(); |
|
2863 TSize offset; |
|
2864 offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY; |
|
2865 offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX; |
|
2866 TSize size( iconRect.Width(), iconRect.Height()); |
|
2867 |
|
2868 icf->MsgBubbleCtrl()->SetRect( bubbleRect ); |
|
2869 icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size ); |
|
2870 icf->MsgBubbleCtrl()->SetTextFormat( textLine ); |
|
2871 icf->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
2872 } |
|
2873 } |
|
2874 |
|
2875 void CPeninputGenericVkbWindow::IndiBubbleWithoutText() |
|
2876 { |
|
2877 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2878 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2879 if ( icf ) |
|
2880 { |
|
2881 TRect bubbleRect = iLafMgr->IndiPaneRectWithoutText(); |
|
2882 TRect iconRect = iLafMgr->IndiIconRectWithoutText(); |
|
2883 TSize offset; |
|
2884 offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY; |
|
2885 offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX; |
|
2886 TSize size( iconRect.Width(), iconRect.Height()); |
|
2887 |
|
2888 icf->MsgBubbleCtrl()->SetRect( bubbleRect ); |
|
2889 icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size ); |
|
2890 } |
|
2891 } |
|
2892 |
|
2893 void CPeninputGenericVkbWindow::SetIndiWithTextFlag( TBool aFlag ) |
|
2894 { |
|
2895 iIndiWithText = aFlag; |
|
2896 } |
|
2897 |
|
2898 void CPeninputGenericVkbWindow::UpdateIndiBubbleL( TUint8* aData ) |
|
2899 { |
|
2900 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2901 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2902 |
|
2903 RDesReadStream readStream; |
|
2904 TFepIndicatorInfo indicatorData; |
|
2905 |
|
2906 TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) ); |
|
2907 readStream.Open(countPtr); |
|
2908 CleanupClosePushL(readStream); |
|
2909 |
|
2910 indicatorData.iIndicatorImgID = readStream.ReadInt32L(); |
|
2911 indicatorData.iIndicatorMaskID = readStream.ReadInt32L(); |
|
2912 indicatorData.iIndicatorTextImgID = readStream.ReadInt32L(); |
|
2913 indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L(); |
|
2914 |
|
2915 CleanupStack::PopAndDestroy(&readStream); |
|
2916 |
|
2917 if ( indicatorData.iIndicatorImgID != 0 && |
|
2918 indicatorData.iIndicatorMaskID != 0 && |
|
2919 indicatorData.iIndicatorTextImgID != 0 && |
|
2920 indicatorData.iIndicatorTextMaskID != 0 ) |
|
2921 { |
|
2922 SetIndicatorData( indicatorData ); |
|
2923 |
|
2924 if ( icf ) |
|
2925 { |
|
2926 SetIndiBubbleImageL( indicatorData.iIndicatorImgID, |
|
2927 indicatorData.iIndicatorMaskID, |
|
2928 indicatorData.iIndicatorTextImgID, |
|
2929 indicatorData.iIndicatorTextMaskID ); |
|
2930 |
|
2931 TBuf<100> text; |
|
2932 icf->MsgBubbleCtrl()->GetText( text ); |
|
2933 icf->ShowBubble( text, icf->MsgBubbleCtrl()->Rect()); |
|
2934 } |
|
2935 } |
|
2936 } |
|
2937 |
|
2938 void CPeninputGenericVkbWindow::HandleRangeButtonShortPress() |
|
2939 { |
|
2940 const TInt range = CPeninputDataConverter::AnyToInt( |
|
2941 iLayoutContext->RequestData(EPeninputDataTypeCurrentRange)); |
|
2942 |
|
2943 const TInt langId = IntContext( EPeninputDataTypeInputLanguage ); |
|
2944 |
|
2945 switch ( langId ) |
|
2946 { |
|
2947 case ELangRussian: |
|
2948 case ELangBulgarian: |
|
2949 case ELangUkrainian: |
|
2950 { |
|
2951 range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative ); |
|
2952 } |
|
2953 break; |
|
2954 |
|
2955 case ELangArabic: |
|
2956 case ELangFarsi: |
|
2957 case ELangUrdu: |
|
2958 { |
|
2959 range == ERangeNative ? ChangeRange( ERangeNativeNumber ) : ChangeRange( ERangeNative ); |
|
2960 } |
|
2961 break; |
|
2962 |
|
2963 case ELangThai: |
|
2964 { |
|
2965 range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative ); |
|
2966 } |
|
2967 break; |
|
2968 |
|
2969 case ELangGreek: |
|
2970 case ELangHebrew: |
|
2971 { |
|
2972 range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative ); |
|
2973 } |
|
2974 break; |
|
2975 default: // Latin, vietnamese, and other possible languages |
|
2976 { |
|
2977 if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) ) |
|
2978 { |
|
2979 if ( range == ERangeNative ) |
|
2980 { |
|
2981 if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNativeNumber ) ) |
|
2982 { |
|
2983 ChangeRange( ERangeNativeNumber ); |
|
2984 } |
|
2985 else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNumber ) ) |
|
2986 { |
|
2987 ChangeRange( ERangeNumber ); |
|
2988 } |
|
2989 } |
|
2990 else |
|
2991 { |
|
2992 ChangeRange( ERangeNative ); |
|
2993 } |
|
2994 } |
|
2995 else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) ) |
|
2996 { |
|
2997 range == ERangeEnglish ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeEnglish ); |
|
2998 } |
|
2999 } |
|
3000 break; |
|
3001 } |
|
3002 |
|
3003 TRAP_IGNORE( UpdateRangeCtrlsL() ); |
|
3004 } |
|
3005 // End Of File |