|
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: split itu-t layout |
|
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 |
|
32 #include <s32mem.h> |
|
33 //#include <peninputlayoutbubblectrl.h> |
|
34 |
|
35 #include <peninputdataprovider.h> |
|
36 #include <peninputcommonlayoutglobalenum.h> |
|
37 |
|
38 #include "peninputsplititutlayout.h" |
|
39 #include "peninputsplititutdatamgr.h" |
|
40 #include "peninputsplititutuimgrbase.h" |
|
41 #include "peninputsplititutuistatebase.h" |
|
42 #include "peninputsplititutchnuimgr.h" |
|
43 #include "peninputsplititutwesternuimgr.h" |
|
44 #include "peninputsplititutconverter.h" |
|
45 #include "peninputsplititutwindowmanager.h" |
|
46 |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CSplitItutUiLayout::NewL |
|
50 // (other items were commented in a header) |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CSplitItutUiLayout* CSplitItutUiLayout::NewL(MLayoutOwner* aLayoutOwner, |
|
54 const TAny* aInitData) |
|
55 { |
|
56 CSplitItutUiLayout* layout = new (ELeave) CSplitItutUiLayout(aLayoutOwner); |
|
57 |
|
58 CleanupStack::PushL(layout); |
|
59 layout->ConstructL(aInitData); |
|
60 CleanupStack::Pop(layout); |
|
61 |
|
62 return layout; |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CSplitItutUiLayout::CSplitItutUiLayout |
|
67 // (other items were commented in a header) |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 CSplitItutUiLayout::CSplitItutUiLayout(MLayoutOwner* aLayoutOwner) |
|
71 :CFepUiLayout(aLayoutOwner) |
|
72 { |
|
73 } |
|
74 |
|
75 // ---------CSplitItutUiLayout---------------------------------------- |
|
76 // CSplitItutUiLayout::~CSplitItutUiLayout |
|
77 // (other items were commented in a header) |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CSplitItutUiLayout::~CSplitItutUiLayout() |
|
81 { |
|
82 delete iDataMgr; |
|
83 delete iChnUiMgr; |
|
84 delete iWesternUiMgr; |
|
85 delete iWindowMgr; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CSplitItutUiLayout::OnAppEditorTextComing |
|
90 // (other items were commented in a header) |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 TInt CSplitItutUiLayout::OnAppEditorTextComing(const TFepInputContextFieldData& aData) |
|
94 { |
|
95 TInt err = 0; |
|
96 if ( iDataMgr->IsSpellMode()) |
|
97 { |
|
98 // Update the icf text |
|
99 err = iWindowMgr->OnAppEditorTextComing( aData ); |
|
100 } |
|
101 |
|
102 // notify icf has text or not |
|
103 if ( UiMgr()->CurrentState() && |
|
104 UiMgr()->CurrentState()->StateType() == CSplitItutUiMgrBase::EStateSpelling ) |
|
105 { |
|
106 TRAP_IGNORE(UiMgr()->HandleCommandL(EItutCmdCheckIcfEmpty, NULL)); |
|
107 } |
|
108 |
|
109 return err; |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // CSplitItutUiLayout::ConstructL |
|
114 // (other items were commented in a header) |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CSplitItutUiLayout::ConstructL(const TAny* aInitData) |
|
118 { |
|
119 BaseConstructL(); |
|
120 |
|
121 TPeninputLayoutData* layoutData = (TPeninputLayoutData*)aInitData; |
|
122 |
|
123 iDataMgr = CSplitItutDataMgr::NewL(this, layoutData->iPtiEngine ); |
|
124 SetScreenSize(TItutDataConverter::AnyToSize(iDataMgr->RequestData(EScreenSize))); |
|
125 |
|
126 // western ui mgr is default ui mgr |
|
127 iWindowMgr = CSplitItutWindowManager::NewL(this, iDataMgr); |
|
128 iDataMgr->AddSubscriber(iWindowMgr); |
|
129 iWesternUiMgr = CWesternSplitItutUiMgr::NewL(this, iDataMgr, iWindowMgr); |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CSplitItutUiLayout::SimulateRawEvent |
|
134 // (other items were commented in a header) |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CSplitItutUiLayout::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
|
138 { |
|
139 TRawEvent event; |
|
140 event.Set(aType,aScanCode); |
|
141 |
|
142 TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16)); |
|
143 |
|
144 SignalOwner(ESignalSimulateEvent,eventPtr); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CSplitItutUiLayout::HandleControlEvent |
|
149 // (other items were commented in a header) |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void CSplitItutUiLayout::HandleControlEvent(TInt aEventType, |
|
153 CFepUiBaseCtrl* aCtrl, |
|
154 const TDesC& aEventData) |
|
155 { |
|
156 TBool handled = EFalse; |
|
157 |
|
158 if (UiMgr()) |
|
159 { |
|
160 TRAP_IGNORE(handled = UiMgr()->HandleCtrlEventL(aEventType, |
|
161 aCtrl, |
|
162 aEventData)); |
|
163 } |
|
164 |
|
165 if (handled) |
|
166 { |
|
167 return; |
|
168 } |
|
169 |
|
170 TRAP_IGNORE(iWindowMgr->HandleCtrlEventL(aEventType, |
|
171 aCtrl, |
|
172 aEventData)); |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CSplitItutUiLayout::HandleCommand |
|
177 // (other items were commented in a header) |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 TInt CSplitItutUiLayout::HandleCommand(TInt aCmd, TUint8* aData) |
|
181 { |
|
182 if ( KErrNone == CFepUiLayout::HandleCommand( aCmd, aData ) ) |
|
183 { |
|
184 return KErrNone; |
|
185 } |
|
186 |
|
187 TUint* data = (TUint*) aData; |
|
188 |
|
189 switch(aCmd) |
|
190 { |
|
191 case ECmdPenInputLanguage: |
|
192 { |
|
193 TRAP_IGNORE(SetInputLanguageL(*data)); |
|
194 |
|
195 } |
|
196 break; |
|
197 case ECmdPenInputRange: |
|
198 { |
|
199 iDataMgr->SetLatinOnly( *data ); |
|
200 } |
|
201 break; |
|
202 case ECmdPenInputFingerInputMode: |
|
203 { |
|
204 TRAP_IGNORE(SetInputModeL(*data)); |
|
205 } |
|
206 break; |
|
207 case ECmdPenInputFingerKeyPress: |
|
208 case ECmdPenInputFingerLongKeyPress: |
|
209 case ECmdPenInputCase: |
|
210 case ECmdPenInputFingerMatchSelection: |
|
211 case ECmdPenInputFingerSpelling: |
|
212 { |
|
213 if (UiMgr()) |
|
214 { |
|
215 TInt handled = KErrNone; |
|
216 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
217 return handled; |
|
218 } |
|
219 } |
|
220 break; |
|
221 case ECmdPenInputFingerMatchList: |
|
222 { |
|
223 if (UiMgr()) |
|
224 { |
|
225 TInt handled = KErrNone; |
|
226 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
227 return handled; |
|
228 } |
|
229 } |
|
230 break; |
|
231 case ECmdPenInputNoFreeSpace: |
|
232 { |
|
233 TRAP_IGNORE(ChineseUiManager()->HandleCommandL(ECmdPenInputNoFreeSpace, NULL)); |
|
234 } |
|
235 case ECmdPenInputSetPromptText: |
|
236 case ECmdPenInputFingerMatchIndicator: |
|
237 case ECmdPenInputSendEditMenuData: |
|
238 case ECmdPenInputEnableSettingBtn: |
|
239 case ECmdPenInputDimArrowKeys: |
|
240 case ECmdPenInputRotation: |
|
241 { |
|
242 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
243 } |
|
244 break; |
|
245 case ECmdPenInputIsSecretText: |
|
246 { |
|
247 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
248 *data ? iIsSecret = ETrue: iIsSecret = EFalse; |
|
249 if (UiMgr()) |
|
250 { |
|
251 TInt handled = KErrNone; |
|
252 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
253 return handled; |
|
254 } |
|
255 } |
|
256 break; |
|
257 case ECmdPenInputEnableIndicatorButton: |
|
258 { |
|
259 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
260 } |
|
261 break; |
|
262 |
|
263 case ECmdPenInputSymbolOfHardKeyOne: |
|
264 case ECmdPenInputInEditWordQueryDlg: |
|
265 { |
|
266 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
267 } |
|
268 break; |
|
269 case ECmdPenInputIsNumberGrouping: |
|
270 { |
|
271 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
272 } |
|
273 break; |
|
274 case ECmdPenInputEditorNumericKeyMap: |
|
275 { |
|
276 iDataMgr->SetNumericKeymap( *data ); |
|
277 } |
|
278 break; |
|
279 case ECmdPenInputEditorCustomNumericKeyMap: |
|
280 { |
|
281 iDataMgr->SetNumericKeymapData( (TInt*) data ); |
|
282 } |
|
283 break; |
|
284 case ECmdPenInputPermittedRange: |
|
285 { |
|
286 iDataMgr->SetNumericOnly( *data ); |
|
287 } |
|
288 break; |
|
289 case ECmdPenInputCharacterPreview: |
|
290 { |
|
291 // iWindowMgr->ShowBubble(*aData); |
|
292 } |
|
293 break; |
|
294 |
|
295 default: |
|
296 break; |
|
297 } |
|
298 |
|
299 return KErrNone; |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------------------------- |
|
303 // CSplitItutUiLayout::PenInputType |
|
304 // (other items were commented in a header) |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 TInt CSplitItutUiLayout::PenInputType() |
|
308 { |
|
309 return EPluginInputModeItut; |
|
310 } |
|
311 |
|
312 // --------------------------------------------------------------------------- |
|
313 // CSplitItutUiLayout::SizeChanged |
|
314 // (other items were commented in a header) |
|
315 // --------------------------------------------------------------------------- |
|
316 // |
|
317 TInt CSplitItutUiLayout::SizeChanged(const TAny* /*pData*/) |
|
318 { |
|
319 iDataMgr->ReadLafInfo(); |
|
320 |
|
321 // set layout rect |
|
322 SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(ELayoutRect))); |
|
323 |
|
324 iWindowMgr->SizeChanged(); |
|
325 |
|
326 return KErrNone; |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // CSplitItutUiLayout::SubmitText |
|
331 // (other items were commented in a header) |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 void CSplitItutUiLayout::SubmitText(const TDesC& aEventData) |
|
335 { |
|
336 SignalOwner(ESignalKeyEvent, aEventData); |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // CSplitItutUiLayout::OnSkinChange |
|
341 // (other items were commented in a header) |
|
342 // --------------------------------------------------------------------------- |
|
343 // |
|
344 TInt CSplitItutUiLayout::OnSkinChange() |
|
345 { |
|
346 CFepUiLayout::OnSkinChange(); |
|
347 |
|
348 TInt err = iWindowMgr->OnSkinChange(); |
|
349 |
|
350 return err; |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------------------------- |
|
354 // CSplitItutUiLayout::PressOnCtrls |
|
355 // (other items were commented in a header) |
|
356 // --------------------------------------------------------------------------- |
|
357 // |
|
358 TBool CSplitItutUiLayout::PressOnCtrls(TPoint aPt) |
|
359 { |
|
360 const RPointerArray<CFepUiBaseCtrl>& ctrllist = RootControl()->ControlList(); |
|
361 |
|
362 for (TInt i = 0; i < ctrllist.Count(); i++) |
|
363 { |
|
364 if (!ctrllist[i]->Hiden() && ctrllist[i]->Rect().Contains(aPt)) |
|
365 { |
|
366 return ETrue; |
|
367 } |
|
368 } |
|
369 |
|
370 return EFalse; |
|
371 } |
|
372 |
|
373 // --------------------------------------------------------------------------- |
|
374 // CSplitItutUiLayout::UiMgr |
|
375 // (other items were commented in a header) |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 CSplitItutUiMgrBase* CSplitItutUiLayout::UiMgr() |
|
379 { |
|
380 if (iDataMgr->IsChinese()) |
|
381 { |
|
382 iCurrentUiMgr = ChineseUiManager(); |
|
383 } |
|
384 else |
|
385 { |
|
386 iCurrentUiMgr = iWesternUiMgr; |
|
387 } |
|
388 |
|
389 return iCurrentUiMgr; |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------------------------- |
|
393 // CSplitItutUiLayout::SetInputModeL |
|
394 // (other items were commented in a header) |
|
395 // --------------------------------------------------------------------------- |
|
396 // |
|
397 void CSplitItutUiLayout::SetInputModeL(TInt aMode) |
|
398 { |
|
399 // both EStrokeFind and EStroke will be stored as EStroke |
|
400 if (aMode != iDataMgr->InputMode() || |
|
401 aMode == EStroke || aMode == EStrokeFind || |
|
402 aMode == EZhuyin || aMode == EZhuyinFind || |
|
403 ( iDataMgr->IsNumericOnly() && iDataMgr->IsCharFlagChanged() ) ) |
|
404 { |
|
405 // deactivate original uimgr first |
|
406 iDataMgr->SetInputModeL(aMode); |
|
407 |
|
408 UiMgr()->ActivateUiL(); |
|
409 } |
|
410 } |
|
411 |
|
412 // --------------------------------------------------------------------------- |
|
413 // CSplitItutUiLayout::SetInputLanguageL |
|
414 // (other items were commented in a header) |
|
415 // --------------------------------------------------------------------------- |
|
416 // |
|
417 void CSplitItutUiLayout::SetInputLanguageL(TInt aLanguage) |
|
418 { |
|
419 TInt previousLang = iDataMgr->InputLanguage(); |
|
420 iDataMgr->SetLanguageL(aLanguage); |
|
421 iWindowMgr->SetLanguage( aLanguage ); |
|
422 |
|
423 if (previousLang != aLanguage) |
|
424 { |
|
425 ApplyVariantLafDataL(); |
|
426 } |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CSplitItutUiLayout::OnDeActivate |
|
431 // (other items were commented in a header) |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 void CSplitItutUiLayout::OnDeActivate() |
|
435 { |
|
436 TRAP_IGNORE(UiMgr()->HandleCommandL(ECmdPenInputDeActive, NULL)); |
|
437 |
|
438 CFepUiLayout::OnDeActivate(); |
|
439 } |
|
440 |
|
441 // --------------------------------------------------------------------------- |
|
442 // CSplitItutUiLayout::OnActivate |
|
443 // (other items were commented in a header) |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 void CSplitItutUiLayout::OnActivate() |
|
447 { |
|
448 CFepUiLayout::OnActivate(); |
|
449 |
|
450 SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(ELayoutRect))); |
|
451 TPoint offset = TItutDataConverter::AnyToPoint(iDataMgr->RequestData(ELayoutOffset)); |
|
452 |
|
453 if(iDataMgr->IsSpellMode()) |
|
454 { |
|
455 offset = TPoint(0,0); |
|
456 } |
|
457 |
|
458 LayoutOwner()->SetPosition( offset ); |
|
459 |
|
460 iWindowMgr->OnActivate(); |
|
461 } |
|
462 |
|
463 // --------------------------------------------------------------------------- |
|
464 // CSplitItutUiLayout::UiLayout |
|
465 // (other items were commented in a header) |
|
466 // --------------------------------------------------------------------------- |
|
467 // |
|
468 CFepUiLayout* CSplitItutUiLayout::UiLayout() |
|
469 { |
|
470 return this; |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // CSplitItutUiLayout::HandleAppInfoChange |
|
475 // (other items were commented in a header) |
|
476 // --------------------------------------------------------------------------- |
|
477 // |
|
478 void CSplitItutUiLayout::HandleAppInfoChange(const TDesC& aInfo, |
|
479 TPeninputAppInfo aType) |
|
480 { |
|
481 if ( aType == EAppIndicatorMsg ) |
|
482 { |
|
483 TRAP_IGNORE(iWindowMgr->HandleAppInfoChangeL(aInfo)); |
|
484 } |
|
485 } |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // CSplitItutUiLayout::ShowArrowBtn |
|
489 // (other items were commented in a header) |
|
490 // --------------------------------------------------------------------------- |
|
491 // |
|
492 void CSplitItutUiLayout::ShowArrowBtn(TInt aShowFlag) |
|
493 { |
|
494 iWindowMgr->ShowArrowBtn(aShowFlag); |
|
495 } |
|
496 |
|
497 // --------------------------------------------------------------------------- |
|
498 // CSplitItutUiLayout::ApplyVariantLafDataL |
|
499 // (other items were commented in a header) |
|
500 // --------------------------------------------------------------------------- |
|
501 // |
|
502 void CSplitItutUiLayout::ApplyVariantLafDataL(TBool aResolutionChange) |
|
503 { |
|
504 iWindowMgr->ApplyVariantLafDataL(aResolutionChange); |
|
505 } |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // CSplitItutUiLayout::ApplyVariantLafDataForSpellL |
|
509 // (other items were commented in a header) |
|
510 // --------------------------------------------------------------------------- |
|
511 // |
|
512 void CSplitItutUiLayout::ApplyVariantLafDataForSpellL() |
|
513 { |
|
514 iWindowMgr->ApplyVariantLafDataForSpellL(); |
|
515 } |
|
516 |
|
517 // --------------------------------------------------------------------------- |
|
518 // CSplitItutUiLayout::UiManager |
|
519 // (other items were commented in a header) |
|
520 // --------------------------------------------------------------------------- |
|
521 // |
|
522 CSplitItutWindowManager* CSplitItutUiLayout::UiManager() |
|
523 { |
|
524 return iWindowMgr; |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // CSplitItutUiLayout::Control |
|
529 // (other items were commented in a header) |
|
530 // --------------------------------------------------------------------------- |
|
531 // |
|
532 CFepUiBaseCtrl* CSplitItutUiLayout::Control(TInt aCtrlId) |
|
533 { |
|
534 return iWindowMgr->Control(aCtrlId); |
|
535 } |
|
536 |
|
537 // --------------------------------------------------------------------------- |
|
538 // CSplitItutUiLayout::ChineseUiManager |
|
539 // (other items were commented in a header) |
|
540 // --------------------------------------------------------------------------- |
|
541 // |
|
542 CSplitItutUiMgrBase* CSplitItutUiLayout::ChineseUiManager() |
|
543 { |
|
544 if (!iChnUiMgr) |
|
545 { |
|
546 TRAP_IGNORE( iChnUiMgr = CChnSplitItutUiMgr::NewL(this, iDataMgr, iWindowMgr) ); |
|
547 } |
|
548 |
|
549 return iChnUiMgr; |
|
550 |
|
551 } |
|
552 |
|
553 // End Of File |