|
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 qwerty layout |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <aknfeppeninputenums.h> // Command from fep or IME to plugin |
|
21 #include <AknFepGlobalEnums.h> // Define EPluginInputModeHwr |
|
22 #include <peninputcmd.h> // Use global signal |
|
23 #include <peninputlayoutchoicelist.h> |
|
24 #include <peninputlayoutbutton.h> |
|
25 #include <peninputdragbutton.h> |
|
26 #include <peninputcommonlayoutglobalenum.h> |
|
27 #include <coemain.h> |
|
28 #include <peninputlayoutbubblectrl.h> |
|
29 #include <peninputlayoutmultilineicf.h> |
|
30 #include <peninputscrollablelist.h> |
|
31 #include <S32MEM.H> |
|
32 |
|
33 #include <peninputrangebar.h> |
|
34 |
|
35 // User includes |
|
36 #include "peninputsplitqwerty.hrh" |
|
37 #include "peninputuistatemgrinterface.h" |
|
38 #include "peninputsplitqwertylayout.h" |
|
39 #include "peninputsplitqwertywindow.h" |
|
40 #include "peninputsplitqwertydatamgr.h" |
|
41 #include "peninputsplitqwertyuistatestandby.h" |
|
42 #include "peninputsplitqwertyuistatepopup.h" |
|
43 #include "peninputdataconverter.h" |
|
44 |
|
45 // ======== MEMBER FUNCTIONS ======== |
|
46 const TInt KNumberOfDottedChar = 16; |
|
47 |
|
48 const TUint16 thaiUnicodeOri[KNumberOfDottedChar] = |
|
49 { |
|
50 0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39, |
|
51 0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D |
|
52 }; |
|
53 |
|
54 const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = |
|
55 { |
|
56 0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, |
|
57 0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D |
|
58 }; |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Symbian constructor |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CPeninputSplitQwertyLayoutImp* CPeninputSplitQwertyLayoutImp::NewL( TAny* /*aInitParams*/ ) |
|
65 { |
|
66 CPeninputSplitQwertyLayoutImp* |
|
67 self = new ( ELeave ) CPeninputSplitQwertyLayoutImp(); |
|
68 |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // C++ destructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CPeninputSplitQwertyLayoutImp::~CPeninputSplitQwertyLayoutImp() |
|
80 { |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Create fep ui layout |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CFepUiLayout* CPeninputSplitQwertyLayoutImp::CreateFepUiLayoutL( |
|
88 MLayoutOwner* aLayoutOwner, |
|
89 const TAny* aData ) |
|
90 { |
|
91 CPeninputSplitQwertyLayout* |
|
92 uiLayout = CPeninputSplitQwertyLayout::NewL( aLayoutOwner, aData ); |
|
93 |
|
94 return uiLayout; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // C++ constructor |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 CPeninputSplitQwertyLayoutImp::CPeninputSplitQwertyLayoutImp() |
|
102 { |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // Symbian constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CPeninputSplitQwertyLayoutImp::ConstructL() |
|
110 { |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Symbian constructor |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CPeninputSplitQwertyLayout* CPeninputSplitQwertyLayout::NewL( |
|
119 MLayoutOwner* aLayoutOwner, const TAny* aInitData ) |
|
120 { |
|
121 CPeninputSplitQwertyLayout* self = |
|
122 new (ELeave) CPeninputSplitQwertyLayout( aLayoutOwner ); |
|
123 |
|
124 CleanupStack::PushL( self ); |
|
125 self->ConstructL( aInitData ); |
|
126 CleanupStack::Pop( self ); |
|
127 |
|
128 return self; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // C++ destructor |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 CPeninputSplitQwertyLayout::~CPeninputSplitQwertyLayout() |
|
136 { |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Handle layout command event |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 TInt CPeninputSplitQwertyLayout::HandleCommand( TInt aCmd, TUint8* aData ) |
|
144 { |
|
145 CPeninputCommonLayoutExt::HandleCommand( aCmd, aData ); |
|
146 CPeninputSplitQwertyWindow* |
|
147 vkbWindow = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow); |
|
148 |
|
149 switch ( aCmd ) |
|
150 { |
|
151 case ECmdPenInputWindowOpen: |
|
152 { |
|
153 UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
154 } |
|
155 break; |
|
156 case ECmdPenInputWindowClose: |
|
157 { |
|
158 vkbWindow->UnLatchDeadKey(); |
|
159 UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateNone ); |
|
160 } |
|
161 break; |
|
162 case ECmdPenInputLanguage: |
|
163 { |
|
164 vkbWindow->SetSwitchlistLanguage( *aData ); |
|
165 vkbWindow->SetDeadKey(); |
|
166 TRAP_IGNORE( |
|
167 vkbWindow->ConstructAccentListL( *aData ); |
|
168 vkbWindow->ConstructRangeLabelListL( *aData ) |
|
169 ); |
|
170 } |
|
171 break; |
|
172 case ECmdPenInputRange: |
|
173 { |
|
174 TRAP_IGNORE( vkbWindow->UpdateRangeCtrlsL() ); |
|
175 } |
|
176 break; |
|
177 case ECmdPenInputIsSecretText: |
|
178 { |
|
179 vkbWindow->SetSwitchlistSecretFlag( *aData ); |
|
180 } |
|
181 break; |
|
182 case ECmdPenInputDimArrowKeys: |
|
183 { |
|
184 TBool IsDimArrowKeys = *aData; |
|
185 vkbWindow->DimArrowKeys( IsDimArrowKeys ); |
|
186 } |
|
187 break; |
|
188 case ECmdPenInputSetPromptText: |
|
189 break; |
|
190 case ECmdPenInputCharacterPreview: |
|
191 { |
|
192 vkbWindow->ShowBubble( *aData ); |
|
193 } |
|
194 break; |
|
195 case ECmdPenInputInEditWordQueryDlg: |
|
196 { |
|
197 iInEditWordQueryDlg = *aData; |
|
198 } |
|
199 break; |
|
200 case ECmdPeninputITIStatus: |
|
201 { |
|
202 // Set the flag to indicate if FSQ with ITI feature is opened |
|
203 iITIEnabled = CPeninputDataConverter::AnyToInt( aData ); |
|
204 } |
|
205 break; |
|
206 default: |
|
207 { |
|
208 } |
|
209 break; |
|
210 } |
|
211 |
|
212 return KErrNone; |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // Handle control event |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CPeninputSplitQwertyLayout::HandleControlEvent( TInt aEventType, |
|
220 CFepUiBaseCtrl* aCtrl, |
|
221 const TDesC& aEventData ) |
|
222 { |
|
223 switch ( aEventType ) |
|
224 { |
|
225 case EEventVirtualKeyUp: |
|
226 { |
|
227 TRAP_IGNORE( HandleVirtualKeyUpL( aEventType, aCtrl, aEventData ) ); |
|
228 } |
|
229 break; |
|
230 default: |
|
231 { |
|
232 CPeninputCommonLayoutExt::HandleControlEvent( aEventType, |
|
233 aCtrl, aEventData ); |
|
234 } |
|
235 break; |
|
236 } |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // Handle editor text coming |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 TInt CPeninputSplitQwertyLayout::OnAppEditorTextComing( |
|
244 const TFepInputContextFieldData& aData ) |
|
245 { |
|
246 CPeninputSplitQwertyWindow* |
|
247 win = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow); |
|
248 |
|
249 //Suppress ICF related actions |
|
250 if ( win ) |
|
251 { |
|
252 return KErrNone; |
|
253 } |
|
254 |
|
255 return CPeninputCommonLayoutExt::OnAppEditorTextComing( aData ); |
|
256 } |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // Inform layout the size changing event |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 TInt CPeninputSplitQwertyLayout::SizeChanged( const TAny* aData ) |
|
263 { |
|
264 CPeninputSplitQwertyWindow* |
|
265 win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow ); |
|
266 |
|
267 if ( win ) |
|
268 { |
|
269 //todo split-view FSQ, UpdateLafData() can be removed for optimization? |
|
270 win->UpdateLafData(); |
|
271 |
|
272 //todo split-view FSQ, temp codes, when to set layout pos? |
|
273 win->UpdateLayoutPosAndSize(); |
|
274 } |
|
275 |
|
276 return CPeninputCommonLayoutExt::SizeChanged( aData ); |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // Inform UI that application infomation changed |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 void CPeninputSplitQwertyLayout::HandleAppInfoChange( const TDesC& /*aInfo*/, |
|
284 TPeninputAppInfo /*aType*/ ) |
|
285 { |
|
286 //Suppress ICF related actions |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // Called by owner when the layout is going to be active |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CPeninputSplitQwertyLayout::OnActivate() |
|
294 { |
|
295 CPeninputCommonLayoutExt::OnActivate(); |
|
296 |
|
297 CPeninputSplitQwertyWindow* |
|
298 win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow ); |
|
299 |
|
300 if( win ) |
|
301 { |
|
302 //todo split-view FSQ, temp codes, when to set layout pos? |
|
303 win->UpdateLayoutPosAndSize(); |
|
304 } |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // Tell whether this layout require transparency. |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 TBool CPeninputSplitQwertyLayout::SemiTransparencyRequired() |
|
312 { |
|
313 return ETrue; |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // C++ constructor |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 CPeninputSplitQwertyLayout::CPeninputSplitQwertyLayout( MLayoutOwner* aLayoutOwner ) |
|
321 : CPeninputCommonLayoutExt( aLayoutOwner ) |
|
322 , iLayoutType( EPluginInputModeFSQ ) |
|
323 { |
|
324 iInEditWordQueryDlg = EFalse; |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // Symbian constructor |
|
329 // --------------------------------------------------------------------------- |
|
330 // |
|
331 void CPeninputSplitQwertyLayout::ConstructL( const TAny* aInitData ) |
|
332 { |
|
333 // must set layout type first |
|
334 iLayoutType = EPluginInputModeFSQ; |
|
335 |
|
336 CPeninputCommonLayoutExt::ConstructL( aInitData ); |
|
337 |
|
338 CPeninputUiStateBase* state = NULL; |
|
339 CPeninputUiStateBase* initialState = NULL; |
|
340 |
|
341 //init state |
|
342 state = CPeninputUiStateBase::NewL( UiStateMgr(), this ); |
|
343 UiStateMgr()->AddUiState( state, EPeninputVkbUiStateNone ); |
|
344 initialState = state; |
|
345 |
|
346 //standby state |
|
347 state= CPeninputSplitQwertyUiStateStandby::NewL( UiStateMgr(), this ); |
|
348 UiStateMgr()->AddUiState( state, EPeninputVkbUiStateStandby ); |
|
349 |
|
350 //popup state |
|
351 state = CPeninputSplitQwertyUiStatePopup::NewL( UiStateMgr(), this ); |
|
352 UiStateMgr()->AddUiState( state, EPeninputVkbUiStatePopup ); |
|
353 |
|
354 UiStateMgr()->SetCurrentUiState( initialState ); |
|
355 } |
|
356 |
|
357 // --------------------------------------------------------------------------- |
|
358 // Factory method for creation of layout window |
|
359 // --------------------------------------------------------------------------- |
|
360 // |
|
361 void CPeninputSplitQwertyLayout::CreateLayoutWindowL() |
|
362 { |
|
363 iLayoutWindow = CPeninputSplitQwertyWindow::NewL( this, this, UiStateMgr() ); |
|
364 } |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // Factory method for creation resource config |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 void CPeninputSplitQwertyLayout::CreateDataMgrL( const TAny* /*aInitData*/ ) |
|
371 { |
|
372 iDataMgr = CPeninputSplitQwertyDataMgr::NewL( this ); |
|
373 } |
|
374 |
|
375 // --------------------------------------------------------------------------- |
|
376 // Get the layout type |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 TInt CPeninputSplitQwertyLayout::LayoutType() |
|
380 { |
|
381 return iLayoutType; |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------------------------- |
|
385 // Handle virtual key event |
|
386 // --------------------------------------------------------------------------- |
|
387 // |
|
388 void CPeninputSplitQwertyLayout::HandleVirtualKeyUpL( TInt aEventType, |
|
389 CFepUiBaseCtrl* aCtrl, |
|
390 const TDesC& aEventData ) |
|
391 { |
|
392 CPeninputSplitQwertyWindow* |
|
393 win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow ); |
|
394 |
|
395 TBool flag = win->HandleVirtualKeyUpEvent( aEventType, aCtrl, aEventData ); |
|
396 if( !flag ) |
|
397 { |
|
398 HBufC* number = HBufC::NewL( 1 ); |
|
399 TPtrC eventDataPtr = aEventData; |
|
400 TInt len = aEventData.Length(); |
|
401 if ( len > 1 ) |
|
402 { |
|
403 TVirtualKeyEventData* data = (TVirtualKeyEventData*) aEventData.Ptr(); |
|
404 TUint16 inputCode = data->iKeyEvent.iCode; |
|
405 TUint16 outputCode = inputCode; |
|
406 TBool isDottedChar = EFalse; |
|
407 for ( TInt i = 0; i < KNumberOfDottedChar; i++ ) |
|
408 { |
|
409 if ( thaiUnicodeNew[i] == inputCode ) |
|
410 { |
|
411 outputCode = thaiUnicodeOri[i]; |
|
412 isDottedChar = ETrue; |
|
413 break; |
|
414 } |
|
415 } |
|
416 if ( isDottedChar ) |
|
417 { |
|
418 number->Des().Append( outputCode ); |
|
419 data->iKeyData.Set( *number ); |
|
420 eventDataPtr.Set( reinterpret_cast<TUint16*>(data), |
|
421 sizeof(*data)/sizeof(TUint16) ); |
|
422 } |
|
423 } |
|
424 |
|
425 CPeninputCommonLayoutExt::HandleControlEvent( aEventType, aCtrl, |
|
426 eventDataPtr ); |
|
427 delete number; |
|
428 } |
|
429 } |
|
430 |
|
431 // End Of File |