|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknlayoutscalable_apps.cdl.h> |
|
20 #include <peninputgeneralitutnew.rsg> |
|
21 #include <peninputitutconfig_chinese.rsg> |
|
22 #include <skinlayout.cdl.h> |
|
23 #include <AknsDrawUtils.h> |
|
24 #include <AknsUtils.h> |
|
25 #include <AknUtils.h> |
|
26 #include <peninputrawkeybutton.h> |
|
27 #include <peninputrepeatbutton.h> |
|
28 #include <peninputcommonbutton.h> |
|
29 #include "peninputrepeatbuttonex.h" |
|
30 #include <AknFepGlobalEnums.h> |
|
31 #include <aknfeppeninputenums.h> |
|
32 #include <peninputdropdownlist.h> |
|
33 #include <peninputlayoutchoicelist.h> |
|
34 #include <peninputscrollablelist.h> |
|
35 #include <s32mem.h> |
|
36 #include <peninputlabel.h> |
|
37 #include <peninputlayoutinputmodechoice.h> |
|
38 #include <peninputlayoutbubblectrl.h> |
|
39 |
|
40 #include "peninputgenericitutlayout.h" |
|
41 #include "peninputgenericitutdatamgr.h" |
|
42 #include "peninputgenericitutuimgrbase.h" |
|
43 #include "peninputgenericitutuistatebase.h" |
|
44 #include "peninputitutchnuimgr.h" |
|
45 #include "peninputitutwesternuimgr.h" |
|
46 #include "peninputgenericitutconverter.h" |
|
47 #include "peninputgenericitutwindowmanager.h" |
|
48 |
|
49 |
|
50 |
|
51 CGenericItutUiLayout* CGenericItutUiLayout::NewL(MLayoutOwner* aLayoutOwner, |
|
52 const TAny* aInitData) |
|
53 { |
|
54 CGenericItutUiLayout* layout = new (ELeave) CGenericItutUiLayout(aLayoutOwner); |
|
55 |
|
56 CleanupStack::PushL(layout); |
|
57 layout->ConstructL(aInitData); |
|
58 CleanupStack::Pop(layout); |
|
59 |
|
60 return layout; |
|
61 } |
|
62 |
|
63 CGenericItutUiLayout::CGenericItutUiLayout(MLayoutOwner* aLayoutOwner) |
|
64 :CFepUiLayout(aLayoutOwner) |
|
65 { |
|
66 } |
|
67 |
|
68 CGenericItutUiLayout::~CGenericItutUiLayout() |
|
69 { |
|
70 delete iDataMgr; |
|
71 delete iChnUiMgr; |
|
72 delete iWesternUiMgr; |
|
73 delete iWindowMgr; |
|
74 } |
|
75 |
|
76 void CGenericItutUiLayout::ConstructL(const TAny* aInitData) |
|
77 { |
|
78 BaseConstructL(); |
|
79 |
|
80 TPeninputLayoutData* layoutData = (TPeninputLayoutData*)aInitData; |
|
81 |
|
82 iDataMgr = CGenericItutDataMgr::NewL(this, layoutData->iPtiEngine ); |
|
83 |
|
84 |
|
85 SetScreenSize(TItutDataConverter::AnyToSize(iDataMgr->RequestData(EScreenSize))); |
|
86 |
|
87 SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(ELayoutRect))); |
|
88 |
|
89 // western ui mgr is default ui mgr |
|
90 iWindowMgr = CGenericItutWindowManager::NewL(this, iDataMgr); |
|
91 iDataMgr->AddSubscriber(iWindowMgr); |
|
92 iWesternUiMgr = CWesternItutUiMgr::NewL(this, iDataMgr, iWindowMgr); |
|
93 } |
|
94 |
|
95 |
|
96 void CGenericItutUiLayout::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
|
97 { |
|
98 TRawEvent event; |
|
99 event.Set(aType,aScanCode); |
|
100 |
|
101 TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16)); |
|
102 |
|
103 SignalOwner(ESignalSimulateEvent,eventPtr); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // Simulate raw event to window server immediately. |
|
108 // simulating raw event command won't be scheduled by AO |
|
109 // because it won't be added into CPeninputAnimObj::iAnimCmd. |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CGenericItutUiLayout::SimulateImmeRawEvent( TInt aScanCode, TRawEvent::TType aType ) |
|
113 { |
|
114 TRawEvent event; |
|
115 event.Set(aType,aScanCode); |
|
116 TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16)); |
|
117 SignalOwner( ESignalImmeSimulateEvent, eventPtr ); |
|
118 } |
|
119 |
|
120 void CGenericItutUiLayout::HandleControlEvent(TInt aEventType, |
|
121 CFepUiBaseCtrl* aCtrl, |
|
122 const TDesC& aEventData) |
|
123 { |
|
124 TBool handled = EFalse; |
|
125 |
|
126 if (UiMgr()) |
|
127 { |
|
128 TRAP_IGNORE(handled = UiMgr()->HandleCtrlEventL(aEventType, |
|
129 aCtrl, |
|
130 aEventData)); |
|
131 } |
|
132 |
|
133 if (handled) |
|
134 { |
|
135 return; |
|
136 } |
|
137 |
|
138 TRAP_IGNORE(iWindowMgr->HandleCtrlEventL(aEventType, |
|
139 aCtrl, |
|
140 aEventData)); |
|
141 } |
|
142 |
|
143 TInt CGenericItutUiLayout::OnAppEditorTextComing(const TFepInputContextFieldData& aData) |
|
144 { |
|
145 TInt err = iWindowMgr->OnAppEditorTextComing(aData); |
|
146 |
|
147 if (UiMgr()->CurrentState() && |
|
148 UiMgr()->CurrentState()->StateType() == CGenericItutUiMgrBase::EStateSpelling) |
|
149 { |
|
150 TRAP_IGNORE(UiMgr()->HandleCommandL(EItutCmdCheckIcfEmpty, NULL)); |
|
151 } |
|
152 |
|
153 return err; |
|
154 } |
|
155 |
|
156 |
|
157 TInt CGenericItutUiLayout::HandleCommand(TInt aCmd, TUint8* aData) |
|
158 { |
|
159 if ( KErrNone == CFepUiLayout::HandleCommand( aCmd, aData ) ) |
|
160 { |
|
161 return KErrNone; |
|
162 } |
|
163 |
|
164 TUint* data = (TUint*) aData; |
|
165 |
|
166 switch(aCmd) |
|
167 { |
|
168 case ECmdPenInputLanguage: |
|
169 { |
|
170 TRAP_IGNORE(SetInputLanguageL(*data)); |
|
171 |
|
172 } |
|
173 break; |
|
174 case ECmdPenInputRange: |
|
175 { |
|
176 iDataMgr->SetLatinOnly( *data ); |
|
177 } |
|
178 break; |
|
179 case ECmdPenInputFingerInputMode: |
|
180 { |
|
181 TRAP_IGNORE(SetInputModeL(*data)); |
|
182 } |
|
183 break; |
|
184 case ECmdPenInputFingerKeyPress: |
|
185 case ECmdPenInputFingerLongKeyPress: |
|
186 case EItutExtCmdCustomerState: |
|
187 case EItutExtCmdSetLayout: |
|
188 case EItutExtCmdDimKey: |
|
189 case EItutExtCmdHideKey: |
|
190 case EItutExtCmdAddKey: |
|
191 case EItutExtCmdSizeChanged: |
|
192 case EItutExtCmdSetIcfData: |
|
193 case ECmdPenInputCase: |
|
194 case ECmdPenInputFingerMatchSelection: |
|
195 case ECmdPenInputFingerSpelling: |
|
196 { |
|
197 if (UiMgr()) |
|
198 { |
|
199 TInt handled = KErrNone; |
|
200 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
201 return handled; |
|
202 } |
|
203 } |
|
204 break; |
|
205 case ECmdPenInputFingerMatchList: |
|
206 { |
|
207 if (UiMgr()) |
|
208 { |
|
209 TInt handled = KErrNone; |
|
210 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
211 return handled; |
|
212 } |
|
213 } |
|
214 break; |
|
215 case ECmdPenInputSetTextAlignment: |
|
216 { |
|
217 iDataMgr->SetIcfTextAlignment(*data); |
|
218 iDataMgr->SetTextAlignment(); |
|
219 } |
|
220 break; |
|
221 case ECmdPenInputNoFreeSpace: |
|
222 { |
|
223 TRAP_IGNORE(ChineseUiManager()->HandleCommandL(ECmdPenInputNoFreeSpace, NULL)); |
|
224 } |
|
225 case ECmdPenInputSetPromptText: |
|
226 case ECmdPenInputFingerMatchIndicator: |
|
227 case ECmdPenInputSendEditMenuData: |
|
228 case ECmdPenInputEnableSettingBtn: |
|
229 case ECmdPenInputDimArrowKeys: |
|
230 case ECmdPenInputRotation: |
|
231 { |
|
232 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
233 } |
|
234 break; |
|
235 case ECmdPenInputIsSecretText: |
|
236 { |
|
237 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
238 *data ? iIsSecret = ETrue: iIsSecret = EFalse; |
|
239 if (UiMgr()) |
|
240 { |
|
241 TInt handled = KErrNone; |
|
242 TRAP_IGNORE(handled = UiMgr()->HandleCommandL(aCmd, aData)); |
|
243 return handled; |
|
244 } |
|
245 } |
|
246 break; |
|
247 case ECmdPenInputEnableIndicatorButton: |
|
248 { |
|
249 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
250 } |
|
251 break; |
|
252 case ECmdPenInputSymbolOfHardKeyOne: |
|
253 case ECmdPenInputInEditWordQueryDlg: |
|
254 { |
|
255 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
256 } |
|
257 break; |
|
258 case ECmdPenInputIsNumberGrouping: |
|
259 { |
|
260 TRAP_IGNORE(iWindowMgr->HandleCommandL(aCmd, aData)); |
|
261 } |
|
262 break; |
|
263 case ECmdPenInputEditorNumericKeyMap: |
|
264 { |
|
265 iDataMgr->SetNumericKeymap( *data ); |
|
266 } |
|
267 break; |
|
268 case ECmdPenInputEditorCustomNumericKeyMap: |
|
269 { |
|
270 iDataMgr->SetNumericKeymapData( (TInt*) data ); |
|
271 } |
|
272 break; |
|
273 case ECmdPenInputPermittedRange: |
|
274 { |
|
275 iDataMgr->SetNumericOnly( *data ); |
|
276 } |
|
277 break; |
|
278 case ECmdPenInputCharacterPreview: |
|
279 { |
|
280 iWindowMgr->ShowBubble(*aData); |
|
281 } |
|
282 break; |
|
283 default: |
|
284 break; |
|
285 } |
|
286 |
|
287 return KErrNone; |
|
288 } |
|
289 |
|
290 TInt CGenericItutUiLayout::PenInputType() |
|
291 { |
|
292 return EPluginInputModeItut; |
|
293 } |
|
294 |
|
295 TInt CGenericItutUiLayout::SizeChanged(const TAny* /*pData*/) |
|
296 { |
|
297 TBool overLap = UiMgr()->CurrentState()->StateType() |
|
298 == CGenericItutUiMgrBase::EStateMatchSelection ? ETrue: EFalse; |
|
299 |
|
300 iDataMgr->ReadLafInfo(); |
|
301 |
|
302 // set layout rect |
|
303 SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(ELayoutRect))); |
|
304 |
|
305 iWindowMgr->SizeChanged(overLap); |
|
306 |
|
307 return KErrNone; |
|
308 } |
|
309 |
|
310 void CGenericItutUiLayout::SubmitText(const TDesC& aEventData) |
|
311 { |
|
312 SignalOwner(ESignalKeyEvent, aEventData); |
|
313 } |
|
314 |
|
315 TInt CGenericItutUiLayout::OnSkinChange() |
|
316 { |
|
317 CFepUiLayout::OnSkinChange(); |
|
318 |
|
319 TInt err = iWindowMgr->OnSkinChange(); |
|
320 |
|
321 return err; |
|
322 } |
|
323 |
|
324 |
|
325 TBool CGenericItutUiLayout::PressOnCtrls(TPoint aPt) |
|
326 { |
|
327 const RPointerArray<CFepUiBaseCtrl>& ctrllist = RootControl()->ControlList(); |
|
328 |
|
329 for (TInt i = 0; i < ctrllist.Count(); i++) |
|
330 { |
|
331 if (!ctrllist[i]->Hiden() && ctrllist[i]->Rect().Contains(aPt)) |
|
332 { |
|
333 return ETrue; |
|
334 } |
|
335 } |
|
336 |
|
337 return EFalse; |
|
338 } |
|
339 |
|
340 CGenericItutUiMgrBase* CGenericItutUiLayout::UiMgr() |
|
341 { |
|
342 if (iDataMgr->IsChinese()) |
|
343 { |
|
344 iCurrentUiMgr = ChineseUiManager(); |
|
345 } |
|
346 else |
|
347 { |
|
348 iCurrentUiMgr = iWesternUiMgr; |
|
349 } |
|
350 |
|
351 return iCurrentUiMgr; |
|
352 } |
|
353 |
|
354 void CGenericItutUiLayout::SetInputModeL(TInt aMode) |
|
355 { |
|
356 // fix EJML-7HM6GM, e.g. both EStrokeFind and EStroke will be stored as EStroke |
|
357 if (aMode != iDataMgr->InputMode() || |
|
358 aMode == EStroke || aMode == EStrokeFind || |
|
359 aMode == EZhuyin || aMode == EZhuyinFind || |
|
360 ( iDataMgr->IsNumericOnly() && iDataMgr->IsCharFlagChanged() ) ) |
|
361 { |
|
362 // deactivate original uimgr first |
|
363 if (iCurrentUiMgr |
|
364 && iCurrentUiMgr->CurrentState() |
|
365 && iCurrentUiMgr->CurrentState()->StateType() != CGenericItutUiMgrBase::EStateSpelling) |
|
366 { |
|
367 iCurrentUiMgr->DeactivateUI(); |
|
368 } |
|
369 |
|
370 iDataMgr->SetInputModeL(aMode); |
|
371 |
|
372 UiMgr()->ActivateUiL(); |
|
373 } |
|
374 } |
|
375 |
|
376 void CGenericItutUiLayout::SetInputLanguageL(TInt aLanguage) |
|
377 { |
|
378 TInt previousLang = iDataMgr->InputLanguage(); |
|
379 iDataMgr->SetLanguageL(aLanguage); |
|
380 iWindowMgr->SetLanguageL(aLanguage); |
|
381 |
|
382 if (previousLang != aLanguage) |
|
383 { |
|
384 ApplyVariantLafDataL(); |
|
385 } |
|
386 } |
|
387 |
|
388 void CGenericItutUiLayout::OnDeActivate() |
|
389 { |
|
390 TRAP_IGNORE(UiMgr()->HandleCommandL(ECmdPenInputDeActive, NULL)); |
|
391 |
|
392 CFepUiLayout::OnDeActivate(); |
|
393 } |
|
394 void CGenericItutUiLayout::OnActivate() |
|
395 { |
|
396 CFepUiLayout::OnActivate(); |
|
397 |
|
398 iWindowMgr->OnActivate(); |
|
399 } |
|
400 |
|
401 CFepUiLayout* CGenericItutUiLayout::UiLayout() |
|
402 { |
|
403 return this; |
|
404 } |
|
405 |
|
406 |
|
407 void CGenericItutUiLayout::EnterMatchSelectionState(TBool aOn) |
|
408 { |
|
409 TBuf<4> buf; |
|
410 buf.Append(reinterpret_cast<TText*>(&aOn), sizeof(TBool)/sizeof(TText)); |
|
411 SignalOwner(ESignalEnterMatchSelection, buf); |
|
412 } |
|
413 |
|
414 void CGenericItutUiLayout::HandleAppInfoChange(const TDesC& aInfo, |
|
415 TPeninputAppInfo aType) |
|
416 { |
|
417 if ( aType == EAppIndicatorMsg ) |
|
418 { |
|
419 TRAP_IGNORE(iWindowMgr->HandleAppInfoChangeL(aInfo)); |
|
420 } |
|
421 /* Teleca change begin, 19.05.2009 ssal */ |
|
422 if ( aType == EAppByteWarningMsg || aType == EAppMessageTypeChangeMsg) |
|
423 { |
|
424 TRAP_IGNORE(iWindowMgr->DisplayWarningNote(aInfo)); |
|
425 } |
|
426 /* Teleca change end, 19.05.2009 ssal */ |
|
427 } |
|
428 |
|
429 void CGenericItutUiLayout::ShowArrowBtn(TInt aShowFlag) |
|
430 { |
|
431 iWindowMgr->ShowArrowBtn(aShowFlag); |
|
432 } |
|
433 |
|
434 void CGenericItutUiLayout::ApplyVariantLafDataL(TBool aResolutionChange) |
|
435 { |
|
436 iWindowMgr->ApplyVariantLafDataL(aResolutionChange); |
|
437 } |
|
438 |
|
439 CGenericItutWindowManager* CGenericItutUiLayout::UiManager() |
|
440 { |
|
441 return iWindowMgr; |
|
442 } |
|
443 |
|
444 CFepUiBaseCtrl* CGenericItutUiLayout::Control(TInt aCtrlId) |
|
445 { |
|
446 return iWindowMgr->Control(aCtrlId); |
|
447 } |
|
448 |
|
449 CGenericItutUiMgrBase* CGenericItutUiLayout::ChineseUiManager() |
|
450 { |
|
451 if (!iChnUiMgr) |
|
452 { |
|
453 TRAP_IGNORE( iChnUiMgr = CChnItutUiMgr::NewL(this, iDataMgr, iWindowMgr) ); |
|
454 } |
|
455 |
|
456 return iChnUiMgr; |
|
457 |
|
458 } |
|
459 |
|
460 // End Of File |