|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Implementation for chinese peninput full screen hwr |
|
15 * |
|
16 */ |
|
17 |
|
18 //SYSTEM INCLUDES |
|
19 #include <bautils.h> |
|
20 #include <coemain.h> |
|
21 |
|
22 //FEP Includes |
|
23 #include <AknFepGlobalEnums.h> |
|
24 #include <aknfeppeninputenums.h> |
|
25 #include <peninputlayoutchoicelist.h> |
|
26 |
|
27 //USER INCLUDES |
|
28 #include "peninputhwrfscncandidatepanel.h" |
|
29 #include "peninputhwrfscncontrolbar.h" |
|
30 #include "peninputhwrfscndatastore.h" |
|
31 #include "peninputhwrfscnstatemanager.h" |
|
32 #include "peninputhwrfscnwritingbox.h" |
|
33 #include "peninputhwrfscnevent.h" |
|
34 #include "peninputhwrfscnlayout.h" |
|
35 |
|
36 //CONST DEFINATION |
|
37 _LIT( KFSHWRRssFile, "\\resource\\peninputhwrfscreencn.rsc" ); |
|
38 const TUint8 KTempBufSize = 8; |
|
39 const TUint8 KIntLen = sizeof( TInt )/2; |
|
40 const TUint8 KIntSize = sizeof( TInt ); |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CPeninputHwrfscnLayout::NewL() |
|
46 // . |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CPeninputHwrfscnLayout* CPeninputHwrfscnLayout::NewL( |
|
50 MLayoutOwner* aLayoutOwner, const TAny* aInitData ) |
|
51 { |
|
52 CPeninputHwrfscnLayout* self = new( ELeave ) |
|
53 CPeninputHwrfscnLayout( aLayoutOwner ); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL( aInitData ); |
|
56 CleanupStack::Pop(); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CPeninputHwrfscnLayout::CPeninputHwrfscnLayout() |
|
62 // . |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CPeninputHwrfscnLayout::CPeninputHwrfscnLayout( MLayoutOwner* aLayoutOwner ) |
|
66 :CPenInputFullScreenLayoutBase( aLayoutOwner ) |
|
67 { |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CPeninputHwrfscnLayout::~CPeninputHwrfscnLayout() |
|
72 // . |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CPeninputHwrfscnLayout::~CPeninputHwrfscnLayout() |
|
76 { |
|
77 CCoeEnv::Static()->DeleteResourceFile( iResId ); |
|
78 |
|
79 delete iDataStore; |
|
80 delete iStateMgr; |
|
81 delete iFsHwrBox; |
|
82 delete iCandidatePanel; |
|
83 delete iControlBar; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CPeninputHwrfscnLayout::ConstructL() |
|
88 // . |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CPeninputHwrfscnLayout::ConstructL( const TAny* aInitData ) |
|
92 { |
|
93 BaseConstructL(); |
|
94 //load resource |
|
95 TFileName resFileName( KFSHWRRssFile ); |
|
96 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
97 BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resFileName ); |
|
98 iResId = coeEnv->AddResourceFileL( resFileName ); |
|
99 |
|
100 //initialze the data store |
|
101 TPeninputLayoutData* layoutData = (TPeninputLayoutData*)aInitData; |
|
102 |
|
103 iDataStore = CPeninputHwrfscnDataStore::NewL( (*layoutData).iPtiEngine); |
|
104 |
|
105 //create state manager |
|
106 CreateStateManagerL(); |
|
107 |
|
108 //create the transparent window |
|
109 CreateHwrWindowL(); |
|
110 |
|
111 //create the candidate panel |
|
112 CreateCandidatePanelL(); |
|
113 |
|
114 //create the control panel |
|
115 CreateControlBarL(); |
|
116 |
|
117 //set screen layout extent |
|
118 SetRect( TRect( TPoint( 0, 0 ), ScreenSize() ) ); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CPeninputHwrfscnLayout::OnDeActivate() |
|
123 // . |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 void CPeninputHwrfscnLayout::OnDeActivate() |
|
127 { |
|
128 //CFepUiLayout::OnDeActivate(); |
|
129 CPenInputFullScreenLayoutBase::OnDeActivate(); |
|
130 iFsHwrBox->CancelCharWriting(); |
|
131 TRAP_IGNORE( NotifyOutsideEventL( ECandidatePanel | ECtrlBar ) ); |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CPeninputHwrfscnLayout::CreateControlBarL() |
|
136 // . |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CPeninputHwrfscnLayout::CreateControlBarL() |
|
140 { |
|
141 iControlBar = CPeninputHwrfscnControlBar::NewL( this ); |
|
142 iControlBar->AddEventObserver( this ); |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CPeninputHwrfscnLayout::CreateCandidatePanelL() |
|
147 // . |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CPeninputHwrfscnLayout::CreateCandidatePanelL() |
|
151 { |
|
152 iCandidatePanel = CPeninputHwrfscnCandidatePanel::NewL( this ); |
|
153 iCandidatePanel->AddEventObserver( this ); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CPeninputHwrfscnLayout::CreateHwrWindowL() |
|
158 // . |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CPeninputHwrfscnLayout::CreateHwrWindowL() |
|
162 { |
|
163 iFsHwrBox = CPeninputHwrfscnWritingBox::NewL( this ); |
|
164 iFsHwrBox->AddEventObserver( this ); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CPeninputHwrfscnLayout::CreateStateManagerL() |
|
169 // . |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 void CPeninputHwrfscnLayout::CreateStateManagerL() |
|
173 { |
|
174 iStateMgr = CPeninputHwrfscnStateManager::NewL( this ); |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CPeninputHwrfscnLayout::HandleCommand() |
|
179 // handle the command from Fep |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 TInt CPeninputHwrfscnLayout::HandleCommand( TInt aCmd, TUint8* aData ) |
|
183 { |
|
184 if( CFepUiLayout::HandleCommand( aCmd, aData ) == KErrNone ) |
|
185 { |
|
186 return KErrNone; |
|
187 } |
|
188 |
|
189 TInt ret = KErrUnknown; |
|
190 switch( aCmd ) |
|
191 { |
|
192 case ECmdPenInputEditorNumericKeyMap: |
|
193 { |
|
194 iDataStore->SetNumberMode( *( TAknEditorNumericKeymap* )aData ); |
|
195 |
|
196 ret = KErrNone; |
|
197 } |
|
198 break; |
|
199 |
|
200 case ECmdPenInputPermittedRange: |
|
201 { |
|
202 TInt ranges = *( TInt* )aData; |
|
203 iDataStore->SetPermittedRanges( ranges ); |
|
204 |
|
205 ret = KErrNone; |
|
206 } |
|
207 break; |
|
208 |
|
209 case ECmdPenInputLanguage: |
|
210 { |
|
211 TInt language = *( TInt* )aData; |
|
212 TRAP_IGNORE( iDataStore->SetLanguageL( language ) ); |
|
213 |
|
214 ret = KErrNone; |
|
215 } |
|
216 break; |
|
217 |
|
218 case ECmdPenInputRange: |
|
219 { |
|
220 TInt range = *( TInt* )aData; |
|
221 iDataStore->SetPrimaryRange( range ); |
|
222 |
|
223 TBuf<KIntLen> buf; |
|
224 buf.Append( reinterpret_cast<TText*>( aData ), KIntLen ); |
|
225 |
|
226 SignalOwner( ESignalRange, buf ); |
|
227 |
|
228 ret = KErrNone; |
|
229 } |
|
230 break; |
|
231 |
|
232 case ECmdPenInputPermittedCase: |
|
233 { |
|
234 TInt cs = *( TInt* )aData; |
|
235 iDataStore->SetPermittedCases( cs ); |
|
236 |
|
237 ret = KErrNone; |
|
238 } |
|
239 break; |
|
240 |
|
241 case ECmdPenInputCase: |
|
242 { |
|
243 TInt cs = *( TInt* )aData; |
|
244 iDataStore->SetCase( cs ); |
|
245 |
|
246 ret = KErrNone; |
|
247 } |
|
248 break; |
|
249 |
|
250 case ECmdPenInputEditorCustomNumericKeyMap: |
|
251 { |
|
252 TInt len = *( TInt* )( aData - KIntSize ); |
|
253 TPtrC16 keymapRes( ( TUint16* )aData, len / 2 ); |
|
254 TRAP_IGNORE( iDataStore->SetNumberModeL( keymapRes ) ); |
|
255 |
|
256 ret = KErrNone; |
|
257 } |
|
258 break; |
|
259 |
|
260 case ECmdPenInputWindowOpen: |
|
261 { |
|
262 LayoutOwner()->Hide( EFalse ); |
|
263 TRAP_IGNORE( NotifyOutsideEventL( ECandidatePanel | ECtrlBar ) ); |
|
264 RootControl()->UpdateValidRegion(NULL, EFalse); |
|
265 TPixelsTwipsAndRotation size; |
|
266 CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size); |
|
267 TSize wndSize(size.iPixelSize.iWidth,size.iPixelSize.iHeight); |
|
268 iDataStore->SetInputAreaSize(wndSize); |
|
269 iDataStore->SetScreenSize(wndSize); |
|
270 ret = KErrNone; |
|
271 } |
|
272 break; |
|
273 |
|
274 case ECmdPenInputWindowClose: |
|
275 { |
|
276 // clear stroke on the screen when close FS-HWR before writing time out |
|
277 //iFsHwrBox->CancelCharWriting(); |
|
278 TRAP_IGNORE( NotifyOutsideEventL( ECandidatePanel | ECtrlBar ) ); |
|
279 LayoutOwner()->Hide( ETrue ); |
|
280 |
|
281 ret = KErrNone; |
|
282 } |
|
283 break; |
|
284 |
|
285 case ECmdPenInputEnableSettingBtn: |
|
286 { |
|
287 iControlBar->SetEnableSettingBtn(*aData); |
|
288 ret = KErrNone; |
|
289 } |
|
290 break; |
|
291 |
|
292 default: |
|
293 break; |
|
294 } |
|
295 |
|
296 return ret; |
|
297 } |
|
298 |
|
299 // ----------------------------------------------------------------------------- |
|
300 // CPeninputHwrfscnLayout::SizeChanged() |
|
301 // |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 TInt CPeninputHwrfscnLayout::SizeChanged( const TAny* /*pData*/ ) |
|
305 { |
|
306 //Handle size change event |
|
307 |
|
308 // To clear the stroke on the screen when rotate device |
|
309 //iFsHwrBox->CancelCharWriting(); |
|
310 SetRect( TRect( TPoint( 0, 0 ), ScreenSize() ) ); |
|
311 iFsHwrBox->SizeChanged(); |
|
312 iCandidatePanel->SizeChanged(); |
|
313 iControlBar->SizeChanged(); |
|
314 return KErrNone; |
|
315 } |
|
316 |
|
317 // ----------------------------------------------------------------------------- |
|
318 // CPeninputHwrfscnLayout::HandleControlEvent() |
|
319 // . |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void CPeninputHwrfscnLayout::HandleControlEvent( TInt aEventType, |
|
323 CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
324 { |
|
325 switch( aEventType ) |
|
326 { |
|
327 case EHwrEventKeyBack: |
|
328 case EHwrEventBtnMoreFunction: |
|
329 case EHwrEventSetRangeChinese: |
|
330 case EHwrEventSetRangeEnglish: |
|
331 case EHwrEventSetRangeNumber: |
|
332 case EHwrEventRangeClick: |
|
333 case EEventButtonDown: |
|
334 case EHwrEventClose: |
|
335 case EHwrEventTouchInputOption: |
|
336 case EEventChoiceSelected: |
|
337 { |
|
338 TRAP_IGNORE( HandleControlBarEventL( aEventType, aCtrl, aEventData ) ); |
|
339 } |
|
340 break; |
|
341 |
|
342 case EHwrEventKeySpace: |
|
343 case EHwrEventKeyEnter: |
|
344 // case EHwrEventInputLangSwitch: |
|
345 case EHwrEventVkbSwitch: |
|
346 case EEventVirtualKeyUp: |
|
347 { |
|
348 TRAP_IGNORE( HandleFunctionListEventL( aEventType, aCtrl, aEventData ) ); |
|
349 } |
|
350 break; |
|
351 |
|
352 case EHwrEventBeginWriting: |
|
353 case EHwrEventEndStroke: |
|
354 case EHwrEventEndWriting: |
|
355 case EHwrEventCandidateSelected: |
|
356 case EHwrEventPredictiveSelected: |
|
357 { |
|
358 TRAP_IGNORE( HandleHwrWndEventL( aEventType, aEventData ) ); |
|
359 } |
|
360 break; |
|
361 |
|
362 case EHwrEventGetNextCandidatePage: |
|
363 { |
|
364 TRAP_IGNORE( HandleCandidateWndEventL( aEventType, aEventData ) ); |
|
365 } |
|
366 break; |
|
367 |
|
368 default: |
|
369 break; |
|
370 } |
|
371 } |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // CPeninputHwrfscnLayout::HandleRawKeyEventL() |
|
375 // . |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 TBool CPeninputHwrfscnLayout::HandleRawKeyEventL( const TRawEvent& /*aKeyEvent*/ ) |
|
379 { |
|
380 NotifyOutsideEventL( ECandidatePanel | ECtrlBar ); |
|
381 return EFalse; |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // CPeninputHwrfscnLayout::HandleControlBarEventL() |
|
386 // . |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CPeninputHwrfscnLayout::HandleControlBarEventL( TInt aEventType, |
|
390 CFepUiBaseCtrl* /*aCtrl*/, |
|
391 const TDesC& aEventData ) |
|
392 { |
|
393 switch( aEventType ) |
|
394 { |
|
395 case EHwrEventKeyBack: |
|
396 { |
|
397 if ( !StrokeFilter() ) |
|
398 { |
|
399 iFsHwrBox->CancelCharWriting(); |
|
400 } |
|
401 else |
|
402 { |
|
403 TBuf<1> bufBck; |
|
404 bufBck.Append( EKeyBackspace ); |
|
405 SubmitStringToFep( bufBck ); |
|
406 } |
|
407 NotifyOutsideEventL( ECandidatePanel ); |
|
408 } |
|
409 break; |
|
410 |
|
411 case EHwrEventSetRangeChinese: |
|
412 { |
|
413 iDataStore->SetPrimaryRange( ERangeNative ); |
|
414 iDataStore->SaveRange( ERangeNative ); |
|
415 NotifyPrimaryRangeChanged( ERangeNative ); |
|
416 iControlBar->Draw(); |
|
417 } |
|
418 break; |
|
419 |
|
420 case EHwrEventSetRangeEnglish: |
|
421 { |
|
422 iDataStore->SetPrimaryRange( ERangeEnglish ); |
|
423 iDataStore->SaveRange( ERangeEnglish ); |
|
424 NotifyPrimaryRangeChanged( ERangeEnglish ); |
|
425 iControlBar->Draw(); |
|
426 } |
|
427 break; |
|
428 |
|
429 case EHwrEventSetRangeNumber: |
|
430 { |
|
431 iDataStore->SetPrimaryRange( ERangeNumber ); |
|
432 iDataStore->SaveRange( ERangeNumber ); |
|
433 NotifyPrimaryRangeChanged( ERangeNumber ); |
|
434 iControlBar->Draw(); |
|
435 } |
|
436 break; |
|
437 |
|
438 case EHwrEventRangeClick: |
|
439 case EHwrEventBtnMoreFunction: |
|
440 { |
|
441 iFsHwrBox->CancelCharWriting(); |
|
442 NotifyOutsideEventL( ECandidatePanel ); |
|
443 } |
|
444 break; |
|
445 |
|
446 case EHwrEventTouchInputOption: |
|
447 { |
|
448 SignalOwner( ESignalLaunchOptionMenu ); |
|
449 } |
|
450 break; |
|
451 |
|
452 case EEventChoiceSelected: |
|
453 { |
|
454 CFepLayoutChoiceList::SEvent* event = |
|
455 ( CFepLayoutChoiceList::SEvent* )aEventData.Ptr(); |
|
456 if ( event->iIndex == -1 ) |
|
457 { |
|
458 return; |
|
459 } |
|
460 |
|
461 TBool switchByMode = ETrue; |
|
462 TInt mode = event->iCommand; |
|
463 |
|
464 TBuf<KTempBufSize> buf; |
|
465 buf.Append( reinterpret_cast<TText*>( &switchByMode ), |
|
466 sizeof( TBool )/sizeof( TText ) ); |
|
467 buf.Append( reinterpret_cast<TText*>( &mode ), |
|
468 sizeof( TInt )/sizeof( TText ) ); |
|
469 SignalOwner( ESignalLayoutUIChanged, buf ); |
|
470 } |
|
471 break; |
|
472 |
|
473 case EHwrEventClose: |
|
474 { |
|
475 SignalOwner(ESignalLayoutClosed); |
|
476 } |
|
477 break; |
|
478 |
|
479 default: |
|
480 break; |
|
481 } |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CPeninputHwrfscnLayout::HandleFunctionListEventL() |
|
486 // . |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 void CPeninputHwrfscnLayout::HandleFunctionListEventL( TInt aEventType, |
|
490 CFepUiBaseCtrl* /*aCtrl*/, |
|
491 const TDesC& aEventData ) |
|
492 { |
|
493 switch( aEventType ) |
|
494 { |
|
495 case EHwrEventKeyEnter: |
|
496 { |
|
497 TBuf<1> bufEnter; |
|
498 bufEnter.Append( EKeyEnter ); |
|
499 SubmitStringToFep( bufEnter ); |
|
500 } |
|
501 break; |
|
502 |
|
503 case EHwrEventKeySpace: |
|
504 { |
|
505 if ( !iDataStore->IsNumberOnly() ) |
|
506 { |
|
507 TBuf<1> bufSpace; |
|
508 bufSpace.Append( EKeySpace ); |
|
509 SubmitStringToFep( bufSpace ); |
|
510 } |
|
511 } |
|
512 break; |
|
513 |
|
514 case EEventVirtualKeyUp: |
|
515 { |
|
516 TBuf<KTempBufSize> buf; |
|
517 TVirtualKeyEventData* event = ( TVirtualKeyEventData* ) aEventData.Ptr(); |
|
518 buf.Append( event->iKeyData ); |
|
519 //the special char: smilefont char and cryfont char |
|
520 if( iDataStore->IsSpecialDisplayChars( buf ) ) |
|
521 { |
|
522 HBufC* convertedBuf = iDataStore->ConvertDisplayChars( buf ); |
|
523 buf = *convertedBuf; |
|
524 delete convertedBuf; |
|
525 } |
|
526 SubmitStringToFep( buf ); |
|
527 } |
|
528 break; |
|
529 } |
|
530 |
|
531 } |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // CPeninputHwrfscnLayout::HandleHwrWndEventL() |
|
535 // . |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 void CPeninputHwrfscnLayout::HandleHwrWndEventL( TInt aEventType, |
|
539 const TDesC& aEventData ) |
|
540 { |
|
541 if( aEventType == EHwrEventBeginWriting ) |
|
542 { |
|
543 NotifyOutsideEventL( ECandidatePanel | ECtrlBar ); |
|
544 } |
|
545 |
|
546 iStateMgr->HandleEventL( aEventType, aEventData ); |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // CPeninputHwrfscnLayout::HandleCandidateWndEventL() |
|
551 // . |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CPeninputHwrfscnLayout::HandleCandidateWndEventL( TInt /*aEventType*/, |
|
555 const TDesC& /*aEventData*/ ) |
|
556 { |
|
557 iDataStore->GetNextPredictivePageL(); |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CPeninputHwrfscnLayout::DataStore() |
|
562 // . |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 CPeninputHwrfscnDataStore& CPeninputHwrfscnLayout::DataStore() |
|
566 { |
|
567 return *iDataStore; |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // CPeninputHwrfscnLayout::OnAppEditorTextComing() |
|
572 // . |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 TInt CPeninputHwrfscnLayout::OnAppEditorTextComing( |
|
576 const TFepInputContextFieldData& aData ) |
|
577 { |
|
578 iCandidatePanel->HandleCommand( EHwrEventCursorPosChanged, |
|
579 ( TUint8* )&aData.iRect ); |
|
580 return KErrNone; |
|
581 } |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // CPeninputHwrfscnLayout::PreHandleEvent() |
|
585 // . |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 void CPeninputHwrfscnLayout::PreHandleEvent( TEventType /*aType*/, |
|
589 const TRawEvent& /*aEvent*/ ) |
|
590 { |
|
591 |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CPeninputHwrfscnLayout::BeforeSendingEventsToBackground() |
|
596 // . |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 void CPeninputHwrfscnLayout::BeforeSendingEventsToBackground() |
|
600 { |
|
601 TRAP_IGNORE( NotifyOutsideEventL( ECandidatePanel | ECtrlBar ) ); |
|
602 } |
|
603 |
|
604 // ----------------------------------------------------------------------------- |
|
605 // CPeninputHwrfscnLayout::PenInputUiType() |
|
606 // . |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 TInt CPeninputHwrfscnLayout::PenInputType() |
|
610 { |
|
611 return EPluginInputModeFSc; |
|
612 } |
|
613 |
|
614 // ----------------------------------------------------------------------------- |
|
615 // CPeninputHwrfscnLayout::NotifyOutsideEventL() |
|
616 // . |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 void CPeninputHwrfscnLayout::NotifyOutsideEventL( TInt aPanel ) |
|
620 { |
|
621 if( aPanel & ECandidatePanel && aPanel & ECtrlBar ) |
|
622 { |
|
623 iCandidatePanel->HandleCommand( EHwrEventPointerOutsideWnd, NULL ); |
|
624 iControlBar->HandleCommand( EHwrEventPointerOutsideWnd, NULL ); |
|
625 iStateMgr->HandleEventL( EHwrEventPointerOutsideWnd, KNullDesC ); |
|
626 } |
|
627 else if( aPanel & ECandidatePanel ) |
|
628 { |
|
629 iCandidatePanel->HandleCommand( EHwrEventPointerOutsideWnd, NULL ); |
|
630 iStateMgr->HandleEventL( EHwrEventPointerOutsideWnd, KNullDesC ); |
|
631 } |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // CPeninputHwrfscnLayout::NotifyPrimaryRangeChanged() |
|
636 // . |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 void CPeninputHwrfscnLayout::NotifyPrimaryRangeChanged( TInt aPrimaryRange ) |
|
640 { |
|
641 TBuf<KIntLen> buf; |
|
642 buf.Append( ( TUint16* )( &aPrimaryRange ), KIntLen ); |
|
643 SignalOwner( ESignalRange, buf ); |
|
644 } |
|
645 |
|
646 // ----------------------------------------------------------------------------- |
|
647 // CPeninputHwrfscnLayout::Replace() |
|
648 // Delete the previous charcode and submit the new one |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CPeninputHwrfscnLayout::Replace( const TDesC& aOldCharCode, |
|
652 const TDesC& aNewCharCode ) |
|
653 { |
|
654 // user tries to correct the previous selection |
|
655 // Delete the previous character and append the new one |
|
656 HBufC* newCharBuf = HBufC::New( aNewCharCode.Length() + KIntLen ); |
|
657 if( newCharBuf ) |
|
658 { |
|
659 TInt len = aOldCharCode.Length(); |
|
660 newCharBuf->Des().Append( ( TUint16* )&len, KIntLen ); |
|
661 newCharBuf->Des().Append( aNewCharCode ); |
|
662 SignalOwner( ESignalReplaceText, *newCharBuf ); |
|
663 |
|
664 delete newCharBuf; |
|
665 } |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // CPeninputHwrfscnLayout::SubmitStringToFep() |
|
670 // Submit the char code. |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CPeninputHwrfscnLayout::SubmitStringToFep( const TDesC& aCharCode ) |
|
674 { |
|
675 SignalOwner( ESignalKeyEvent, aCharCode ); |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CPeninputHwrfscnLayout::OnResourceChange() |
|
680 // Submit the char code. |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 TInt CPeninputHwrfscnLayout::OnResourceChange(TInt aType) |
|
684 { |
|
685 CFepUiLayout::OnResourceChange(aType); |
|
686 if( aType == KAknsMessageSkinChange ) |
|
687 { |
|
688 // Do other things when skin change |
|
689 iControlBar->HandleSkinChanged(); |
|
690 } |
|
691 return KErrNone; |
|
692 } |
|
693 // ----------------------------------------------------------------------------- |
|
694 // CPeninputHwrfscnLayout::CandidatePanel() |
|
695 // . |
|
696 // ----------------------------------------------------------------------------- |
|
697 // |
|
698 CPeninputHwrfscnCandidatePanel& CPeninputHwrfscnLayout::CandidatePanel() |
|
699 { |
|
700 return *iCandidatePanel; |
|
701 } |
|
702 |
|
703 void CPeninputHwrfscnLayout::ClearScreen() |
|
704 { |
|
705 if (iFsHwrBox) |
|
706 { |
|
707 iFsHwrBox->CancelCharWriting(); |
|
708 TRAP_IGNORE(NotifyOutsideEventL( ECandidatePanel )); |
|
709 } |
|
710 } |
|
711 |
|
712 CPeninputHwrfscnWritingBox& CPeninputHwrfscnLayout::HwrfscnWritingBox() |
|
713 { |
|
714 return *iFsHwrBox; |
|
715 } |
|
716 //End of file |