|
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: vkb main window area implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // system includes |
|
20 #include <peninputcmdparam.h> // use global signal |
|
21 #include <peninputvkbcn.rsg> |
|
22 #include <peninputlayoutmultilineicf.h> |
|
23 #include <peninputeventbutton.h> |
|
24 #include <peninputdragbutton.h> |
|
25 #include <peninputrepeatbutton.h> |
|
26 #include <AknLayoutDef.h> |
|
27 #include <peninputcommonchoicelist.h> |
|
28 #include <peninputlayout.h> |
|
29 #include <AknIconUtils.h> |
|
30 #include <AknLayoutDef.h> |
|
31 #include <AknUtils.h> |
|
32 #include <aknlayoutscalable_avkon.cdl.h> |
|
33 #include <barsread.h> |
|
34 #include <AknsUtils.h> |
|
35 #include <AknFepGlobalEnums.h> |
|
36 #include <peninputlayoutinputmodechoice.h> |
|
37 #include <peninputcmd.h> // use global signal |
|
38 #include <aknfeppeninputenums.h> //command from fep or IME to plugin |
|
39 |
|
40 #include <aknlayoutscalable_apps.cdl.h> |
|
41 #include <peninputlayoutbubblectrl.h> |
|
42 #include <peninputscrollablelist.h> |
|
43 |
|
44 #include <s32mem.h> |
|
45 #include <peninputvkbctrllayout.h> |
|
46 #include <peninputvkbctrlext.h> |
|
47 |
|
48 // user includes |
|
49 #include "peninputvkb.hrh" |
|
50 #include "peninputvkbwindow.h" |
|
51 #include "peninputvkbevent.h" |
|
52 #include "peninputvkbclientarea.h" |
|
53 #include "peninputvkbdataprovider.h" |
|
54 |
|
55 #include "peninputvkbcnlafdatamgr.h" |
|
56 #include "peninputvkblayout.h" |
|
57 |
|
58 // constant definition |
|
59 const TInt KInvalidImg = -1 ; |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 // ======== MEMBER FUNCTIONS ======== |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CAknFepVkbWindow::NewL |
|
68 // (other items were commented in a header). |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CAknFepVkbWindow* CAknFepVkbWindow::NewL(CFepUiLayout* aUiLayout, |
|
72 TInt aControlId, |
|
73 MAknFepVkbDataProvider* aDataProvider, |
|
74 CAknFepVkbUiStateMgr* aUiStateMgr) |
|
75 { |
|
76 CAknFepVkbWindow* self = |
|
77 CAknFepVkbWindow::NewLC(aUiLayout, aControlId, aDataProvider, aUiStateMgr); |
|
78 CleanupStack::Pop(self); |
|
79 return self; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CAknFepVkbWindow::NewLC |
|
84 // (other items were commented in a header). |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CAknFepVkbWindow* CAknFepVkbWindow::NewLC(CFepUiLayout* aUiLayout, |
|
88 TInt aControlId, |
|
89 MAknFepVkbDataProvider* aDataProvider, |
|
90 CAknFepVkbUiStateMgr* aUiStateMgr) |
|
91 { |
|
92 CAknFepVkbWindow* self = |
|
93 new (ELeave) CAknFepVkbWindow(aUiLayout, aControlId, aDataProvider, aUiStateMgr); |
|
94 CleanupStack::PushL(self); |
|
95 self->ConstructL(); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CAknFepVkbWindow::~CAknFepVkbWindow |
|
101 // (other items were commented in a header). |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 CAknFepVkbWindow::~CAknFepVkbWindow() |
|
105 { |
|
106 delete iIdle; |
|
107 delete iLafMgr; |
|
108 iLafMgr = NULL; |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CAknFepVkbWindow::CAknFepVkbWindow |
|
113 // (other items were commented in a header). |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 CAknFepVkbWindow::CAknFepVkbWindow(CFepUiLayout* aUiLayout, |
|
117 TInt aControlId, |
|
118 MAknFepVkbDataProvider* aDataProvider, |
|
119 CAknFepVkbUiStateMgr* aUiStateMgr ) |
|
120 :CAknFepCtrlBaseWindowExt(aUiLayout, aControlId), |
|
121 iLafMgr(NULL), |
|
122 iDataProvider(aDataProvider), |
|
123 iUiStateMgr(aUiStateMgr), |
|
124 iFirstTimeConstruct(ETrue), |
|
125 iPopupInited(EFalse), |
|
126 iPopupSet(EFalse) |
|
127 { |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CAknFepVkbWindow::ConstructL |
|
132 // (other items were commented in a header). |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CAknFepVkbWindow::ConstructL() |
|
136 { |
|
137 iLafMgr = CPeninputCnGenericVkbLafMgr::NewL(); |
|
138 iLafMgr->SetInputModeL((TPluginInputMode)(UiLayout()->PenInputType())); |
|
139 |
|
140 BaseConstructL(); |
|
141 |
|
142 // Add input context field into the headpane |
|
143 // AddContextFieldL(); |
|
144 |
|
145 // Read bitmaps of close and move button |
|
146 TInt resID = GetWindowResId(); |
|
147 SetResourceId( resID ); |
|
148 |
|
149 // Create client area |
|
150 iClientArea = CAknFepVkbClientArea::NewL(UiLayout(), |
|
151 EAknFepVkbCtrlIdClientArea, |
|
152 iDataProvider, |
|
153 iLafMgr); |
|
154 |
|
155 // Then add it into the clientpane |
|
156 AddControlL(iClientArea); |
|
157 iClientArea->SetTopParent(this); |
|
158 |
|
159 |
|
160 //Add popup window |
|
161 AddPopupWindowL(); |
|
162 |
|
163 |
|
164 ConstructFromResourceL(); |
|
165 |
|
166 // For addition of ITI features, add a candidate list in vkb window |
|
167 CreateCandidateListOnFSQL(); |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // CAknFepVkbWindow::ConstructFromResourceL |
|
172 // (other items were commented in a header). |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 void CAknFepVkbWindow::ConstructFromResourceL() |
|
176 { |
|
177 CAknFepCtrlBaseWindowExt::ConstructFromResourceL(); |
|
178 iInputContextField = |
|
179 static_cast<CFepLayoutMultiLineIcf*> |
|
180 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
181 |
|
182 iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine(); |
|
183 iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine(); |
|
184 |
|
185 iInputContextField->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
186 iInputContextField->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
187 //Change the ID when ID into release |
|
188 iInputContextField->MsgBubbleCtrl()->SetBitmapParam(NULL, |
|
189 NULL, |
|
190 KAknsIIDQsnFrInputPreviewSideL, |
|
191 KAknsIIDQsnFrInputPreviewMiddle, |
|
192 KAknsIIDQsnFrInputPreviewSideR); |
|
193 |
|
194 if(UiLayout()->PenInputType() == EPluginInputModeFSQ) |
|
195 { |
|
196 iInputContextField->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
197 } |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CAknFepVkbWindow::ChangeImLayout |
|
202 // (other items were commented in a header). |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void CAknFepVkbWindow::ChangeImLayout(TInt aRange, TBool aChangeVkb) |
|
206 { |
|
207 TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout); |
|
208 |
|
209 if ( iArrowLeftButton ) |
|
210 { |
|
211 iArrowLeftButton->Hide( EAknFepVkbImCnZhuyin == imLayout ); |
|
212 } |
|
213 if ( iArrowRightButton ) |
|
214 { |
|
215 iArrowRightButton->Hide( EAknFepVkbImCnZhuyin == imLayout ); |
|
216 } |
|
217 |
|
218 iClientArea->ChangeImLayout(aRange, aChangeVkb); |
|
219 SizeChangedForTitle(); |
|
220 Draw(); |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // CAknFepVkbWindow::ChangeVkbLayout |
|
225 // (other items were commented in a header). |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 void CAknFepVkbWindow::ChangeVkbLayout(TInt aVkbLayoutId) |
|
229 { |
|
230 iClientArea->ChangeVkbLayout(aVkbLayoutId); |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------------------------- |
|
234 // CAknFepVkbWindow::LoopVkbLayout |
|
235 // (other items were commented in a header). |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 void CAknFepVkbWindow::LoopVkbLayout(TVkbShiftType aType, TBool aNotify ) |
|
239 { |
|
240 iClientArea->LoopVkbLayout(aType, aNotify); |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------------------------- |
|
244 // CAknFepVkbWindow::Draw |
|
245 // (other items were commented in a header). |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 void CAknFepVkbWindow::Draw() |
|
249 { |
|
250 if ( Hiden() ) |
|
251 { |
|
252 return; |
|
253 } |
|
254 |
|
255 CAknFepCtrlBaseWindowExt::Draw(); |
|
256 UpdateArea(Rect(), EFalse); |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // CAknFepVkbWindow::SetRect |
|
261 // (other items were commented in a header). |
|
262 // --------------------------------------------------------------------------- |
|
263 // |
|
264 void CAknFepVkbWindow::SetRect(const TRect& aRect) |
|
265 { |
|
266 TRect rect = aRect; |
|
267 |
|
268 |
|
269 if(UiLayout()->PenInputType() == EPluginInputModeFSQ) |
|
270 { |
|
271 rect.Move( TPoint(- rect.iTl )); |
|
272 CFepUiBaseCtrl::SetRect( rect ); |
|
273 UiLayout()->SetRect(rect); |
|
274 } |
|
275 else |
|
276 |
|
277 { |
|
278 TSize shadowTl = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowTlSize)); |
|
279 TSize shadowBr = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowBrSize)); |
|
280 |
|
281 TRect shadowRect = TRect( TPoint(), |
|
282 TSize( aRect.Width() + shadowTl.iWidth + shadowBr.iWidth, |
|
283 aRect.Height() + shadowTl.iHeight + shadowBr.iHeight) |
|
284 ); |
|
285 rect.Move( TPoint(shadowTl.iWidth, shadowTl.iHeight) - rect.iTl ); |
|
286 |
|
287 CFepUiBaseCtrl::SetRect( rect ); |
|
288 |
|
289 RootControl()->SetRect( rect ); |
|
290 UiLayout()->SetShadowRect(shadowRect); |
|
291 } |
|
292 /* |
|
293 CFepUiBaseCtrl::SetRect(aRect); |
|
294 ResetShadowSizeIfNeeded();*/ |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // CAknFepVkbWindow::SetPopupProperty |
|
299 // (other items were commented in a header). |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 void CAknFepVkbWindow::SetPopupProperty() |
|
303 { |
|
304 TRect mainPaneRect = *((TRect*)iDataProvider->RequestData(EAknFepDataTypeMainPaneRect)); |
|
305 |
|
306 TAknWindowLineLayout choiceWnd = |
|
307 AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine(); |
|
308 |
|
309 TAknLayoutRect choiceRect; |
|
310 choiceRect.LayoutRect(mainPaneRect, choiceWnd); |
|
311 |
|
312 TRect itemRect = TRect(0, |
|
313 0, |
|
314 choiceRect.Rect().Width(), |
|
315 AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH); |
|
316 |
|
317 TAknTextLineLayout choiceTextLayout = |
|
318 AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine(); |
|
319 |
|
320 const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL); |
|
321 iPopupWnd->SetFont(font); |
|
322 |
|
323 iPopupWnd->SetItemRect(itemRect, |
|
324 itemRect); |
|
325 |
|
326 TInt leftMargin = choiceTextLayout.il; |
|
327 |
|
328 iPopupWnd->SetMarginAndBaseline(leftMargin,font->HeightInPixels()); |
|
329 |
|
330 iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC)); |
|
331 |
|
332 if (iPopupWndBgImg) |
|
333 { |
|
334 AknIconUtils::SetSize(iPopupWndBgImg, TSize(itemRect.Width(),itemRect.Height()*3), |
|
335 EAspectRatioNotPreserved); |
|
336 } |
|
337 |
|
338 if (iPopupWndFocusImg) |
|
339 { |
|
340 AknIconUtils::SetSize(iPopupWndFocusImg, TSize(itemRect.Width(),itemRect.Height()*3), |
|
341 EAspectRatioNotPreserved); |
|
342 } |
|
343 |
|
344 iPopupSet = ETrue; |
|
345 iPopupItemSize = itemRect.Size(); |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------------------------- |
|
349 // CAknFepVkbWindow::SizeChanged |
|
350 // (other items were commented in a header). |
|
351 // --------------------------------------------------------------------------- |
|
352 // |
|
353 void CAknFepVkbWindow::SizeChanged(TBool /*aLandscapeStyle*/) |
|
354 { |
|
355 SizeChangedForTitle(); |
|
356 iClientArea->SizeChanged(); |
|
357 |
|
358 Draw(); |
|
359 } |
|
360 |
|
361 void CAknFepVkbWindow::SizeChangedForTitle() |
|
362 { |
|
363 TRect innerRect; |
|
364 if (iLafMgr && !iLafMgr->IsValid()) |
|
365 { |
|
366 return; |
|
367 } |
|
368 |
|
369 if (iDataProvider->SizeChanging() || (!iDataProvider->UnitShadowSizeSet())) |
|
370 { |
|
371 iDataProvider->ReadUnitShadowSize(); |
|
372 } |
|
373 |
|
374 TSize shadowTl = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowTlSize)); |
|
375 TInt x = shadowTl.iWidth; |
|
376 TInt y = shadowTl.iHeight; |
|
377 |
|
378 if ( UiLayout()->PenInputType() == EPluginInputModeFSQ ) |
|
379 { |
|
380 x = 0; |
|
381 y = 0; |
|
382 } |
|
383 |
|
384 |
|
385 |
|
386 TInt btnWidth = iDataProvider->RequestData(EAknFepDataTypeUnitWidth); |
|
387 TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight); |
|
388 |
|
389 |
|
390 // Close btn |
|
391 TRect closeBtnRect; |
|
392 closeBtnRect.iTl = TPoint(x, y); |
|
393 closeBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
394 AknPenImageUtils::CalculateGraphicRect( closeBtnRect, innerRect ); |
|
395 static_cast<CAknFepCtrlCommonButton*> |
|
396 ( Control( EPeninutWindowCtrlIdCloseBtn ) )->SizeChanged( closeBtnRect, innerRect, ETrue ); |
|
397 |
|
398 |
|
399 // ICF |
|
400 TInt columNum = iDataProvider->RequestData(EAknFepDataTypeIcfColumnNums); |
|
401 TInt titlebarHeight = iDataProvider->RequestData(EAknFepDataTypeTitleBarHeight); |
|
402 |
|
403 TRect icfRect; |
|
404 icfRect.iTl = TPoint(closeBtnRect.iBr.iX, closeBtnRect.iTl.iY); |
|
405 icfRect.SetSize(TSize(btnWidth * columNum + iClientArea->iCellAidGap, titlebarHeight)); |
|
406 |
|
407 // Set ICF Margin |
|
408 TPeninputCnICFConfig icfCfg; |
|
409 iLafMgr->GetICFConfig( icfCfg ); |
|
410 const CFont* icfFont = iLafMgr->ICFTextFont(); |
|
411 iInputContextField->SetTextMargin( icfCfg.iLeftMargin, |
|
412 icfCfg.iRightMargin, |
|
413 icfCfg.iTopMargin, |
|
414 0 ); |
|
415 iInputContextField->SetLineSpace( icfCfg.iLineSpaceMargin ); |
|
416 TRAP_IGNORE(iInputContextField->SizeChangedL( icfRect, |
|
417 icfCfg.iTextLineHeight, |
|
418 icfFont->FontMaxHeight(), |
|
419 icfFont )); |
|
420 |
|
421 // Option Button |
|
422 TRect optionBtnRect; |
|
423 optionBtnRect.iTl = TPoint(closeBtnRect.iTl.iX, closeBtnRect.iBr.iY); |
|
424 optionBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
425 AknPenImageUtils::CalculateGraphicRect( optionBtnRect, innerRect ); |
|
426 static_cast<CAknFepCtrlEventButton*> |
|
427 (Control(EPeninutWindowCtrlIdOptionBtn))->SizeChanged(optionBtnRect, innerRect, ETrue); |
|
428 |
|
429 TPoint backSpaceRefPoint; |
|
430 |
|
431 // Move Button |
|
432 TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout); |
|
433 |
|
434 if (UiLayout()->PenInputType() == EPluginInputModeVkb) |
|
435 { |
|
436 TRect moveBtnRect; |
|
437 if(EAknFepVkbImCnZhuyin == imLayout) |
|
438 { |
|
439 moveBtnRect.iTl = TPoint(icfRect.iBr.iX + btnWidth, icfRect.iTl.iY); |
|
440 moveBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
441 } |
|
442 else |
|
443 { |
|
444 moveBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY); |
|
445 moveBtnRect.SetSize(TSize(btnWidth * 2, btnHeight)); |
|
446 } |
|
447 AknPenImageUtils::CalculateGraphicRect( moveBtnRect, innerRect ); |
|
448 static_cast<CAknFepCtrlDragButton*> |
|
449 ( Control( EPeninutWindowCtrlIdMoveBtn ) )->SizeChanged(moveBtnRect, innerRect, ETrue); |
|
450 |
|
451 backSpaceRefPoint = TPoint(moveBtnRect.iTl.iX, moveBtnRect.iBr.iY); |
|
452 } |
|
453 else if (UiLayout()->PenInputType() == EPluginInputModeFSQ) |
|
454 { |
|
455 if ( EAknFepVkbImCnZhuyin == imLayout ) |
|
456 { |
|
457 /*TRect emptyRect= TRect(); |
|
458 AknPenImageUtils::CalculateGraphicRect( emptyRect, innerRect ); |
|
459 static_cast<CAknFepCtrlRepeatButton*> |
|
460 ( Control( EPeninupWindowCtrlIdArrowLeftBtn ) )->SizeChanged(emptyRect, innerRect, ETrue); |
|
461 static_cast<CAknFepCtrlRepeatButton*> |
|
462 ( Control( EPeninupWindowCtrlIdArrowRightBtn ) )->SizeChanged(emptyRect, innerRect, ETrue);*/ |
|
463 /* TRect arrowRect; |
|
464 TRect innerRect; |
|
465 |
|
466 arrowRect.iTl = TPoint(closeBtnRect.iBr.iX, closeBtnRect.iBr.iY); |
|
467 arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight)); |
|
468 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect ); |
|
469 static_cast<CAknFepCtrlRepeatButton*> |
|
470 ( Control( EPeninupWindowCtrlIdArrowUpBtn ) )->SizeChanged(arrowRect, innerRect, ETrue); |
|
471 |
|
472 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY); |
|
473 arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight)); |
|
474 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect ); |
|
475 static_cast<CAknFepCtrlRepeatButton*> |
|
476 ( Control( EPeninupWindowCtrlIdArrowDownBtn ) )->SizeChanged(arrowRect, innerRect, ETrue); |
|
477 |
|
478 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY); |
|
479 arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight)); |
|
480 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect ); |
|
481 static_cast<CAknFepCtrlRepeatButton*> |
|
482 ( Control( EPeninupWindowCtrlIdArrowLeftBtn ) )->SizeChanged(arrowRect, innerRect, ETrue); |
|
483 |
|
484 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY); |
|
485 arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight)); |
|
486 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect ); |
|
487 static_cast<CAknFepCtrlRepeatButton*> |
|
488 ( Control( EPeninupWindowCtrlIdArrowRightBtn ) )->SizeChanged(arrowRect, innerRect, ETrue);*/ |
|
489 } |
|
490 else |
|
491 { |
|
492 TRect leftBtnRect; |
|
493 leftBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY); |
|
494 |
|
495 leftBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
496 AknPenImageUtils::CalculateGraphicRect( leftBtnRect, innerRect ); |
|
497 iArrowLeftButton->SizeChanged(leftBtnRect, innerRect, ETrue); |
|
498 |
|
499 TRect rightBtnRect; |
|
500 rightBtnRect.iTl = TPoint(leftBtnRect.iBr.iX, leftBtnRect.iTl.iY); |
|
501 rightBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
502 AknPenImageUtils::CalculateGraphicRect( rightBtnRect, innerRect ); |
|
503 iArrowRightButton->SizeChanged(rightBtnRect, innerRect, ETrue); |
|
504 |
|
505 backSpaceRefPoint = TPoint(leftBtnRect.iTl.iX, leftBtnRect.iBr.iY); |
|
506 } |
|
507 } |
|
508 |
|
509 // BackSpace button |
|
510 TRect backSpaceBtnRect; |
|
511 if(EAknFepVkbImCnZhuyin == imLayout) |
|
512 { |
|
513 if(UiLayout()->PenInputType() == EPluginInputModeFSQ) |
|
514 { |
|
515 backSpaceBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY); |
|
516 backSpaceBtnRect.SetSize(TSize(btnWidth * 2, btnHeight)); |
|
517 } |
|
518 else |
|
519 { |
|
520 backSpaceBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY); |
|
521 backSpaceBtnRect.SetSize(TSize(btnWidth, btnHeight)); |
|
522 } |
|
523 } |
|
524 else |
|
525 { |
|
526 backSpaceBtnRect.iTl = backSpaceRefPoint; |
|
527 backSpaceBtnRect.SetSize(TSize(btnWidth * 2, btnHeight)); |
|
528 } |
|
529 AknPenImageUtils::CalculateGraphicRect( backSpaceBtnRect, innerRect ); |
|
530 static_cast<CAknFepCtrlRepeatButton*> |
|
531 ( Control( EPeninutWindowCtrlIdBackspaceBtn ) )->SizeChanged(backSpaceBtnRect, |
|
532 innerRect, ETrue); |
|
533 |
|
534 // Tooltip and candidate list |
|
535 SetITILayoutOnFSQ(); |
|
536 |
|
537 if (iDataProvider->SizeChanging() || (!iPopupSet)) |
|
538 { |
|
539 SetPopupProperty(); |
|
540 } |
|
541 |
|
542 } |
|
543 |
|
544 |
|
545 |
|
546 // --------------------------------------------------------------------------- |
|
547 // CAknFepVkbWindow::HandleControlEvent |
|
548 // (other items were commented in a header). |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 void CAknFepVkbWindow::HandleControlEvent(TInt aEventType, |
|
552 CFepUiBaseCtrl* aCtrl, |
|
553 const TDesC& aEventData) |
|
554 { |
|
555 //Call this function in base class |
|
556 CAknFepCtrlBaseWindowExt::HandleControlEvent(aEventType,aCtrl,aEventData); |
|
557 |
|
558 TUint16* data = (TUint16*) aEventData.Ptr(); |
|
559 |
|
560 TBool dealFlag = EFalse; |
|
561 |
|
562 switch (aEventType) |
|
563 { |
|
564 case EEventControlFocusGained: |
|
565 //Get composition |
|
566 { |
|
567 CFepLayoutEditAreaBase* compField = ClientArea()->CompositionField(); |
|
568 |
|
569 //if the event is sent by pen down in edit area |
|
570 if ( ( aCtrl ) && ( aCtrl->ControlId() == EPeninputWindowCtrlIdMultiLineICF ) ) |
|
571 { |
|
572 //Notify compField lost focus |
|
573 if ( compField ) |
|
574 { |
|
575 compField->SetFocus(EFalse); |
|
576 } |
|
577 } |
|
578 else if ( ( aCtrl ) && ( aCtrl->ControlId() == EAknFepVkbCtrlIdCompositionField ) ) |
|
579 { |
|
580 //Notify iInputContextField lost focus |
|
581 if ( iInputContextField ) |
|
582 { |
|
583 iInputContextField->SetFocus(EFalse); |
|
584 } |
|
585 } |
|
586 |
|
587 //if the event is sent from by internal |
|
588 if ( *data == EInputContextFieldGetFocus ) |
|
589 { |
|
590 if ( compField ) |
|
591 { |
|
592 compField->SetFocus(EFalse); |
|
593 } |
|
594 if ( iInputContextField ) |
|
595 { |
|
596 iInputContextField->SetFocus(ETrue); |
|
597 } |
|
598 } |
|
599 else if ( *data == ECompotisionFieldGetFocus ) |
|
600 { |
|
601 if ( iInputContextField ) |
|
602 { |
|
603 iInputContextField->SetFocus(EFalse); |
|
604 } |
|
605 if ( compField ) |
|
606 { |
|
607 compField->SetFocus(ETrue); |
|
608 } |
|
609 } |
|
610 |
|
611 dealFlag = ETrue; |
|
612 } |
|
613 break; |
|
614 case EVkbEventUpArrow: |
|
615 { |
|
616 TRAP_IGNORE(iInputContextField->HandleArrowBtnEventL( |
|
617 CFepLayoutMultiLineIcf::EArrowUp)); |
|
618 } |
|
619 break; |
|
620 case EVkbEventDownArrow: |
|
621 { |
|
622 TRAP_IGNORE(iInputContextField->HandleArrowBtnEventL( |
|
623 CFepLayoutMultiLineIcf::EArrowDown)); |
|
624 } |
|
625 break; |
|
626 default: |
|
627 break; |
|
628 } |
|
629 |
|
630 if ( !dealFlag ) |
|
631 { |
|
632 iClientArea->HandleControlEvent(aEventType,aCtrl,aEventData); |
|
633 } |
|
634 } |
|
635 |
|
636 // --------------------------------------------------------------------------- |
|
637 // CAknFepVkbWindow::DoClose |
|
638 // (other items were commented in a header). |
|
639 // --------------------------------------------------------------------------- |
|
640 // |
|
641 TBool CAknFepVkbWindow::DoClose() |
|
642 { |
|
643 //Send EVkbEventWindowClose to layout |
|
644 this->ReportEvent(EVkbEventWindowClose,KNullDesC); |
|
645 |
|
646 //Return true which will permit the window close |
|
647 return EFalse; |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------------------------- |
|
651 // CAknFepVkbWindow::ClientArea |
|
652 // (other items were commented in a header). |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 CAknFepVkbClientArea* CAknFepVkbWindow::ClientArea() |
|
656 { |
|
657 return iClientArea; |
|
658 } |
|
659 |
|
660 // --------------------------------------------------------------------------- |
|
661 // CAknFepVkbWindow::InputContextField |
|
662 // (other items were commented in a header). |
|
663 // --------------------------------------------------------------------------- |
|
664 // |
|
665 CFepLayoutMultiLineIcf* CAknFepVkbWindow::InputContextField() |
|
666 { |
|
667 return iInputContextField; |
|
668 } |
|
669 |
|
670 // --------------------------------------------------------------------------- |
|
671 // CAknFepVkbWindow::CompositionFieldStringLength |
|
672 // (other items were commented in a header). |
|
673 // --------------------------------------------------------------------------- |
|
674 // |
|
675 TInt CAknFepVkbWindow::CompositionFieldStringLength() |
|
676 { |
|
677 return iClientArea->CompositionFieldStringLength(); |
|
678 } |
|
679 |
|
680 // --------------------------------------------------------------------------- |
|
681 // CAknFepVkbWindow::FocusedControlID |
|
682 // (other items were commented in a header). |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 TInt CAknFepVkbWindow::FocusedControlID() |
|
686 { |
|
687 TInt ctrlID = iInputContextField->ControlId(); |
|
688 CFepLayoutEditAreaBase* compField = ClientArea()->CompositionField(); |
|
689 |
|
690 if ( compField && compField->IsFocused() ) |
|
691 { |
|
692 return compField->ControlId(); |
|
693 } |
|
694 |
|
695 return ctrlID; |
|
696 } |
|
697 |
|
698 // --------------------------------------------------------------------------- |
|
699 // CAknFepVkbWindow::SetEditorTextL |
|
700 // (other items were commented in a header). |
|
701 // --------------------------------------------------------------------------- |
|
702 // |
|
703 void CAknFepVkbWindow::SetEditorTextL(const TFepInputContextFieldData& aData) |
|
704 { |
|
705 if(iInputContextField) |
|
706 { |
|
707 iInputContextField->SetTextL(aData); |
|
708 } |
|
709 } |
|
710 |
|
711 // --------------------------------------------------------------------------- |
|
712 // CAknFepVkbWindow::SetEditorTextL |
|
713 // (other items were commented in a header). |
|
714 // --------------------------------------------------------------------------- |
|
715 // |
|
716 void CAknFepVkbWindow::SetTextIsSecret( TBool aIsSecret ) |
|
717 { |
|
718 if(iInputContextField) |
|
719 { |
|
720 iInputContextField->SetTextIsSecret( aIsSecret ); |
|
721 } |
|
722 } |
|
723 |
|
724 |
|
725 |
|
726 // --------------------------------------------------------------------------- |
|
727 // CAknFepVkbWindow::BackgroundConstructL |
|
728 // Do background construct. |
|
729 // --------------------------------------------------------------------------- |
|
730 // |
|
731 TInt CAknFepVkbWindow::BackgroundTaskL(TAny* aPtr) |
|
732 { |
|
733 CAknFepVkbWindow* self = static_cast<CAknFepVkbWindow*>(aPtr); |
|
734 self->DoIdleConstructL(); |
|
735 return EFalse; |
|
736 } |
|
737 |
|
738 void CAknFepVkbWindow::DoIdleConstructL() |
|
739 { |
|
740 if (iPopupInited) |
|
741 { |
|
742 return; |
|
743 } |
|
744 |
|
745 //set font |
|
746 /* |
|
747 TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine(); |
|
748 |
|
749 TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine(); |
|
750 |
|
751 TAknLayoutRect mainPaneRect; |
|
752 mainPaneRect.LayoutRect(appWnd.Rect(), mainPane); |
|
753 |
|
754 TAknWindowLineLayout choiceWnd = AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine(); |
|
755 |
|
756 TAknLayoutRect choiceRect; |
|
757 choiceRect.LayoutRect(mainPaneRect.Rect(), choiceWnd); |
|
758 |
|
759 |
|
760 TRect itemRect = TRect(0, |
|
761 0, |
|
762 choiceRect.Rect().Width(), |
|
763 AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH); |
|
764 |
|
765 TAknTextLineLayout choiceTextLayout = AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine(); |
|
766 |
|
767 const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL); |
|
768 iPopupWnd->SetFont(font); |
|
769 iPopupWnd->SetItemRect(itemRect, |
|
770 itemRect); |
|
771 |
|
772 TInt leftMargin = choiceTextLayout.il; |
|
773 |
|
774 iPopupWnd->SetMarginAndBaseline(leftMargin,font->HeightInPixels()); |
|
775 |
|
776 iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC)); |
|
777 */ |
|
778 if (iDataProvider->SizeChanging() || (!iPopupSet)) |
|
779 { |
|
780 SetPopupProperty(); |
|
781 } |
|
782 |
|
783 // Read resource |
|
784 TResourceReader reader; |
|
785 CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AKN_FEP_VKB_POPUP_WINDOW); |
|
786 |
|
787 GetPopupWndInfoFromRes(reader); |
|
788 |
|
789 CleanupStack::PopAndDestroy(); // reader |
|
790 |
|
791 //add item |
|
792 |
|
793 CFepLayoutChoiceList::SItem item; |
|
794 |
|
795 item.iCommand = EAknFepVkbVkbAccented1; |
|
796 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 ); |
|
797 TPtrC p1 = reader.ReadTPtrC(); |
|
798 item.iText.Copy( p1 ); |
|
799 iPopupWnd->AddItemL( item ); |
|
800 CleanupStack::PopAndDestroy( 1 ); |
|
801 item.iCommand = EAknFepVkbVkbAccented2; |
|
802 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 ); |
|
803 TPtrC p2 = reader.ReadTPtrC(); |
|
804 item.iText.Copy( p2 ); |
|
805 iPopupWnd->AddItemL( item ); |
|
806 CleanupStack::PopAndDestroy( 1 ); |
|
807 item.iCommand = EAknFepVkbVkbAccented3; |
|
808 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 ); |
|
809 TPtrC p3 = reader.ReadTPtrC(); |
|
810 item.iText.Copy( p3 ); |
|
811 iPopupWnd->AddItemL( item ); |
|
812 CleanupStack::PopAndDestroy( 1 ); |
|
813 iPopupInited = ETrue; |
|
814 |
|
815 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
|
816 } |
|
817 |
|
818 // --------------------------------------------------------------------------- |
|
819 // CAknFepVkbWindow::AddPopupWindowL |
|
820 // (other items were commented in a header). |
|
821 // --------------------------------------------------------------------------- |
|
822 // |
|
823 void CAknFepVkbWindow::AddPopupWindowL() |
|
824 { |
|
825 iPopupWnd = CPeninputCommonChoiceList::NewL(UiLayout(), |
|
826 EAknFepVkbPopupWindow, |
|
827 KAknsIIDQsnFrList, |
|
828 KAknsIIDQsnFrPopupSub ); |
|
829 |
|
830 iPopupWnd->AddEventObserver(UiLayout()); |
|
831 AddControlL(iPopupWnd); |
|
832 |
|
833 |
|
834 iIdle = CIdle::NewL(CActive::EPriorityIdle); |
|
835 iIdle ->Start(TCallBack(BackgroundTaskL,this)); |
|
836 } |
|
837 |
|
838 void CAknFepVkbWindow::SetSwitchlistLanguage( TInt /*aLang*/ ) |
|
839 { |
|
840 } |
|
841 |
|
842 void CAknFepVkbWindow::SetSwitchlistSecretFlag(TBool aSecret) |
|
843 { |
|
844 static_cast<CPeninputLayoutInputmodelChoice*> |
|
845 (Control( EPeninutWindowCtrlIdSwitcherPopupWindow))->SetSecretEditor(aSecret); |
|
846 } |
|
847 // --------------------------------------------------------------------------- |
|
848 // CPeninputGenericVkbWindow::DimArrowKeys |
|
849 // (other items were commented in a header). |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CAknFepVkbWindow::DimArrowKeys( TBool aDimArrow ) |
|
853 { |
|
854 //disable or enable arrow keys of FSQ in secret editor. |
|
855 if(UiLayout()->PenInputType() == EPluginInputModeFSQ ) |
|
856 { |
|
857 iArrowLeftButton->SetDimmed( aDimArrow ); |
|
858 iArrowRightButton->SetDimmed( aDimArrow ); |
|
859 iClientArea->DimArrowKeys( aDimArrow ); |
|
860 } |
|
861 } |
|
862 |
|
863 // -------------------------------------------------------------------------- |
|
864 // CAknFepVkbWindow::GetPopupWndInfoFromRes |
|
865 // (other items were commented in a header) |
|
866 // -------------------------------------------------------------------------- |
|
867 // |
|
868 void CAknFepVkbWindow::GetPopupWndInfoFromRes(TResourceReader aReader) |
|
869 { |
|
870 TPtrC bmpFileName = aReader.ReadTPtrC(); |
|
871 TInt32 imgMajorSkinId = aReader.ReadInt32(); |
|
872 |
|
873 TAknsItemID id; |
|
874 |
|
875 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
876 |
|
877 TInt popWinBmpId = aReader.ReadInt16(); |
|
878 TInt popWinBmpMaskId = aReader.ReadInt16(); |
|
879 TInt popWinBmpSkinId = aReader.ReadInt16(); |
|
880 |
|
881 id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId ); |
|
882 |
|
883 if ( popWinBmpId != KInvalidImg ) |
|
884 { |
|
885 TRAP_IGNORE(AknsUtils::CreateIconL( skininstance, |
|
886 id, |
|
887 iPopupWndBgImg, |
|
888 bmpFileName, |
|
889 popWinBmpId )); |
|
890 |
|
891 AknIconUtils::SetSize(iPopupWndBgImg, iPopupItemSize, EAspectRatioNotPreserved); |
|
892 TRAP_IGNORE(iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg )); |
|
893 } |
|
894 |
|
895 TInt focusBmpId = aReader.ReadInt16(); |
|
896 TInt focusBmpMaskId = aReader.ReadInt16(); |
|
897 TInt focusBmpSkinId = aReader.ReadInt16(); |
|
898 |
|
899 id.Set( TInt( imgMajorSkinId ), focusBmpSkinId ); |
|
900 |
|
901 if ( focusBmpId != KInvalidImg ) |
|
902 { |
|
903 TRAP_IGNORE(AknsUtils::CreateIconL( skininstance, |
|
904 id, |
|
905 iPopupWndFocusImg, |
|
906 bmpFileName, |
|
907 focusBmpId )); |
|
908 |
|
909 AknIconUtils::SetSize(iPopupWndFocusImg, iPopupItemSize, EAspectRatioNotPreserved); |
|
910 |
|
911 iPopupWnd->SetFocusBmp( iPopupWndFocusImg ); |
|
912 } |
|
913 } |
|
914 |
|
915 // --------------------------------------------------------------------------- |
|
916 // CAknFepVkbWindow::PopupAccentWindow |
|
917 // (other items were commented in a header). |
|
918 // --------------------------------------------------------------------------- |
|
919 // |
|
920 void CAknFepVkbWindow::PopupAccentWindow() |
|
921 { |
|
922 CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdAccentedButton); |
|
923 if ( accentBtn ) |
|
924 { |
|
925 if (!iPopupInited) |
|
926 { |
|
927 TRAP_IGNORE(DoIdleConstructL()); |
|
928 } |
|
929 |
|
930 TRect rect = accentBtn->Rect(); |
|
931 iPopupWnd->Display(rect); |
|
932 iAccentPopup = ETrue; |
|
933 } |
|
934 } |
|
935 |
|
936 // --------------------------------------------------------------------------- |
|
937 // CAknFepVkbWindow::PopupAccentWindow |
|
938 // (other items were commented in a header). |
|
939 // --------------------------------------------------------------------------- |
|
940 // |
|
941 void CAknFepVkbWindow::PopupSwitchWindow() |
|
942 { |
|
943 CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdSwitchToHwrBtn); |
|
944 if ( accentBtn ) |
|
945 { |
|
946 if (!iPopupInited) |
|
947 { |
|
948 TRAP_IGNORE(DoIdleConstructL()); |
|
949 } |
|
950 |
|
951 iAccentPopup = ETrue; |
|
952 |
|
953 TRAP_IGNORE( static_cast<CPeninputLayoutInputmodelChoice*> |
|
954 (Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->PopUpSwitchListL(accentBtn->Rect()) ); |
|
955 } |
|
956 } |
|
957 // CAknFepVkbWindow::ResetAccentButton |
|
958 // (other items were commented in a header). |
|
959 // --------------------------------------------------------------------------- |
|
960 // |
|
961 void CAknFepVkbWindow::ResetAccentButton() |
|
962 { |
|
963 CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdAccentedButton); |
|
964 if ( accentBtn ) |
|
965 { |
|
966 accentBtn->SetActive(EFalse); |
|
967 |
|
968 TRect innerRect; |
|
969 CAknFepCtrlCommonButton* accentBtnCtrl = static_cast<CAknFepCtrlCommonButton*> (accentBtn); |
|
970 AknPenImageUtils::CalculateGraphicRect( accentBtn->Rect(), innerRect ); |
|
971 accentBtnCtrl->SizeChanged(accentBtn->Rect(), innerRect, EFalse); |
|
972 iAccentPopup = EFalse; |
|
973 |
|
974 iClientArea->ActiveCurrentRange(); |
|
975 } |
|
976 } |
|
977 |
|
978 // --------------------------------------------------------------------------- |
|
979 // CAknFepVkbWindow::NeedCreateWord |
|
980 // (other items were commented in a header). |
|
981 // --------------------------------------------------------------------------- |
|
982 // |
|
983 TBool CAknFepVkbWindow::NeedCreateWord() |
|
984 { |
|
985 return iClientArea->NeedCreateWord(); |
|
986 } |
|
987 |
|
988 void CAknFepVkbWindow::CloseAccentWindow() |
|
989 { |
|
990 if(iAccentPopup) |
|
991 { |
|
992 iPopupWnd->CloseWindow(); |
|
993 ResetAccentButton(); |
|
994 } |
|
995 } |
|
996 |
|
997 // --------------------------------------------------------------------------- |
|
998 // CAknFepVkbWindow::GetCreatedWordSpell |
|
999 // (other items were commented in a header). |
|
1000 // --------------------------------------------------------------------------- |
|
1001 // |
|
1002 TPtrC CAknFepVkbWindow::GetCreatedWordSpell() |
|
1003 { |
|
1004 return iClientArea->GetCreatedWordSpell(); |
|
1005 } |
|
1006 |
|
1007 // --------------------------------------------------------------------------- |
|
1008 // CAknFepVkbWindow::SetEnableSettingBtn |
|
1009 // (other items were commented in a header) |
|
1010 // --------------------------------------------------------------------------- |
|
1011 // |
|
1012 void CAknFepVkbWindow::SetEnableSettingBtn(TBool aEnable) |
|
1013 { |
|
1014 CAknFepCtrlEventButton* optionBtn = static_cast<CAknFepCtrlEventButton*> |
|
1015 (Control( EPeninutWindowCtrlIdOptionBtn ) ); |
|
1016 if ( aEnable ) |
|
1017 { |
|
1018 optionBtn->SetDimmed(EFalse); |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 optionBtn->SetDimmed(ETrue); |
|
1023 optionBtn->SetActive(EFalse); |
|
1024 } |
|
1025 } |
|
1026 // -------------------------------------------------------------------------- |
|
1027 // CAknFepVkbWindow::GetWindowResId |
|
1028 // (other items were commented in a header) |
|
1029 // -------------------------------------------------------------------------- |
|
1030 // |
|
1031 TInt CAknFepVkbWindow::GetWindowResId() |
|
1032 { |
|
1033 if ( UiLayout()->PenInputType() == EPluginInputModeFSQ ) |
|
1034 { |
|
1035 return R_AKN_FEP_VKB_FSQ_WINDOW_INFO; |
|
1036 } |
|
1037 return R_AKN_FEP_VKB_WINDOW_INFO; |
|
1038 } |
|
1039 |
|
1040 // -------------------------------------------------------------------------- |
|
1041 // CAknFepVkbWindow::CreateCustomControlL |
|
1042 // (other items were commented in a header) |
|
1043 // -------------------------------------------------------------------------- |
|
1044 // |
|
1045 TBool CAknFepVkbWindow::CreateCustomControlL( TInt16 aControlId, TInt32 aImageId ) |
|
1046 { |
|
1047 TBool create = ETrue; |
|
1048 switch ( aControlId ) |
|
1049 { |
|
1050 case EPeninutWindowCtrlIdMoveBtn: |
|
1051 { |
|
1052 if ( !iMoveButton ) |
|
1053 { |
|
1054 iMoveButton = CAknFepCtrlDragButton::NewL(UiLayout(), EPeninutWindowCtrlIdMoveBtn); |
|
1055 iMoveButton->SetImageFrameId( KAknsIIDQsnFrFunctionButtonNormal, |
|
1056 KAknsIIDQsnFrFunctionButtonPressed, |
|
1057 KAknsIIDQsnFrFunctionButtonInactive ); |
|
1058 AddControlL(iMoveButton); |
|
1059 iMoveButton->AddPositionObserver(this); |
|
1060 iMoveButton->AddEventObserver( UiLayout() ); |
|
1061 iMoveButton->SetResourceId( aImageId ); |
|
1062 UiLayout()->EnableLayoutMoving( static_cast<CDragBar*>( iMoveButton ) ); |
|
1063 } |
|
1064 iMoveButton->ConstructFromResourceL(); |
|
1065 } |
|
1066 break; |
|
1067 case EPeninupWindowCtrlIdArrowLeftBtn: |
|
1068 { |
|
1069 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1070 { |
|
1071 break; |
|
1072 } |
|
1073 |
|
1074 if (!iArrowLeftButton) |
|
1075 { |
|
1076 iArrowLeftButton = CAknFepCtrlRepeatButton::NewL( |
|
1077 UiLayout(), aControlId, EVkbEventLeftArrow, EKeyLeftArrow, |
|
1078 KAknsIIDQsnFrFunctionButtonNormal, |
|
1079 KAknsIIDQsnFrFunctionButtonPressed, |
|
1080 KAknsIIDQsnFrFunctionButtonInactive ); |
|
1081 AddControlL(iArrowLeftButton); |
|
1082 iArrowLeftButton->AddEventObserver(UiLayout()); |
|
1083 iArrowLeftButton->SetResourceId( aImageId ); |
|
1084 } |
|
1085 |
|
1086 iArrowLeftButton->ConstructFromResourceL(); |
|
1087 } |
|
1088 break; |
|
1089 case EPeninupWindowCtrlIdArrowRightBtn: |
|
1090 { |
|
1091 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1092 { |
|
1093 break; |
|
1094 } |
|
1095 |
|
1096 if (!iArrowRightButton) |
|
1097 { |
|
1098 iArrowRightButton = CAknFepCtrlRepeatButton::NewL( |
|
1099 UiLayout(), aControlId, EVkbEventRightArrow, EKeyRightArrow, |
|
1100 KAknsIIDQsnFrFunctionButtonNormal, |
|
1101 KAknsIIDQsnFrFunctionButtonPressed, |
|
1102 KAknsIIDQsnFrFunctionButtonInactive ); |
|
1103 AddControlL(iArrowRightButton); |
|
1104 iArrowRightButton->AddEventObserver(UiLayout()); |
|
1105 iArrowRightButton->SetResourceId( aImageId ); |
|
1106 } |
|
1107 iArrowRightButton->ConstructFromResourceL(); |
|
1108 } |
|
1109 break; |
|
1110 default: |
|
1111 { |
|
1112 create = EFalse; |
|
1113 } |
|
1114 } |
|
1115 return create; |
|
1116 } |
|
1117 |
|
1118 void CAknFepVkbWindow::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl) |
|
1119 { |
|
1120 AddControlL(aCtrl); |
|
1121 } |
|
1122 |
|
1123 void CAknFepVkbWindow::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
|
1124 { |
|
1125 TRawEvent event; |
|
1126 event.Set(aType,aScanCode); |
|
1127 |
|
1128 TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16)); |
|
1129 |
|
1130 UiLayout()->SignalOwner(ESignalSimulateEvent,eventPtr); |
|
1131 } |
|
1132 |
|
1133 void CAknFepVkbWindow::SetPromptTextL(TUint8* aData) |
|
1134 { |
|
1135 RDesReadStream readStream; |
|
1136 |
|
1137 TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt)); |
|
1138 readStream.Open(countPtr); |
|
1139 CleanupClosePushL(readStream); |
|
1140 const TInt dataCount = readStream.ReadInt32L(); |
|
1141 const TInt textCount = readStream.ReadInt32L(); |
|
1142 CleanupStack::PopAndDestroy(&readStream); |
|
1143 |
|
1144 TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
1145 readStream.Open(ptr); |
|
1146 CleanupClosePushL(readStream); |
|
1147 |
|
1148 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
1149 TPtr8 dataBufPtr = dataBuf->Des(); |
|
1150 readStream.ReadL(dataBufPtr, dataCount); |
|
1151 |
|
1152 TFepPromptText* pIcfData = |
|
1153 reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
1154 |
|
1155 HBufC* textBuf; |
|
1156 if (textCount > 0) |
|
1157 { |
|
1158 textBuf = HBufC::NewLC(textCount/2); |
|
1159 TPtr textBufPtr = textBuf->Des(); |
|
1160 readStream.ReadL(textBufPtr, textCount/2); |
|
1161 static_cast<CFepLayoutMultiLineIcf*> |
|
1162 (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL |
|
1163 (textBuf->Des(), pIcfData->iCleanContent); |
|
1164 CleanupStack::PopAndDestroy(textBuf); |
|
1165 } |
|
1166 else |
|
1167 { |
|
1168 static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF))-> |
|
1169 SetPromptTextL( KNullDesC, pIcfData->iCleanContent ); |
|
1170 } |
|
1171 |
|
1172 CleanupStack::PopAndDestroy(dataBuf); |
|
1173 CleanupStack::PopAndDestroy(&readStream); |
|
1174 } |
|
1175 |
|
1176 void CAknFepVkbWindow::ChangeMergedButtonStatus( |
|
1177 const TInt aIsShiftCase, |
|
1178 const TInt aIsCapslockCase ) |
|
1179 { |
|
1180 iClientArea->ChangeMergedButtonStatus(aIsShiftCase, aIsCapslockCase); |
|
1181 } |
|
1182 |
|
1183 void CAknFepVkbWindow::ShowBubble(TInt aShow) |
|
1184 { |
|
1185 if (aShow > 0) |
|
1186 { |
|
1187 iClientArea->ShowBubble(ETrue); |
|
1188 } |
|
1189 else |
|
1190 { |
|
1191 iClientArea->ShowBubble(EFalse); |
|
1192 } |
|
1193 } |
|
1194 |
|
1195 void CAknFepVkbWindow::SetTextAlignmentL( TInt aAlignment ) |
|
1196 { |
|
1197 TInt currentLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage); |
|
1198 |
|
1199 if ( iInputContextField && currentLanguage != ELangNone ) |
|
1200 { |
|
1201 iInputContextField->SetTextAlignmentL( aAlignment, currentLanguage ); |
|
1202 } |
|
1203 } |
|
1204 |
|
1205 void CAknFepVkbWindow::UpdateICFTextL() |
|
1206 { |
|
1207 if( iInputContextField ) |
|
1208 { |
|
1209 iInputContextField->UpdateSecretTextL(); |
|
1210 } |
|
1211 } |
|
1212 |
|
1213 // -------------------------------------------------------------------------- |
|
1214 // Show tooltip of ICF |
|
1215 // -------------------------------------------------------------------------- |
|
1216 // |
|
1217 void CAknFepVkbWindow::ShowTooltipOnFSQL( const TDesC& aText ) |
|
1218 { |
|
1219 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1220 { |
|
1221 return; |
|
1222 } |
|
1223 iInputContextField->ShowTooltipL( aText ); |
|
1224 } |
|
1225 |
|
1226 // -------------------------------------------------------------------------- |
|
1227 // Hide tooltip of ICF |
|
1228 // -------------------------------------------------------------------------- |
|
1229 // |
|
1230 void CAknFepVkbWindow::HideTooltipOnFSQ() |
|
1231 { |
|
1232 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1233 { |
|
1234 return; |
|
1235 } |
|
1236 iInputContextField->HideTooltip(); |
|
1237 } |
|
1238 |
|
1239 // -------------------------------------------------------------------------- |
|
1240 // Hide candidate list |
|
1241 // -------------------------------------------------------------------------- |
|
1242 // |
|
1243 void CAknFepVkbWindow::HideCandidateListOnFSQ() |
|
1244 { |
|
1245 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1246 { |
|
1247 return; |
|
1248 } |
|
1249 iCandidateList->Hide( ETrue ); |
|
1250 } |
|
1251 |
|
1252 // -------------------------------------------------------------------------- |
|
1253 // Show candidate list |
|
1254 // -------------------------------------------------------------------------- |
|
1255 // |
|
1256 void CAknFepVkbWindow::ShowCandidateListOnFSQL( const CDesCArray* aItemArray, |
|
1257 TInt aActiveIndex ) |
|
1258 { |
|
1259 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1260 { |
|
1261 return; |
|
1262 } |
|
1263 iCandidateList->ClearItemsL(); |
|
1264 if ( aItemArray ) |
|
1265 { |
|
1266 for ( TInt i = 0; i < aItemArray->Count(); i++ ) |
|
1267 { |
|
1268 CFepLayoutChoiceList::SItem item; |
|
1269 item.iCommand = 0; |
|
1270 if ( (*aItemArray)[i].Length() <= item.iText.MaxLength() ) |
|
1271 { |
|
1272 item.iText.Copy( (*aItemArray)[i] ); |
|
1273 } |
|
1274 else |
|
1275 { |
|
1276 // Given longer than maxlength, display the part of less than max |
|
1277 item.iText.Copy( (*aItemArray)[i].Left( item.iText.MaxLength() ) ); |
|
1278 } |
|
1279 iCandidateList->AddItemL( item ); |
|
1280 } |
|
1281 |
|
1282 iCandidateList->SetCurrentFocusedIndex( aActiveIndex ); |
|
1283 } |
|
1284 |
|
1285 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
1286 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
1287 |
|
1288 TPoint posBelow( 0, 0 ); |
|
1289 TPoint posRight( 0, 0 ); |
|
1290 posBelow = posRight = icf->Rect().iTl; |
|
1291 icf->InlineTextPos( posBelow, posRight ); |
|
1292 TPoint tlPos = posRight; |
|
1293 iCandidateList->Display( TRect( tlPos, tlPos ), |
|
1294 CFepLayoutPopupWnd::EDispBottomRight ); |
|
1295 } |
|
1296 |
|
1297 // -------------------------------------------------------------------------- |
|
1298 // Handle candidate list selected events. |
|
1299 // -------------------------------------------------------------------------- |
|
1300 // |
|
1301 void CAknFepVkbWindow::HandleCandidateListSelectedOnFSQL |
|
1302 ( CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
1303 { |
|
1304 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1305 { |
|
1306 return; |
|
1307 } |
|
1308 |
|
1309 CFepLayoutChoiceList::SEvent* event = |
|
1310 (CFepLayoutChoiceList::SEvent*)aEventData.Ptr(); |
|
1311 if ( event->iIndex != KErrNotFound ) |
|
1312 { |
|
1313 TPtrC ptr; |
|
1314 ptr.Set( reinterpret_cast<TUint16*>(&( event->iIndex ) ), |
|
1315 sizeof( TInt ) ); |
|
1316 UiLayout()->SignalOwner( ESignalSelectCandidate, ptr ); |
|
1317 } |
|
1318 } |
|
1319 |
|
1320 // -------------------------------------------------------------------------- |
|
1321 // Create a candidate list control. |
|
1322 // -------------------------------------------------------------------------- |
|
1323 // |
|
1324 void CAknFepVkbWindow::CreateCandidateListOnFSQL() |
|
1325 { |
|
1326 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ ) |
|
1327 { |
|
1328 return; |
|
1329 } |
|
1330 |
|
1331 iCandidateList = CFepLayoutScrollableList::NewL( |
|
1332 UiLayout(), |
|
1333 EPentinputHwrCandidateList, |
|
1334 TSize( 0, 0 ), |
|
1335 0, |
|
1336 0, |
|
1337 TSize( 0, 0 ), |
|
1338 TSize( 0, 0 ) ); |
|
1339 |
|
1340 iCandidateList->SetImgFrId(KAknsIIDQsnFrPopupSub, |
|
1341 KAknsIIDQsnFrFunctionButtonNormal, |
|
1342 KAknsIIDQsnFrFunctionButtonPressed, |
|
1343 KAknsIIDQsnFrFunctionButtonInactive, |
|
1344 KAknsIIDQsnFrList, |
|
1345 KAknsIIDQsnFrPopupSub); |
|
1346 |
|
1347 iCandidateList->SetResourceId(R_PENINPUT_FSQ_CANDIDATE_LIST); |
|
1348 iCandidateList->ConstructFromResourceL(); |
|
1349 iCandidateList->SetPageInfoResID( R_PENINPUT_FSQ_CANDIDATE_LIST_PAGE_NUM ); |
|
1350 iCandidateList->AddEventObserver( UiLayout() ); |
|
1351 AddControlL(iCandidateList); |
|
1352 } |
|
1353 |
|
1354 // -------------------------------------------------------------------------- |
|
1355 // Retrieve text color from skin for candidiate list. |
|
1356 // -------------------------------------------------------------------------- |
|
1357 // |
|
1358 const TRgb CAknFepVkbWindow::CandidateListTextColorOnFSQ() |
|
1359 { |
|
1360 TRgb matchlistcolor = KRgbBlack; |
|
1361 if ( UiLayout()->PenInputType() == EPluginInputModeFSQ ) |
|
1362 { |
|
1363 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1364 AknsUtils::GetCachedColor( skininstance, |
|
1365 matchlistcolor, |
|
1366 KAknsIIDQsnTextColors, |
|
1367 EAknsCIQsnTextColorsCG43 ); |
|
1368 } |
|
1369 |
|
1370 return matchlistcolor; |
|
1371 } |
|
1372 |
|
1373 // -------------------------------------------------------------------------- |
|
1374 // Retrieve text color from skin for autocompletion part. |
|
1375 // -------------------------------------------------------------------------- |
|
1376 // |
|
1377 const TRgb CAknFepVkbWindow::AutoCompletionPartColorOnFSQ() |
|
1378 { |
|
1379 TRgb matchlistcolor = KRgbBlack; |
|
1380 if ( UiLayout()->PenInputType() == EPluginInputModeFSQ ) |
|
1381 { |
|
1382 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1383 AknsUtils::GetCachedColor( skininstance, |
|
1384 matchlistcolor, |
|
1385 KAknsIIDQsnTextColors, |
|
1386 EAknsCIQsnTextColorsCG64 ); |
|
1387 } |
|
1388 |
|
1389 return matchlistcolor; |
|
1390 } |
|
1391 // -------------------------------------------------------------------------- |
|
1392 // Set property for tooltip and candidate list. |
|
1393 // -------------------------------------------------------------------------- |
|
1394 // |
|
1395 void CAknFepVkbWindow::SetITILayoutOnFSQ() |
|
1396 { |
|
1397 if ( UiLayout()->PenInputType() != EPluginInputModeFSQ |
|
1398 || !iLafMgr || !iLafMgr->IsValid() ) |
|
1399 { |
|
1400 return; |
|
1401 } |
|
1402 |
|
1403 // Addition for ITI features, read LAF data for candidate list |
|
1404 const TPeninputCnCandidateListLayoutData& candidateListLAF = |
|
1405 iLafMgr->CandidateListLayoutData(); |
|
1406 iCandidateList->SizeChanged( candidateListLAF.iSelectionItemSize, |
|
1407 candidateListLAF.iSelectionHorMargin, |
|
1408 candidateListLAF.iSelectionVerMargin, |
|
1409 candidateListLAF.iSelectionNaviSize, |
|
1410 candidateListLAF.iSelectionNaviInnerSize ); |
|
1411 iCandidateList->SetPageInfoTextLineLayout |
|
1412 ( candidateListLAF.iSelectionPageTextLine ); |
|
1413 |
|
1414 |
|
1415 const CFont* itemFont = candidateListLAF.iFont; |
|
1416 TRgb textColor = CandidateListTextColorOnFSQ(); |
|
1417 if ( itemFont ) |
|
1418 { |
|
1419 // Set font defined in LAF |
|
1420 iCandidateList->SetTextProperty( itemFont, textColor ); |
|
1421 } |
|
1422 else |
|
1423 { |
|
1424 // If font in LAF is NULL, set ICF text font to candidate list |
|
1425 iCandidateList->SetTextProperty( iLafMgr->ICFTextFont(), textColor ); |
|
1426 } |
|
1427 |
|
1428 if ( iInputContextField ) |
|
1429 { |
|
1430 // read LAF data for tooltip box |
|
1431 const TPeninputCnTooltipBoxLayoutData& tooltipBoxLAF |
|
1432 = iLafMgr->TooltipBoxLayoutData(); |
|
1433 iInputContextField->TooltipBubbleCtrl()->SetRect( |
|
1434 tooltipBoxLAF.iRect ); |
|
1435 iInputContextField->TooltipBubbleCtrl()->SetTextFormat( |
|
1436 tooltipBoxLAF.iTooltipTextLayout ); |
|
1437 iInputContextField->TooltipBubbleCtrl()->SetTextColorIndex( |
|
1438 EAknsCIQsnTextColorsCG55 ); |
|
1439 iInputContextField->TooltipBubbleCtrl()->SetBitmapParam(NULL, |
|
1440 NULL, |
|
1441 KAknsIIDQsnFrInputPreviewSideL, |
|
1442 KAknsIIDQsnFrInputPreviewMiddle, |
|
1443 KAknsIIDQsnFrInputPreviewSideR); |
|
1444 |
|
1445 // read color from skin for autocompletion part |
|
1446 iInputContextField->SetAutoCompleteTextColor( |
|
1447 AutoCompletionPartColorOnFSQ() ); |
|
1448 } |
|
1449 } |
|
1450 // End Of File |