|
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 <AknFepGlobalEnums.h> |
|
20 #include <peninputgeneralitutnew.rsg> |
|
21 #include <peninputselectionlist.h> |
|
22 #include <peninputlayoutmultilineicf.h> |
|
23 #include <e32keys.h> |
|
24 #include <peninputlayout.h> |
|
25 #include <peninputcommonbutton.h> |
|
26 #include <peninputrawkeybutton.h> |
|
27 |
|
28 #include "peninputitutwesternuistatenonpredict.h" |
|
29 #include "peninputgenericitutuimgrbase.h" |
|
30 #include "peninputgenericitutdatamgr.h" |
|
31 #include "peninputgenericitutlayoutcontext.h" |
|
32 #include "peninputgenericitutwindowmanager.h" |
|
33 |
|
34 CWesternItutUiStateNonPredict* CWesternItutUiStateNonPredict::NewL(CGenericItutUiMgrBase* aOwner) |
|
35 { |
|
36 CWesternItutUiStateNonPredict* self = new (ELeave) CWesternItutUiStateNonPredict(aOwner); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CWesternItutUiStateNonPredict::~CWesternItutUiStateNonPredict() |
|
44 { |
|
45 } |
|
46 |
|
47 CWesternItutUiStateNonPredict::CWesternItutUiStateNonPredict(CGenericItutUiMgrBase* aOwner) |
|
48 :CGenericItutUiStateBase(aOwner), |
|
49 iConsumeLastKeyDown(EFalse) |
|
50 { |
|
51 iIcf = static_cast<CFepLayoutMultiLineIcf*>(iOwner->LayoutContext()->Control(ECtrlIdICF)); |
|
52 } |
|
53 |
|
54 void CWesternItutUiStateNonPredict::OnEntryL() |
|
55 { |
|
56 TInt keypadResId = KInvalidResId; |
|
57 switch (iOwner->DataMgr()->InputMode()) |
|
58 { |
|
59 case ENumber: |
|
60 if( iOwner->DataMgr()->IsExistPlusChar() ) |
|
61 { |
|
62 keypadResId = R_FINGER_INPUT_KEYPAD_NUMBER_WITH_PLUS; |
|
63 } |
|
64 else |
|
65 { |
|
66 keypadResId = R_FINGER_INPUT_KEYPAD_NUMBER; |
|
67 } |
|
68 break; |
|
69 case ELatin: |
|
70 case EHangul: // tp teleca change |
|
71 keypadResId = iOwner->DataMgr()->KeypadResourceId(); |
|
72 break; |
|
73 default: |
|
74 break; |
|
75 } |
|
76 |
|
77 // update resource id of keypad, candidate drop list |
|
78 iOwner->DataMgr()->NotifyChangeControlLayout( |
|
79 MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId); |
|
80 |
|
81 // for secret editor, there is no need to show navigation buttons |
|
82 { |
|
83 if (iOwner->DataMgr()->IsChinese()) |
|
84 { |
|
85 iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(EFalse); |
|
86 iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(EFalse); |
|
87 iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(EFalse); |
|
88 iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(EFalse); |
|
89 |
|
90 iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight |
|
91 | EBtnArrowUp| EBtnArrowDown); |
|
92 if(iOwner->LayoutContext()->IsSecretEdtior()) |
|
93 { |
|
94 CAknFepCtrlRawKeyButton * leftbtn; |
|
95 CAknFepCtrlRawKeyButton * rightbtn; |
|
96 CAknFepCtrlRawKeyButton * upbtn; |
|
97 CAknFepCtrlRawKeyButton * downbtn; |
|
98 leftbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
99 (iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)); |
|
100 rightbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
101 (iOwner->LayoutContext()->Control(ECtrlIdArrowRight)); |
|
102 upbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
103 (iOwner->LayoutContext()->Control(ECtrlIdArrowUp)); |
|
104 downbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
105 (iOwner->LayoutContext()->Control(ECtrlIdArrowDown)); |
|
106 leftbtn->SetDimmed(ETrue); |
|
107 rightbtn->SetDimmed(ETrue); |
|
108 upbtn->SetDimmed(ETrue); |
|
109 downbtn->SetDimmed(ETrue); |
|
110 } |
|
111 } |
|
112 else |
|
113 { |
|
114 iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(EFalse); |
|
115 iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(EFalse); |
|
116 iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(EFalse); |
|
117 iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(EFalse); |
|
118 |
|
119 iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight); |
|
120 if(iOwner->LayoutContext()->IsSecretEdtior()) |
|
121 { |
|
122 CAknFepCtrlRawKeyButton * leftbtn; |
|
123 CAknFepCtrlRawKeyButton * rightbtn; |
|
124 leftbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
125 (iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)); |
|
126 rightbtn = static_cast<CAknFepCtrlRawKeyButton *> |
|
127 (iOwner->LayoutContext()->Control(ECtrlIdArrowRight)); |
|
128 leftbtn->SetDimmed(ETrue); |
|
129 rightbtn->SetDimmed(ETrue); |
|
130 } |
|
131 } |
|
132 } |
|
133 } |
|
134 |
|
135 void CWesternItutUiStateNonPredict::OnExit() |
|
136 { |
|
137 iOwner->LayoutContext()->ShowArrowBtn(0); |
|
138 } |
|
139 |
|
140 CGenericItutUiMgrBase::TUiState CWesternItutUiStateNonPredict::StateType() |
|
141 { |
|
142 return CGenericItutUiMgrBase::EStateWesternStandby; |
|
143 } |
|
144 |
|
145 TInt CWesternItutUiStateNonPredict::HandleCommandL(TInt aCmd, TUint8* /*aData*/) |
|
146 { |
|
147 switch (aCmd) |
|
148 { |
|
149 case ECmdPenInputIsSecretText: |
|
150 { |
|
151 //TUint* data = (TUint*) aData; |
|
152 { |
|
153 if (iOwner->DataMgr()->IsChinese()) |
|
154 { |
|
155 iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight |
|
156 | EBtnArrowUp| EBtnArrowDown); |
|
157 /*CAknFepCtrlRawKeyButton * leftbtn; |
|
158 CAknFepCtrlRawKeyButton * rightbtn; |
|
159 CAknFepCtrlRawKeyButton * upbtn; |
|
160 CAknFepCtrlRawKeyButton * downbtn; |
|
161 leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)); |
|
162 rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowRight)); |
|
163 upbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowUp)); |
|
164 downbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowDown)); |
|
165 if(*data > 0) |
|
166 { |
|
167 leftbtn->SetDimmed(ETrue); |
|
168 rightbtn->SetDimmed(ETrue); |
|
169 upbtn->SetDimmed(ETrue); |
|
170 downbtn->SetDimmed(ETrue); |
|
171 } |
|
172 else |
|
173 { |
|
174 leftbtn->SetDimmed(EFalse); |
|
175 rightbtn->SetDimmed(EFalse); |
|
176 upbtn->SetDimmed(EFalse); |
|
177 downbtn->SetDimmed(EFalse); |
|
178 }*/ |
|
179 } |
|
180 else |
|
181 { |
|
182 iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight); |
|
183 /*CAknFepCtrlRawKeyButton * leftbtn; |
|
184 CAknFepCtrlRawKeyButton * rightbtn; |
|
185 leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)); |
|
186 rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowRight)); |
|
187 if(*data > 0) |
|
188 { |
|
189 leftbtn->SetDimmed(ETrue); |
|
190 rightbtn->SetDimmed(ETrue); |
|
191 } |
|
192 else |
|
193 { |
|
194 leftbtn->SetDimmed(EFalse); |
|
195 rightbtn->SetDimmed(EFalse); |
|
196 }*/ |
|
197 } |
|
198 } |
|
199 |
|
200 return KErrNone; |
|
201 } |
|
202 default: |
|
203 break; |
|
204 } |
|
205 |
|
206 return KErrNotSupported; |
|
207 } |
|
208 |
|
209 TBool CWesternItutUiStateNonPredict::HandleCtrlEventL( |
|
210 TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData) |
|
211 { |
|
212 switch (aEventType) |
|
213 { |
|
214 case EEventRawKeyDownEvent: |
|
215 { |
|
216 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
217 |
|
218 iConsumeLastKeyDown = EFalse; |
|
219 if (key->iScanCode == EStdKeyNkpAsterisk && |
|
220 iIcf->InlineStateOn() && iIcf->NomatchState()) |
|
221 { |
|
222 iConsumeLastKeyDown = ETrue; |
|
223 iOwner->UiManager()->SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl); |
|
224 return ETrue; |
|
225 } |
|
226 |
|
227 return EFalse; |
|
228 } |
|
229 case EEventRawKeyUpEvent: |
|
230 { |
|
231 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
232 |
|
233 if (key->iScanCode == EStdKeyNkpAsterisk) |
|
234 { |
|
235 if (iConsumeLastKeyDown) |
|
236 { |
|
237 iOwner->LayoutContext()->UiLayout()->SignalOwner(ESignalEnterSpellMode); |
|
238 iOwner->UiManager()->SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl); |
|
239 return ETrue; |
|
240 } |
|
241 } |
|
242 |
|
243 return EFalse; |
|
244 } |
|
245 case EEventPointerDownOnNomatch: |
|
246 { |
|
247 iOwner->LayoutContext()->UiLayout()->SignalOwner(ESignalEnterSpellMode); |
|
248 return ETrue; |
|
249 } |
|
250 case EEventPointerDownOnInline: |
|
251 { |
|
252 iOwner->LayoutContext()->EnterMatchSelectionState(ETrue); |
|
253 return ETrue; |
|
254 } |
|
255 default: |
|
256 break; |
|
257 } |
|
258 |
|
259 return EFalse; |
|
260 } |
|
261 |
|
262 // End Of File |