44
|
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 |
#include <peninputlayoutbubblectrl.h>
|
|
34 |
|
|
35 |
CWesternItutUiStateNonPredict* CWesternItutUiStateNonPredict::NewL(CGenericItutUiMgrBase* aOwner)
|
|
36 |
{
|
|
37 |
CWesternItutUiStateNonPredict* self = new (ELeave) CWesternItutUiStateNonPredict(aOwner);
|
|
38 |
CleanupStack::PushL(self);
|
|
39 |
self->ConstructL();
|
|
40 |
CleanupStack::Pop(self);
|
|
41 |
return self;
|
|
42 |
}
|
|
43 |
|
|
44 |
CWesternItutUiStateNonPredict::~CWesternItutUiStateNonPredict()
|
|
45 |
{
|
|
46 |
}
|
|
47 |
|
|
48 |
CWesternItutUiStateNonPredict::CWesternItutUiStateNonPredict(CGenericItutUiMgrBase* aOwner)
|
|
49 |
:CGenericItutUiStateBase(aOwner),
|
|
50 |
iConsumeLastKeyDown(EFalse)
|
|
51 |
{
|
|
52 |
iIcf = static_cast<CFepLayoutMultiLineIcf*>(iOwner->LayoutContext()->Control(ECtrlIdICF));
|
|
53 |
}
|
|
54 |
|
|
55 |
void CWesternItutUiStateNonPredict::OnEntryL()
|
|
56 |
{
|
|
57 |
TInt keypadResId = KInvalidResId;
|
|
58 |
switch (iOwner->DataMgr()->InputMode())
|
|
59 |
{
|
|
60 |
case ENumber:
|
|
61 |
if( iOwner->DataMgr()->IsExistPlusChar() )
|
|
62 |
{
|
|
63 |
keypadResId = R_FINGER_INPUT_KEYPAD_NUMBER_WITH_PLUS;
|
|
64 |
}
|
|
65 |
else
|
|
66 |
{
|
|
67 |
keypadResId = R_FINGER_INPUT_KEYPAD_NUMBER;
|
|
68 |
}
|
|
69 |
break;
|
|
70 |
case ELatin:
|
|
71 |
case EHangul: // tp teleca change
|
|
72 |
keypadResId = iOwner->DataMgr()->KeypadResourceId();
|
|
73 |
break;
|
|
74 |
default:
|
|
75 |
break;
|
|
76 |
}
|
|
77 |
|
|
78 |
// update resource id of keypad, candidate drop list
|
|
79 |
iOwner->DataMgr()->NotifyChangeControlLayout(
|
|
80 |
MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId);
|
|
81 |
// Show ICF, Backspace after position changed to avoid flicker
|
|
82 |
iOwner->LayoutContext()->Control(ECtrlIdBackspace)->Hide(EFalse);
|
|
83 |
iOwner->LayoutContext()->Control(ECtrlIdICF)->Hide( EFalse );
|
|
84 |
// for secret editor, there is no need to show navigation buttons
|
|
85 |
{
|
|
86 |
if (iOwner->DataMgr()->IsChinese())
|
|
87 |
{
|
|
88 |
AdjustChineseLayout();
|
|
89 |
}
|
|
90 |
else if( iOwner->DataMgr()->IsKorean() )
|
|
91 |
{
|
|
92 |
AdjustKoreanLayout();
|
|
93 |
}
|
|
94 |
else
|
|
95 |
{
|
|
96 |
AdjustWesternLayout();
|
|
97 |
}
|
|
98 |
}
|
|
99 |
}
|
|
100 |
|
|
101 |
void CWesternItutUiStateNonPredict::OnExit()
|
|
102 |
{
|
|
103 |
// Hide ICF, Backspace, Arrow controls when exit to avoid flick
|
|
104 |
//iOwner->LayoutContext()->ShowArrowBtn(0);
|
|
105 |
//iOwner->LayoutContext()->Control(ECtrlIdICF)->Hide( ETrue );
|
|
106 |
//iOwner->LayoutContext()->Control(ECtrlIdBackspace)->Hide(ETrue);
|
|
107 |
}
|
|
108 |
|
|
109 |
CGenericItutUiMgrBase::TUiState CWesternItutUiStateNonPredict::StateType()
|
|
110 |
{
|
|
111 |
return CGenericItutUiMgrBase::EStateWesternStandby;
|
|
112 |
}
|
|
113 |
|
|
114 |
TInt CWesternItutUiStateNonPredict::HandleCommandL(TInt aCmd, TUint8* /*aData*/)
|
|
115 |
{
|
|
116 |
switch (aCmd)
|
|
117 |
{
|
|
118 |
case ECmdPenInputIsSecretText:
|
|
119 |
{
|
|
120 |
//TUint* data = (TUint*) aData;
|
|
121 |
{
|
|
122 |
if (iOwner->DataMgr()->IsChinese())
|
|
123 |
{
|
|
124 |
iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight
|
|
125 |
| EBtnArrowUp| EBtnArrowDown);
|
|
126 |
/*CAknFepCtrlRawKeyButton * leftbtn;
|
|
127 |
CAknFepCtrlRawKeyButton * rightbtn;
|
|
128 |
CAknFepCtrlRawKeyButton * upbtn;
|
|
129 |
CAknFepCtrlRawKeyButton * downbtn;
|
|
130 |
leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft));
|
|
131 |
rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowRight));
|
|
132 |
upbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowUp));
|
|
133 |
downbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowDown));
|
|
134 |
if(*data > 0)
|
|
135 |
{
|
|
136 |
leftbtn->SetDimmed(ETrue);
|
|
137 |
rightbtn->SetDimmed(ETrue);
|
|
138 |
upbtn->SetDimmed(ETrue);
|
|
139 |
downbtn->SetDimmed(ETrue);
|
|
140 |
}
|
|
141 |
else
|
|
142 |
{
|
|
143 |
leftbtn->SetDimmed(EFalse);
|
|
144 |
rightbtn->SetDimmed(EFalse);
|
|
145 |
upbtn->SetDimmed(EFalse);
|
|
146 |
downbtn->SetDimmed(EFalse);
|
|
147 |
}*/
|
|
148 |
}
|
|
149 |
else
|
|
150 |
{
|
|
151 |
iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight);
|
|
152 |
/*CAknFepCtrlRawKeyButton * leftbtn;
|
|
153 |
CAknFepCtrlRawKeyButton * rightbtn;
|
|
154 |
leftbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft));
|
|
155 |
rightbtn = static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowRight));
|
|
156 |
if(*data > 0)
|
|
157 |
{
|
|
158 |
leftbtn->SetDimmed(ETrue);
|
|
159 |
rightbtn->SetDimmed(ETrue);
|
|
160 |
}
|
|
161 |
else
|
|
162 |
{
|
|
163 |
leftbtn->SetDimmed(EFalse);
|
|
164 |
rightbtn->SetDimmed(EFalse);
|
|
165 |
}*/
|
|
166 |
}
|
|
167 |
}
|
|
168 |
|
|
169 |
return KErrNone;
|
|
170 |
}
|
|
171 |
default:
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
|
|
175 |
return KErrNotSupported;
|
|
176 |
}
|
|
177 |
|
|
178 |
TBool CWesternItutUiStateNonPredict::HandleCtrlEventL(
|
|
179 |
TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData)
|
|
180 |
{
|
|
181 |
switch (aEventType)
|
|
182 |
{
|
|
183 |
case EEventRawKeyDownEvent:
|
|
184 |
{
|
|
185 |
if ( iOwner->UiManager()->IsAllowHandleRawKeyEvent())
|
|
186 |
{
|
|
187 |
const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr());
|
|
188 |
|
|
189 |
iConsumeLastKeyDown = EFalse;
|
|
190 |
if (key->iScanCode == EStdKeyNkpAsterisk &&
|
|
191 |
iIcf->InlineStateOn() && iIcf->NomatchState())
|
|
192 |
{
|
|
193 |
iConsumeLastKeyDown = ETrue;
|
|
194 |
iOwner->UiManager()->SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl);
|
|
195 |
return ETrue;
|
|
196 |
}
|
|
197 |
}
|
|
198 |
|
|
199 |
return EFalse;
|
|
200 |
}
|
|
201 |
case EEventRawKeyUpEvent:
|
|
202 |
{
|
|
203 |
if ( iOwner->UiManager()->IsAllowHandleRawKeyEvent())
|
|
204 |
{
|
|
205 |
const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr());
|
|
206 |
|
|
207 |
if (key->iScanCode == EStdKeyNkpAsterisk)
|
|
208 |
{
|
|
209 |
if (iConsumeLastKeyDown)
|
|
210 |
{
|
|
211 |
|
|
212 |
iOwner->UiManager()->StartPreventSCTTimer();
|
|
213 |
|
|
214 |
iOwner->LayoutContext()->UiLayout()->SignalOwner(ESignalEnterSpellMode);
|
|
215 |
iOwner->UiManager()->SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl);
|
|
216 |
return ETrue;
|
|
217 |
}
|
|
218 |
}
|
|
219 |
}
|
|
220 |
|
|
221 |
return EFalse;
|
|
222 |
}
|
|
223 |
case EEventPointerDownOnNomatch:
|
|
224 |
{
|
|
225 |
iOwner->UiManager()->StartPreventSCTTimer();
|
|
226 |
iOwner->LayoutContext()->UiLayout()->SignalOwner(ESignalEnterSpellMode);
|
|
227 |
return ETrue;
|
|
228 |
}
|
|
229 |
case EEventPointerDownOnInline:
|
|
230 |
{
|
|
231 |
iOwner->LayoutContext()->EnterMatchSelectionState(ETrue);
|
|
232 |
return ETrue;
|
|
233 |
}
|
|
234 |
default:
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
|
|
238 |
return EFalse;
|
|
239 |
}
|
|
240 |
|
|
241 |
void CWesternItutUiStateNonPredict::AdjustKoreanLayout()
|
|
242 |
{
|
|
243 |
if(iOwner->LayoutContext()->Control(ECtrlIdIndicator))
|
|
244 |
{
|
|
245 |
iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(EFalse);
|
|
246 |
}
|
|
247 |
|
|
248 |
if( iOwner->LayoutContext()->Control(ECtrlIdSwitch) )
|
|
249 |
{
|
|
250 |
iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(EFalse);
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
void CWesternItutUiStateNonPredict::AdjustWesternLayout()
|
|
255 |
{
|
|
256 |
|
|
257 |
iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(EFalse);
|
|
258 |
iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(EFalse);
|
|
259 |
if ( iOwner->LayoutContext()->Control(ECtrlIdSwitch) != NULL )
|
|
260 |
{
|
|
261 |
iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(ETrue);
|
|
262 |
}
|
|
263 |
if ( iOwner->LayoutContext()->Control(ECtrlIdIndicator) != NULL )
|
|
264 |
{
|
|
265 |
iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(ETrue);
|
|
266 |
}
|
|
267 |
|
|
268 |
iIcf->MsgBubbleCtrl()->Hide( EFalse );
|
|
269 |
|
|
270 |
iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight);
|
|
271 |
if(iOwner->LayoutContext()->IsSecretEdtior())
|
|
272 |
{
|
|
273 |
CAknFepCtrlRawKeyButton * leftbtn;
|
|
274 |
CAknFepCtrlRawKeyButton * rightbtn;
|
|
275 |
leftbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
276 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft));
|
|
277 |
rightbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
278 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowRight));
|
|
279 |
leftbtn->SetDimmed(ETrue);
|
|
280 |
rightbtn->SetDimmed(ETrue);
|
|
281 |
}
|
|
282 |
}
|
|
283 |
|
|
284 |
void CWesternItutUiStateNonPredict::AdjustChineseLayout()
|
|
285 |
{
|
|
286 |
|
|
287 |
iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(EFalse);
|
|
288 |
iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(EFalse);
|
|
289 |
iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(EFalse);
|
|
290 |
iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(EFalse);
|
|
291 |
|
|
292 |
iOwner->LayoutContext()->ShowArrowBtn(EBtnArrowLeft | EBtnArrowRight
|
|
293 |
| EBtnArrowUp| EBtnArrowDown);
|
|
294 |
if(iOwner->LayoutContext()->IsSecretEdtior())
|
|
295 |
{
|
|
296 |
CAknFepCtrlRawKeyButton * leftbtn;
|
|
297 |
CAknFepCtrlRawKeyButton * rightbtn;
|
|
298 |
CAknFepCtrlRawKeyButton * upbtn;
|
|
299 |
CAknFepCtrlRawKeyButton * downbtn;
|
|
300 |
leftbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
301 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowLeft));
|
|
302 |
rightbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
303 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowRight));
|
|
304 |
upbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
305 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowUp));
|
|
306 |
downbtn = static_cast<CAknFepCtrlRawKeyButton *>
|
|
307 |
(iOwner->LayoutContext()->Control(ECtrlIdArrowDown));
|
|
308 |
leftbtn->SetDimmed(ETrue);
|
|
309 |
rightbtn->SetDimmed(ETrue);
|
|
310 |
upbtn->SetDimmed(ETrue);
|
|
311 |
downbtn->SetDimmed(ETrue);
|
|
312 |
}
|
|
313 |
}
|
|
314 |
// End Of File
|