|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <peninputsplititutnew.rsg> |
|
20 #include <peninputsplititutconfig_chinese.rsg> |
|
21 #include <skinlayout.cdl.h> |
|
22 #include <AknsDrawUtils.h> |
|
23 #include <AknsUtils.h> |
|
24 #include <AknUtils.h> |
|
25 #include <peninputrawkeybutton.h> |
|
26 #include <peninputrepeatbutton.h> |
|
27 #include <peninputcommonbutton.h> |
|
28 #include <AknFepGlobalEnums.h> |
|
29 #include <aknfeppeninputenums.h> |
|
30 //#include <peninputdropdownlist.h> |
|
31 #include <s32mem.h> |
|
32 #include <peninputlabel.h> |
|
33 #include <peninputlayoutinputmodechoice.h> |
|
34 #include <peninputlayoutbubblectrl.h> |
|
35 #include <peninputcommonlayoutglobalenum.h> |
|
36 |
|
37 #include "peninputsplititutwindowmanager.h" |
|
38 #include "peninputsplititutwindow.h" |
|
39 #include "peninputsplititutdatamgr.h" |
|
40 #include "peninputsplititutuimgrbase.h" |
|
41 #include "peninputsplititutuistatebase.h" |
|
42 #include "peninputsplititutconverter.h" |
|
43 |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS ============================= |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CSplitItutWindowManager::NewL |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CSplitItutWindowManager* CSplitItutWindowManager::NewL(CSplitItutUiLayout* aLayoutOwner, |
|
52 CSplitItutDataMgr* aDataMgr) |
|
53 { |
|
54 CSplitItutWindowManager* layout = new (ELeave) |
|
55 CSplitItutWindowManager(aLayoutOwner,aDataMgr); |
|
56 CleanupStack::PushL(layout); |
|
57 layout->ConstructL(); |
|
58 CleanupStack::Pop(layout); |
|
59 return layout; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CSplitItutWindowManager::CSplitItutWindowManager |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CSplitItutWindowManager::CSplitItutWindowManager(CSplitItutUiLayout* aLayoutOwner, |
|
67 CSplitItutDataMgr* aDataMgr) |
|
68 :iLayoutOwner(aLayoutOwner), |
|
69 iDataMgr(aDataMgr), |
|
70 iLastRawKeyDown(EStdKeyNull) |
|
71 |
|
72 { |
|
73 iInEditWordQueryDlg = EFalse; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CSplitItutWindowManager::CSplitItutWindowManager |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CSplitItutWindowManager::~CSplitItutWindowManager() |
|
81 { |
|
82 delete iWindow; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CSplitItutWindowManager::CSplitItutWindowManager |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 TInt CSplitItutWindowManager::OnAppEditorTextComing(const TFepInputContextFieldData& aData) |
|
90 { |
|
91 TRAPD(err, iWindow->Icf()->SetTextL(aData)); |
|
92 return err; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CSplitItutWindowManager::SetPropertyL |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CSplitItutWindowManager::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, |
|
100 const TDesC& aPropertyValue) |
|
101 { |
|
102 iWindow->SetPropertyL(aPropertyName, aPropertyValue); |
|
103 |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CSplitItutWindowManager::ConstructL |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CSplitItutWindowManager::ConstructL() |
|
111 { |
|
112 iWindow = CSplitItutWindow::NewL(this, iLayoutOwner,iDataMgr); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CSplitItutWindowManager::SimulateRawEvent |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CSplitItutWindowManager::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
|
120 { |
|
121 iLayoutOwner->SimulateRawEvent(aScanCode, aType); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CSplitItutWindowManager::HandleCtrlEventL |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CSplitItutWindowManager::HandleCtrlEventL(TInt aEventType, |
|
129 CFepUiBaseCtrl* aCtrl, |
|
130 const TDesC& aEventData) |
|
131 { |
|
132 switch(aEventType) |
|
133 { |
|
134 case EEventRawKeyDownEvent: |
|
135 { |
|
136 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
137 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyDown); |
|
138 SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl); |
|
139 } |
|
140 break; |
|
141 case EEventRawKeyUpEvent: |
|
142 { |
|
143 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
144 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyUp); |
|
145 SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl); |
|
146 } |
|
147 break; |
|
148 case EEventButtonUp: |
|
149 { |
|
150 /* else if (aCtrl->ControlId() == ECtrlIdArrowUp) |
|
151 { |
|
152 TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( |
|
153 CFepLayoutMultiLineIcf::EArrowUp)); |
|
154 } |
|
155 else if (aCtrl->ControlId() == ECtrlIdArrowDown) |
|
156 { |
|
157 TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( |
|
158 CFepLayoutMultiLineIcf::EArrowDown)); |
|
159 }*/ |
|
160 if (aCtrl->ControlId() == ECtrlIdClose) |
|
161 { |
|
162 iLayoutOwner->SignalOwner(ESignalLayoutClosed); |
|
163 } |
|
164 else if (aCtrl->ControlId() == ECtrlIdOptions) |
|
165 { |
|
166 iLayoutOwner->SignalOwner(ESignalLaunchOptionsMenu); |
|
167 } |
|
168 } |
|
169 break; |
|
170 |
|
171 /* case EItutCmdArrowUp: |
|
172 { |
|
173 if (aCtrl->ControlId() == ECtrlIdArrowUp) |
|
174 { |
|
175 TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( |
|
176 CFepLayoutMultiLineIcf::EArrowUp)); |
|
177 } |
|
178 } |
|
179 break; |
|
180 case EItutCmdArrowDown: |
|
181 { |
|
182 if (aCtrl->ControlId() == ECtrlIdArrowDown) |
|
183 { |
|
184 TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( |
|
185 CFepLayoutMultiLineIcf::EArrowDown)); |
|
186 } |
|
187 } |
|
188 break;*/ |
|
189 case EEventCapturePointer: |
|
190 { |
|
191 if (iRawKeyDown) |
|
192 { |
|
193 SimulateRawEvent(iLastRawKeyDown, TRawEvent::EKeyUp); |
|
194 iRawKeyCtrl->CancelPointerDownL(); |
|
195 SetLastRawKeyDown(iLastRawKeyDown, EFalse, NULL); |
|
196 } |
|
197 } |
|
198 break; |
|
199 default: |
|
200 break; |
|
201 }; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CSplitItutWindowManager::HandleCtrlEventL |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 TBool CSplitItutWindowManager::HandleCommandL(TInt aCmd, TUint8* aData) |
|
209 { |
|
210 TBool handle = EFalse; |
|
211 TInt* data = (TInt*) aData; |
|
212 switch (aCmd) |
|
213 { |
|
214 case ECmdPenInputDimArrowKeys: |
|
215 { |
|
216 TBool IsDimArrowKeys = *aData; |
|
217 DimArrowKeys( IsDimArrowKeys ); |
|
218 } |
|
219 break; |
|
220 case ECmdPenInputEnableSettingBtn: |
|
221 { |
|
222 CAknFepCtrlCommonButton * optionsbtn; |
|
223 TBool enable = *data; |
|
224 optionsbtn = static_cast<CAknFepCtrlCommonButton *>(iWindow->Control(ECtrlIdOptions)); |
|
225 if(optionsbtn && !enable) |
|
226 { |
|
227 optionsbtn->SetDimmed(ETrue); |
|
228 handle = ETrue; |
|
229 iDimOperationBtn = ETrue; |
|
230 } |
|
231 else if(optionsbtn && enable) |
|
232 { |
|
233 optionsbtn->SetDimmed(EFalse); |
|
234 handle = ETrue; |
|
235 iDimOperationBtn = EFalse; |
|
236 } |
|
237 break; |
|
238 } |
|
239 case ECmdPenInputSymbolOfHardKeyOne: |
|
240 { |
|
241 iWindow->SetHardKeyOneSymbol(aData); |
|
242 handle = ETrue; |
|
243 } |
|
244 break; |
|
245 |
|
246 case ECmdPenInputInEditWordQueryDlg: |
|
247 { |
|
248 iInEditWordQueryDlg = *data; |
|
249 } |
|
250 break; |
|
251 case ECmdPenInputSetPromptText: |
|
252 { |
|
253 if( iDataMgr->IsSpellMode()) |
|
254 { |
|
255 SetPromptTextL(aData); |
|
256 handle = ETrue; |
|
257 } |
|
258 } |
|
259 break; |
|
260 case ECmdPenInputFingerMatchIndicator: |
|
261 { |
|
262 iWindow->UpdateIndiBubbleL( aData ); |
|
263 handle = ETrue; |
|
264 } |
|
265 break; |
|
266 default: |
|
267 break; |
|
268 |
|
269 }; |
|
270 return handle; |
|
271 } |
|
272 |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CSplitItutWindowManager::SizeChanged |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 TInt CSplitItutWindowManager::SizeChanged() |
|
279 { |
|
280 return iWindow->SizeChanged(); |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------------------------- |
|
284 // CSplitItutWindowManager::SubmitText |
|
285 // --------------------------------------------------------------------------- |
|
286 // |
|
287 void CSplitItutWindowManager::SubmitText(const TDesC& aEventData) |
|
288 { |
|
289 iLayoutOwner->SignalOwner(ESignalKeyEvent, aEventData); |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // CSplitItutWindowManager::OnSkinChange |
|
294 // --------------------------------------------------------------------------- |
|
295 // |
|
296 TInt CSplitItutWindowManager::OnSkinChange() |
|
297 { |
|
298 TRAPD(err, |
|
299 iWindow->ConstructSpellCtrlFromResourceL(); |
|
300 iWindow->ConstructItutKeypadFromResourceL(iWindow->ItutKeypad()->ResourceId())); |
|
301 |
|
302 iWindow->OnSkinChange(); |
|
303 return err; |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CSplitItutWindowManager::OnSkinChange |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CSplitItutWindowManager::ShowArrowBtn(TInt aShowFlag) |
|
311 { |
|
312 iWindow->Control(ECtrlIdArrowLeft)->Hide(!(EBtnArrowLeft & aShowFlag)); |
|
313 iWindow->Control(ECtrlIdArrowRight)->Hide(!(EBtnArrowRight & aShowFlag)); |
|
314 // iWindow->Control(ECtrlIdArrowUp)->Hide(!(EBtnArrowUp & aShowFlag)); |
|
315 // iWindow->Control(ECtrlIdArrowDown)->Hide(!(EBtnArrowDown & aShowFlag)); |
|
316 } |
|
317 |
|
318 // --------------------------------------------------------------------------- |
|
319 // CSplitItutWindowManager::UiLayout |
|
320 // --------------------------------------------------------------------------- |
|
321 // |
|
322 CFepUiLayout* CSplitItutWindowManager::UiLayout() |
|
323 { |
|
324 return iLayoutOwner; |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // CSplitItutWindowManager::HandleAppInfoChangeL |
|
329 // --------------------------------------------------------------------------- |
|
330 // |
|
331 void CSplitItutWindowManager::HandleAppInfoChangeL(const TDesC& /*aInfo*/) |
|
332 { |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CSplitItutWindowManager::ApplyVariantLafDataL |
|
337 // --------------------------------------------------------------------------- |
|
338 // |
|
339 void CSplitItutWindowManager::ApplyVariantLafDataL(TBool aResolutionChange) |
|
340 { |
|
341 iWindow->ApplyVariantLafDataL(aResolutionChange); |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // CSplitItutWindowManager::ApplyVariantLafDataForSpellL |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 void CSplitItutWindowManager::ApplyVariantLafDataForSpellL() |
|
349 { |
|
350 iWindow->ApplyVariantLafDataForSpellL(); |
|
351 } |
|
352 |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CSplitItutWindowManager::CreateChineseSpecificCtrlsIfNeededL |
|
356 // --------------------------------------------------------------------------- |
|
357 // |
|
358 void CSplitItutWindowManager::CreateChineseSpecificCtrlsIfNeededL() |
|
359 { |
|
360 iWindow->CreateChineseSpecificCtrlsIfNeededL(); |
|
361 } |
|
362 |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // CSplitItutWindowManager::SetLastRawKeyDown |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 void CSplitItutWindowManager::SetLastRawKeyDown(TInt aScanCode, TBool aKeyDown, |
|
369 CFepUiBaseCtrl* aCtrl) |
|
370 { |
|
371 !aKeyDown ? iLastRawKeyDown = EStdKeyNull : iLastRawKeyDown = aScanCode; |
|
372 iRawKeyDown = aKeyDown; |
|
373 iRawKeyCtrl = aCtrl; |
|
374 } |
|
375 |
|
376 // --------------------------------------------------------------------------- |
|
377 // CSplitItutWindowManager::Control |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 CFepUiBaseCtrl* CSplitItutWindowManager::Control(TInt aCtrlId) |
|
381 { |
|
382 return iWindow->Control(aCtrlId); |
|
383 } |
|
384 |
|
385 // --------------------------------------------------------------------------- |
|
386 // CSplitItutWindowManager::OnActivate |
|
387 // --------------------------------------------------------------------------- |
|
388 // |
|
389 void CSplitItutWindowManager::OnActivate() |
|
390 { |
|
391 if (iDimOperationBtn) |
|
392 { |
|
393 static_cast<CAknFepCtrlCommonButton*>(Control(ECtrlIdOptions))->SetDimmed(ETrue); |
|
394 } |
|
395 else |
|
396 { |
|
397 static_cast<CAknFepCtrlCommonButton*>(Control(ECtrlIdOptions))->SetDimmed(EFalse); |
|
398 } |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // CSplitItutWindowManager::DimArrowKeys |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 void CSplitItutWindowManager::DimArrowKeys( TBool aDimArrow ) |
|
406 { |
|
407 if (iDataMgr->IsChinese()) |
|
408 { |
|
409 CAknFepCtrlRawKeyButton * leftbtn; |
|
410 CAknFepCtrlRawKeyButton * rightbtn; |
|
411 // CAknFepCtrlRawKeyButton * upbtn; |
|
412 // CAknFepCtrlRawKeyButton * downbtn; |
|
413 leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowLeft)); |
|
414 rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowRight)); |
|
415 // upbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowUp)); |
|
416 // downbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowDown)); |
|
417 |
|
418 leftbtn->SetDimmed(aDimArrow); |
|
419 rightbtn->SetDimmed(aDimArrow); |
|
420 // upbtn->SetDimmed(aDimArrow); |
|
421 // downbtn->SetDimmed(aDimArrow); |
|
422 |
|
423 } |
|
424 else |
|
425 { |
|
426 CAknFepCtrlRawKeyButton * leftbtn; |
|
427 CAknFepCtrlRawKeyButton * rightbtn; |
|
428 leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowLeft)); |
|
429 rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iWindow->Control(ECtrlIdArrowRight)); |
|
430 |
|
431 leftbtn->SetDimmed(aDimArrow); |
|
432 rightbtn->SetDimmed(aDimArrow); |
|
433 } |
|
434 } |
|
435 |
|
436 // --------------------------------------------------------------------------- |
|
437 // CSplitItutWindowManager::ShowBubble |
|
438 // --------------------------------------------------------------------------- |
|
439 // |
|
440 void CSplitItutWindowManager::ShowBubble(TInt /*aShow*/) |
|
441 { |
|
442 /* |
|
443 CFepCtrlDropdownList* spell = |
|
444 static_cast<CFepCtrlDropdownList*>(iWindow->Control(ECtrlIdSpellCandsList)); |
|
445 CFepCtrlDropdownList* standard = |
|
446 static_cast<CFepCtrlDropdownList*>(iWindow->Control(ECtrlIdStdCandsList)); |
|
447 CFepCtrlDropdownList* punctuation = |
|
448 static_cast<CFepCtrlDropdownList*>(iWindow->Control(ECtrlIdPuncCandsList)); |
|
449 |
|
450 if (aShow > 0) |
|
451 { |
|
452 TRect outrect,innerrect; |
|
453 outrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleRect)); |
|
454 innerrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleInnerRect)); |
|
455 TAknTextLineLayout bubbleTextLayout = |
|
456 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EPreviewBubbleTextlayout)); |
|
457 CFont* bubbleFont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EPreviewBubbleFont)); |
|
458 |
|
459 spell->ShowBubble(ETrue); |
|
460 standard->ShowBubble(ETrue); |
|
461 punctuation->ShowBubble(ETrue); |
|
462 |
|
463 spell->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); |
|
464 |
|
465 spell->SetTextFormat(bubbleTextLayout); |
|
466 spell->SetBubbleTextFont(bubbleFont); |
|
467 spell->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
468 spell->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
469 innerrect.iTl.iY - outrect.iTl.iY, |
|
470 outrect.iBr.iX - innerrect.iBr.iX, |
|
471 outrect.iBr.iY - innerrect.iBr.iY); |
|
472 |
|
473 standard->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); |
|
474 |
|
475 standard->SetTextFormat(bubbleTextLayout); |
|
476 standard->SetBubbleTextFont(bubbleFont); |
|
477 standard->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
478 standard->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
479 innerrect.iTl.iY - outrect.iTl.iY, |
|
480 outrect.iBr.iX - innerrect.iBr.iX, |
|
481 outrect.iBr.iY - innerrect.iBr.iY); |
|
482 |
|
483 punctuation->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); |
|
484 |
|
485 punctuation->SetTextFormat(bubbleTextLayout); |
|
486 punctuation->SetBubbleTextFont(bubbleFont); |
|
487 punctuation->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
488 punctuation->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
489 innerrect.iTl.iY - outrect.iTl.iY, |
|
490 outrect.iBr.iX - innerrect.iBr.iX, |
|
491 outrect.iBr.iY - innerrect.iBr.iY); |
|
492 } |
|
493 else |
|
494 { |
|
495 spell->ShowBubble(EFalse); |
|
496 standard->ShowBubble(EFalse); |
|
497 punctuation->ShowBubble(EFalse); |
|
498 } |
|
499 */ |
|
500 } |
|
501 |
|
502 // --------------------------------------------------------------------------- |
|
503 // CSplitItutWindowManager::ShowBubble |
|
504 // --------------------------------------------------------------------------- |
|
505 // |
|
506 void CSplitItutWindowManager::SetPromptTextL(TUint8* aData) |
|
507 { |
|
508 iWindow->SetPromptTextL(aData); |
|
509 } |
|
510 |
|
511 void CSplitItutWindowManager::SetLanguage( TInt aLanguage ) |
|
512 { |
|
513 CFepLayoutMultiLineIcf* icf = iWindow->Icf(); |
|
514 if ( icf ) |
|
515 { |
|
516 icf->SetLanguageId( aLanguage ); |
|
517 } |
|
518 } |
|
519 |
|
520 // End Of File |