|
1 /* |
|
2 * Copyright (c) 2005-2008 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 of main window of finger hwr. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE |
|
19 #include <peninputfingerhwrarwnd.rsg> |
|
20 #include <aknlayoutscalable_apps.cdl.h> |
|
21 #include <aknlayoutscalable_avkon.cdl.h> |
|
22 #include <peninputlayoutmultilineicf.h> |
|
23 #include <peninputdropdownlist.h> |
|
24 #include <peninputrepeatbutton.h> |
|
25 #include <AknLayoutDef.h> |
|
26 #include <AknUtils.h> |
|
27 #include <AknsUtils.h> |
|
28 #include <AknIconUtils.h> |
|
29 #include <coemain.h> |
|
30 #include <s32mem.h> |
|
31 #include <peninputlayoutchoicelist.h> |
|
32 #include <aknfeppeninputenums.h> |
|
33 #include <AknFepGlobalEnums.h> |
|
34 #include <peninputlayoutinputmodechoice.h> |
|
35 #include <peninputrepeatbutton.h> |
|
36 #include <peninputlayout.h> |
|
37 #include <peninputlayoutbubblectrl.h> |
|
38 #include <peninputlayoutvkb.h> |
|
39 |
|
40 #include <peninputmultiimagebutton.h> |
|
41 #include <peninputpluginutils.h> |
|
42 |
|
43 #include "peninputfingerhwrarwnd.h" |
|
44 #include "peninputfingerhwrarlafmanager.h" |
|
45 #include "peninputfingerhwrarevent.h" |
|
46 #include "peninputfingerhwrarcontrolid.h" |
|
47 #include "peninputfingerhwrarstoreconstants.h" |
|
48 #include "peninputfingerhwrarlayout.h" |
|
49 #include "peninputfingerhwrardatastore.h" |
|
50 #include "peninputlayouthwrwnd.h" |
|
51 #include "peninputfingerhwrarsymboltable.h" |
|
52 #include "peninputfingerhwrarindicator.h" |
|
53 |
|
54 #include "peninputfingerhwrarmultipagevkb.h" |
|
55 #include "hbufcarrayar.h" |
|
56 |
|
57 const TUint32 KDefaultTextColor = 0x000000; |
|
58 const TUint KDefaultFrameColor = 0x000000; |
|
59 const TUint32 KDefaultWriteBoxBgColor = 0xdddddd; |
|
60 const TUint32 KDefaultWriteBoxFrameColor = 0x000000; |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // Symbian Constructor |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CPeninputFingerHwrArWnd* CPeninputFingerHwrArWnd::NewL( CFepUiLayout* aFepUiLayout, |
|
67 TInt aControlId, TBool aLandscapeStyle ) |
|
68 { |
|
69 CPeninputFingerHwrArWnd* self = NewLC( aFepUiLayout, aControlId, aLandscapeStyle ); |
|
70 CleanupStack::Pop( self ); |
|
71 |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // Symbian Constructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CPeninputFingerHwrArWnd* CPeninputFingerHwrArWnd::NewLC( CFepUiLayout* aFepUiLayout, |
|
80 TInt aControlId, TBool aLandscapeStyle ) |
|
81 { |
|
82 CPeninputFingerHwrArWnd* self = new ( ELeave ) CPeninputFingerHwrArWnd( aFepUiLayout, aControlId ); |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL( aLandscapeStyle ); |
|
85 |
|
86 return self; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // c++ destructor |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 CPeninputFingerHwrArWnd::~CPeninputFingerHwrArWnd() |
|
94 { |
|
95 delete iLafManager; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Construct control from resource. |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CPeninputFingerHwrArWnd::ConstructFromResourceL() |
|
103 { |
|
104 if ( iResourceId == KInvalidResId ) |
|
105 { |
|
106 User::Leave( KErrArgument ); |
|
107 } |
|
108 |
|
109 TResourceReader reader; |
|
110 CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId ); |
|
111 |
|
112 TInt supportskin = reader.ReadInt16(); |
|
113 |
|
114 if ( iFirstTimeConstruct && ( supportskin != KNotSupportSkin ) ) |
|
115 { |
|
116 UiLayout()->AddControlL( this ); |
|
117 } |
|
118 |
|
119 // read shadow resources |
|
120 TInt32 shadow = reader.ReadInt32(); |
|
121 ReadShadowInfoL( shadow ); |
|
122 |
|
123 // read icf resource |
|
124 TInt32 icf = reader.ReadInt32(); |
|
125 ReadICFInfoL( icf ); |
|
126 |
|
127 |
|
128 if ( iFirstTimeConstruct ) |
|
129 { |
|
130 const TInt32 boxwndResId = reader.ReadInt32(); |
|
131 const TInt32 bgImageResId = reader.ReadInt32(); |
|
132 |
|
133 ReadWritingBoxInfoL( boxwndResId ); |
|
134 ReadBackgroundInfoL( bgImageResId ); |
|
135 //iHandwritingIndicator->ConstructFromResourceL(R_AKN_FEP_HWR_INDICATOR_ICON); |
|
136 } |
|
137 else |
|
138 { |
|
139 CControlGroup::ConstructFromResourceL(); |
|
140 |
|
141 const TInt32 boxwndResId = reader.ReadInt32(); |
|
142 const TInt32 bgImageResId = reader.ReadInt32(); |
|
143 ReadWritingBoxInfoL( boxwndResId ); |
|
144 ReadBackgroundInfoL( bgImageResId ); |
|
145 } |
|
146 |
|
147 CleanupStack::PopAndDestroy(); // reader |
|
148 |
|
149 if (!iFirstTimeConstruct) |
|
150 { |
|
151 Draw(); |
|
152 } |
|
153 |
|
154 iFirstTimeConstruct = EFalse; |
|
155 } |
|
156 |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // Draw window. |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CPeninputFingerHwrArWnd::Draw() |
|
163 { |
|
164 if(AbleToDraw()) |
|
165 { |
|
166 DrawOpaqueMaskBackground( Rect() ); |
|
167 |
|
168 if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() ) |
|
169 { |
|
170 AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved); |
|
171 } |
|
172 |
|
173 DrawBackground(); |
|
174 |
|
175 CControlGroup::Draw(); |
|
176 |
|
177 // Set guide line |
|
178 DrawGuideLine(); |
|
179 |
|
180 //iHandwritingIndicator->BringToTop(); |
|
181 iHandwritingIndicator->Draw(); |
|
182 // update whole area |
|
183 UpdateArea( Rect(), EFalse ); |
|
184 } |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // Resize. |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 void CPeninputFingerHwrArWnd::SizeChangedL() |
|
192 { |
|
193 iLafManager->ReadLafInfo(); |
|
194 ResetLayoutL(); |
|
195 |
|
196 |
|
197 iCandidateList->SizeChanged( iLafManager->CandidateUnitWidth(), |
|
198 iLafManager->CandidateUnitHeight(), |
|
199 iLafManager->CandidateUnitWidth(), |
|
200 iLafManager->CandidateLTPos(), |
|
201 3/*KCandidateCountPerRow*/, |
|
202 2 ); |
|
203 iNumCandidateList->SizeChanged( iLafManager->CandidateUnitWidth(), |
|
204 iLafManager->CandidateUnitHeight(), |
|
205 iLafManager->CandidateUnitWidth(), |
|
206 iLafManager->CandidateLTPos(), |
|
207 3/*KCandidateCountPerRow*/, |
|
208 1 ); |
|
209 iContextField->SetTextMargin ( iLafManager->IcfLeftMargin(), |
|
210 iLafManager->IcfRightMargin(), |
|
211 iLafManager->IcfTopMargin(), |
|
212 iLafManager->IcfBottomMargin() ); |
|
213 |
|
214 iContextField->SetLineSpace( iLafManager->IcfLineSpaceMargin() ); |
|
215 iContextField->SizeChangedL( iLafManager->IcfRect(), |
|
216 iLafManager->IcfTextHeight(), |
|
217 iLafManager->IcfFont()->FontMaxHeight(), |
|
218 iLafManager->IcfFont() ); |
|
219 Draw(); |
|
220 } |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // accept editor's text alignment. |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CPeninputFingerHwrArWnd::SetTextAlignmentL( TInt aAlignment, TInt aLangId ) |
|
227 { |
|
228 if ( iContextField ) |
|
229 { |
|
230 iContextField->SetTextAlignmentL( aAlignment, aLangId ); |
|
231 } |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // accept editor's text |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 void CPeninputFingerHwrArWnd::SetEditorTextL( const TFepInputContextFieldData& aData ) |
|
239 { |
|
240 if ( iContextField ) |
|
241 { |
|
242 iContextField->SetTextL( aData ); |
|
243 } |
|
244 } |
|
245 |
|
246 // --------------------------------------------------------------------------- |
|
247 // accept editor's promopt txt. |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 void CPeninputFingerHwrArWnd::SetPromptTextL( TUint8* aPromoptData ) |
|
251 { |
|
252 RDesReadStream readStream; |
|
253 |
|
254 TPtr8 countPtr(aPromoptData, 2*sizeof(TInt), 2*sizeof(TInt)); |
|
255 readStream.Open(countPtr); |
|
256 CleanupClosePushL(readStream); |
|
257 const TInt dataCount = readStream.ReadInt32L(); |
|
258 const TInt textCount = readStream.ReadInt32L(); |
|
259 CleanupStack::PopAndDestroy(&readStream); |
|
260 |
|
261 TPtr8 ptr( aPromoptData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
262 readStream.Open(ptr); |
|
263 CleanupClosePushL(readStream); |
|
264 |
|
265 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
266 TPtr8 dataBufPtr = dataBuf->Des(); |
|
267 readStream.ReadL(dataBufPtr, dataCount); |
|
268 |
|
269 TFepPromptText* pIcfData = |
|
270 reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
271 |
|
272 HBufC* textBuf; |
|
273 if (textCount > 0) |
|
274 { |
|
275 textBuf = HBufC::NewLC(textCount/2); |
|
276 TPtr textBufPtr = textBuf->Des(); |
|
277 readStream.ReadL(textBufPtr, textCount/2); |
|
278 |
|
279 const HBufC* icfPromptText = iContextField->PromptText(); |
|
280 |
|
281 if (!icfPromptText || icfPromptText->Compare(textBuf->Des()) != 0 ) |
|
282 { |
|
283 iContextField->SetPromptTextL( textBuf->Des(), pIcfData->iCleanContent ); |
|
284 } |
|
285 |
|
286 CleanupStack::PopAndDestroy(textBuf); |
|
287 } |
|
288 else |
|
289 { |
|
290 iContextField->SetPromptTextL(KNullDesC, pIcfData->iCleanContent); |
|
291 } |
|
292 |
|
293 CleanupStack::PopAndDestroy(dataBuf); |
|
294 CleanupStack::PopAndDestroy(&readStream); |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // Dim option button |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 void CPeninputFingerHwrArWnd::SetEnableSettingBtn(const TBool aEnable) |
|
302 { |
|
303 if ( aEnable ) |
|
304 { |
|
305 iOptionBtn->SetDimmed(EFalse); |
|
306 } |
|
307 else |
|
308 { |
|
309 iOptionBtn->SetDimmed(ETrue); |
|
310 iOptionBtn->SetActive(EFalse); |
|
311 } |
|
312 |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // accept editor's bubble text. |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 void CPeninputFingerHwrArWnd::SetBubbleTextL( const TDesC& aInfo ) |
|
320 { |
|
321 if ( aInfo.Length() > 0 ) |
|
322 { |
|
323 iContextField->ShowBubble( aInfo, iContextField->MsgBubbleCtrl()->Rect() ); |
|
324 } |
|
325 else |
|
326 { |
|
327 iContextField->HideBubble(); |
|
328 } |
|
329 } |
|
330 |
|
331 // --------------------------------------------------------------------------- |
|
332 // accept editor's char ranges restriction. |
|
333 // --------------------------------------------------------------------------- |
|
334 // |
|
335 void CPeninputFingerHwrArWnd::SetPermittedRanges( const TInt aPermittedRanges ) |
|
336 { |
|
337 if(aPermittedRanges == 0) |
|
338 return; |
|
339 |
|
340 iPermittedRanges = aPermittedRanges; |
|
341 } |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // get strokes from hwr writing box. |
|
345 // --------------------------------------------------------------------------- |
|
346 // |
|
347 const RArray<TPoint>& CPeninputFingerHwrArWnd::StrokeList() |
|
348 { |
|
349 return iWritingBox->StrokeList(); |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------------------------- |
|
353 // set end mark of hwr |
|
354 // --------------------------------------------------------------------------- |
|
355 // |
|
356 void CPeninputFingerHwrArWnd::SetStrokeEndMark( const TPoint& aEndMark ) |
|
357 { |
|
358 iWritingBox->SetStrokeEndMark( aEndMark ); |
|
359 } |
|
360 |
|
361 // --------------------------------------------------------------------------- |
|
362 // set guide line on or off. |
|
363 // --------------------------------------------------------------------------- |
|
364 // |
|
365 void CPeninputFingerHwrArWnd::SetGuideLineOn(const TBool aGuideLineOn) |
|
366 { |
|
367 iGuideLineOn = aGuideLineOn; |
|
368 } |
|
369 |
|
370 // --------------------------------------------------------------------------- |
|
371 // set pen color of hwr writing. |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 void CPeninputFingerHwrArWnd::SetBoxPenColor( const TInt aPenColor ) |
|
375 { |
|
376 iWritingBox->SetPenColor( aPenColor ); |
|
377 } |
|
378 |
|
379 // --------------------------------------------------------------------------- |
|
380 // set pen size of hwr writing. |
|
381 // --------------------------------------------------------------------------- |
|
382 // |
|
383 void CPeninputFingerHwrArWnd::SetBoxPenSize( const TSize aPenSize ) |
|
384 { |
|
385 iWritingBox->SetPenSize( aPenSize ); |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------------------------- |
|
389 // set writing speed hwr writing. |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 void CPeninputFingerHwrArWnd::SetBoxWritingSpeed( const TTimeIntervalMicroSeconds32& aCharDelay ) |
|
393 { |
|
394 iWritingBox->SetCharacterDelay( aCharDelay ); |
|
395 iWritingBox->SetStrokeDelay( 90000 ); |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // retrieve rect of hwr writingbox. |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 TRect CPeninputFingerHwrArWnd::WritingBoxRect() |
|
403 { |
|
404 return iWritingBox->Rect(); |
|
405 } |
|
406 |
|
407 |
|
408 // --------------------------------------------------------------------------- |
|
409 // Cancel wrting |
|
410 // --------------------------------------------------------------------------- |
|
411 // |
|
412 void CPeninputFingerHwrArWnd::CancelWriting() |
|
413 { |
|
414 iWritingBox->CancelCharWriting(); |
|
415 } |
|
416 |
|
417 // --------------------------------------------------------------------------- |
|
418 // Change SCT page. |
|
419 // --------------------------------------------------------------------------- |
|
420 // |
|
421 void CPeninputFingerHwrArWnd::ShowSctPage( TInt aPageNo, TInt aPos ) |
|
422 { |
|
423 iSymbolTable->NavigatePage(aPageNo,aPos); |
|
424 UpdateAllVirtualKeysFeedback( EFingerHwrSymbolRange ); |
|
425 } |
|
426 |
|
427 // --------------------------------------------------------------------------- |
|
428 // retrieve the ICF control. |
|
429 // --------------------------------------------------------------------------- |
|
430 // |
|
431 CFepLayoutMultiLineIcf* CPeninputFingerHwrArWnd::Icf() |
|
432 { |
|
433 return iContextField; |
|
434 } |
|
435 |
|
436 |
|
437 // --------------------------------------------------------------------------- |
|
438 // retrieve the candicate list control. |
|
439 // --------------------------------------------------------------------------- |
|
440 // |
|
441 CFepCtrlDropdownList* CPeninputFingerHwrArWnd::CandidateList() |
|
442 { |
|
443 return iCandidateList; |
|
444 } |
|
445 // --------------------------------------------------------------------------- |
|
446 // retrieve the number candicate list control. |
|
447 // --------------------------------------------------------------------------- |
|
448 // |
|
449 CFepCtrlDropdownList* CPeninputFingerHwrArWnd::NumCandidateList() |
|
450 { |
|
451 return iNumCandidateList; |
|
452 } |
|
453 |
|
454 // --------------------------------------------------------------------------- |
|
455 // Update layout |
|
456 // --------------------------------------------------------------------------- |
|
457 // |
|
458 void CPeninputFingerHwrArWnd::UpdateLayout( const TBool aIsStandby, const TBool aReloadCandicate) |
|
459 { |
|
460 TRAP_IGNORE( UpdateLayoutL( aIsStandby, aReloadCandicate) ); |
|
461 } |
|
462 |
|
463 // --------------------------------------------------------------------------- |
|
464 // Update layout |
|
465 // --------------------------------------------------------------------------- |
|
466 // |
|
467 void CPeninputFingerHwrArWnd::UpdateLayoutL( const TBool aIsStandby, |
|
468 const TBool aReloadCandicate) |
|
469 { |
|
470 // Set the candidates when dropdown list is shown |
|
471 if ( !aIsStandby ) |
|
472 { |
|
473 typedef CFepCtrlDropdownList::TListType TDropListType; |
|
474 |
|
475 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
|
476 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
|
477 CPeninputFingerHwrArDataStore& datastore = hwrLayout->DataStore(); |
|
478 |
|
479 const RPointerArray<HBufC>& candidates = datastore.Candidate(); |
|
480 |
|
481 |
|
482 TDropListType unexpandable = CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble; |
|
483 |
|
484 if ( datastore.PrimaryRange() == ERangeNative ) |
|
485 { |
|
486 iCandidateList->Hide( EFalse ); |
|
487 |
|
488 if ( aReloadCandicate ) |
|
489 { |
|
490 iCandidateList->SetCandidatesL( candidates, unexpandable ); |
|
491 } |
|
492 |
|
493 iCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
|
494 |
|
495 } |
|
496 else |
|
497 { |
|
498 iNumCandidateList->Hide( EFalse ); |
|
499 if ( aReloadCandicate ) |
|
500 { |
|
501 iNumCandidateList->SetCandidatesL( candidates, unexpandable ); |
|
502 } |
|
503 |
|
504 iNumCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
|
505 } |
|
506 } |
|
507 else |
|
508 { |
|
509 iCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
|
510 iNumCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
|
511 // hide all the dropdown list in standby state |
|
512 iCandidateList->Hide( ETrue ); |
|
513 iNumCandidateList->Hide( ETrue ); |
|
514 } |
|
515 |
|
516 iArrowLeftBtn->Hide( !aIsStandby ); |
|
517 iArrowRightBtn->Hide( !aIsStandby ); |
|
518 iArrowUpBtn->Hide( !aIsStandby ); |
|
519 iArrowDownBtn->Hide( !aIsStandby ); |
|
520 } |
|
521 |
|
522 // --------------------------------------------------------------------------- |
|
523 // dim arrow buttons. |
|
524 // --------------------------------------------------------------------------- |
|
525 // |
|
526 void CPeninputFingerHwrArWnd::DimArrowKeys( TBool aDimArrow ) |
|
527 { |
|
528 iArrowLeftBtn->SetDimmed( aDimArrow ); |
|
529 iArrowRightBtn->SetDimmed( aDimArrow ); |
|
530 iArrowUpBtn->SetDimmed( aDimArrow ); |
|
531 iArrowDownBtn->SetDimmed( aDimArrow ); |
|
532 } |
|
533 |
|
534 // --------------------------------------------------------------------------- |
|
535 // retrieve char range of layout, including sct. |
|
536 // --------------------------------------------------------------------------- |
|
537 // |
|
538 TInt CPeninputFingerHwrArWnd::CurrentCharRange() |
|
539 { |
|
540 return iCurCharRange; |
|
541 } |
|
542 |
|
543 // --------------------------------------------------------------------------- |
|
544 // c++ constructor |
|
545 // --------------------------------------------------------------------------- |
|
546 // |
|
547 CPeninputFingerHwrArWnd::CPeninputFingerHwrArWnd( |
|
548 CFepUiLayout* aFepUiLayout, TInt aControlId ) |
|
549 : CControlGroup( aFepUiLayout,aControlId ), iFirstTimeConstruct( ETrue ) |
|
550 { |
|
551 } |
|
552 |
|
553 // --------------------------------------------------------------------------- |
|
554 // Symbian second-phase constructor |
|
555 // --------------------------------------------------------------------------- |
|
556 // |
|
557 void CPeninputFingerHwrArWnd::ConstructL( TBool /*aLandscapeStyle*/ ) |
|
558 { |
|
559 BaseConstructL(); |
|
560 |
|
561 iLafManager = CPeninputFingerHwrArLafManager::NewL(); |
|
562 iLafManager->ReadLafInfo(); |
|
563 |
|
564 //crate writing |
|
565 CreateWritingBoxL(); |
|
566 |
|
567 //create the handwriting indicator |
|
568 iHandwritingIndicator = CPeninputArabicFingerHwrIndicator::NewL(UiLayout(),EHwrCtrlIdHandwringIndicator); |
|
569 AddControlL(iHandwritingIndicator); |
|
570 |
|
571 //create icf |
|
572 CreateContextFieldL(); |
|
573 |
|
574 //create candidate lists |
|
575 CreateCandidateListL(); |
|
576 |
|
577 //create number candidate lists. |
|
578 CreateNumCandidateListL(); |
|
579 |
|
580 //create virtual sct pad |
|
581 CreateSymbolTableL(); |
|
582 |
|
583 //create control buttons |
|
584 CreateButtonsL(); |
|
585 |
|
586 iCurCharRangeNoSct = EFingerHwrNativeRange; |
|
587 iCurCharRange = EFingerHwrNativeRange; |
|
588 |
|
589 //ResetLayoutL(); |
|
590 SizeChangedL(); |
|
591 SwitchToStandbyView(); |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // create icf. |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CPeninputFingerHwrArWnd::CreateContextFieldL() |
|
599 { |
|
600 const CFont* icffont =iLafManager->IcfFont(); |
|
601 |
|
602 iContextField = CFepLayoutMultiLineIcf::NewL( |
|
603 iLafManager->IcfRect(), |
|
604 UiLayout(), |
|
605 EHwrCtrlIdInputContextField, |
|
606 icffont->HeightInPixels(), |
|
607 icffont->FontMaxHeight(), |
|
608 icffont ); |
|
609 |
|
610 iContextField->SetTextMargin ( iLafManager->IcfLeftMargin(), |
|
611 iLafManager->IcfRightMargin(), |
|
612 iLafManager->IcfTopMargin(), |
|
613 iLafManager->IcfBottomMargin() ); |
|
614 |
|
615 iContextField->SetLineSpace( iLafManager->IcfLineSpaceMargin() ); |
|
616 |
|
617 iContextField->SizeChangedL( iLafManager->IcfRect(), |
|
618 iLafManager->IcfTextHeight(), |
|
619 iLafManager->IcfFont()->FontMaxHeight(), |
|
620 iLafManager->IcfFont() ); |
|
621 |
|
622 TAknWindowLineLayout bubbleLineLayout = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine(); |
|
623 TAknTextLineLayout bubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1( 0 ).LayoutLine(); |
|
624 |
|
625 iContextField->MsgBubbleCtrl()->SetTextFormat( bubbleTextLayout ); |
|
626 iContextField->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
627 |
|
628 //Change the ID when ID into release |
|
629 iContextField->MsgBubbleCtrl()->SetBitmapParam( NULL, |
|
630 NULL, |
|
631 KAknsIIDQsnFrInputPreviewSideL, |
|
632 KAknsIIDQsnFrInputPreviewMiddle, |
|
633 KAknsIIDQsnFrInputPreviewSideR ); |
|
634 iContextField->SetMsgBubbleCtrlSize( TSize( bubbleLineLayout.iW,bubbleLineLayout.iH ) ); |
|
635 |
|
636 iContextField->SetLineSeparatorAfterPrompt(ETrue); |
|
637 |
|
638 //transfer to headerPane |
|
639 AddControlL( iContextField ); |
|
640 |
|
641 //add layout as event observer |
|
642 iContextField->AddEventObserver( UiLayout() ); |
|
643 iContextField->SetFocus(); |
|
644 |
|
645 } |
|
646 |
|
647 // --------------------------------------------------------------------------- |
|
648 // create candidate lists. |
|
649 // --------------------------------------------------------------------------- |
|
650 // |
|
651 void CPeninputFingerHwrArWnd::CreateCandidateListL() |
|
652 { |
|
653 TDropdownListDrawInfo candiDrawInfo( |
|
654 KAknsIIDQsnFrFunctionButtonInactive, |
|
655 KAknsIIDQsnFrFunctionButtonNormal, |
|
656 KAknsIIDQsnFrFunctionButtonPressed, |
|
657 KAknsIIDQsnFrItutButtonCandiSideL, |
|
658 KAknsIIDQsnFrItutButtonCandiMiddle, |
|
659 KAknsIIDQsnFrItutButtonCandiSideR, |
|
660 KAknsIIDQsnFrItutButtonCandiPressedSideL, |
|
661 KAknsIIDQsnFrItutButtonCandiPressedMiddle, |
|
662 KAknsIIDQsnFrItutButtonCandiPressedSideR, |
|
663 TRgb( 194, 221, 242 ), |
|
664 ETrue ); |
|
665 |
|
666 TInt unitWidth = iLafManager->CandidateUnitWidth(); |
|
667 TInt unitHeight = iLafManager->CandidateUnitHeight(); |
|
668 TPoint ltPosition = iLafManager->CandidateLTPos(); |
|
669 const CFont *font = iLafManager->CandidateFont(); |
|
670 iCandidateList = CFepCtrlDropdownList::NewL(UiLayout(), |
|
671 EHwrCtrlIdCandidateList, |
|
672 R_FSHWR_CANDIDATE_DROP_DOWN_LIST, |
|
673 ltPosition, |
|
674 font , |
|
675 TSize(unitWidth,unitHeight), |
|
676 unitWidth, |
|
677 3,2, |
|
678 unitHeight, |
|
679 0, |
|
680 0, |
|
681 CFepCtrlDropdownList::ECandFromRToL, |
|
682 EFalse); |
|
683 AddControlL( iCandidateList ); |
|
684 |
|
685 TInt horizontalMargin = iLafManager->CandidateHorizontalMargin(); |
|
686 TInt verticalMargin = iLafManager->CandidateVerticalMargin(); |
|
687 iCandidateList->SetCellMargin( horizontalMargin, verticalMargin ); |
|
688 iCandidateList->SetFont( font ); |
|
689 |
|
690 // set the needed events |
|
691 iCandidateList->SetEventIdForCandidateSelected( EHwrEventCandidateSelected ); |
|
692 iCandidateList->AddEventObserver( UiLayout() ); |
|
693 |
|
694 // hide the candidate list |
|
695 iCandidateList->Hide( ETrue ); |
|
696 iCandidateList->SetDropdownListImgID( candiDrawInfo ); |
|
697 } |
|
698 |
|
699 // --------------------------------------------------------------------------- |
|
700 // create candidate lists. |
|
701 // --------------------------------------------------------------------------- |
|
702 // |
|
703 void CPeninputFingerHwrArWnd::CreateNumCandidateListL() |
|
704 { |
|
705 TDropdownListDrawInfo candiDrawInfo( |
|
706 KAknsIIDQsnFrFunctionButtonInactive, |
|
707 KAknsIIDQsnFrFunctionButtonNormal, |
|
708 KAknsIIDQsnFrFunctionButtonPressed, |
|
709 KAknsIIDQsnFrItutButtonCandiSideL, |
|
710 KAknsIIDQsnFrItutButtonCandiMiddle, |
|
711 KAknsIIDQsnFrItutButtonCandiSideR, |
|
712 KAknsIIDQsnFrItutButtonCandiPressedSideL, |
|
713 KAknsIIDQsnFrItutButtonCandiPressedMiddle, |
|
714 KAknsIIDQsnFrItutButtonCandiPressedSideR, |
|
715 TRgb( 194, 221, 242 ), |
|
716 ETrue ); |
|
717 |
|
718 TInt unitWidth = iLafManager->CandidateUnitWidth(); |
|
719 TInt unitHeight = iLafManager->CandidateUnitHeight(); |
|
720 TPoint ltPosition = iLafManager->CandidateLTPos(); |
|
721 const CFont *font = iLafManager->CandidateFont(); |
|
722 TInt horizontalMargin = iLafManager->CandidateHorizontalMargin(); |
|
723 TInt verticalMargin = iLafManager->CandidateVerticalMargin(); |
|
724 |
|
725 iNumCandidateList = CFepCtrlDropdownList::NewL(UiLayout(), |
|
726 EHwrCtrlIdNumCandidateList, |
|
727 R_FSHWR_CANDIDATE_DROP_DOWN_LIST, |
|
728 ltPosition, |
|
729 font , |
|
730 TSize(unitWidth,unitHeight), |
|
731 unitWidth, |
|
732 3,1, |
|
733 unitHeight, |
|
734 0, |
|
735 0, |
|
736 CFepCtrlDropdownList::ECandFromRToL, |
|
737 EFalse); |
|
738 AddControlL( iNumCandidateList ); |
|
739 iNumCandidateList->SetCellMargin( horizontalMargin, verticalMargin ); |
|
740 iNumCandidateList->SetFont( font ); |
|
741 |
|
742 // set the needed events |
|
743 iNumCandidateList->SetEventIdForCandidateSelected( EHwrEventCandidateSelected ); |
|
744 iNumCandidateList->AddEventObserver( UiLayout() ); |
|
745 |
|
746 // hide the candidate list |
|
747 iNumCandidateList->Hide( ETrue ); |
|
748 iNumCandidateList->SetDropdownListImgID( candiDrawInfo ); |
|
749 |
|
750 } |
|
751 // --------------------------------------------------------------------------- |
|
752 // create writing box. |
|
753 // --------------------------------------------------------------------------- |
|
754 // |
|
755 void CPeninputFingerHwrArWnd::CreateWritingBoxL() |
|
756 { |
|
757 iWritingBox = CTransparentHwrWndExt::NewL( TRect( 0,0,0,0 ), UiLayout(), |
|
758 EHwrCtrlIdWritingBox, EFalse ); |
|
759 |
|
760 AddControlL( iWritingBox ); |
|
761 |
|
762 |
|
763 //set it to window |
|
764 iWritingBox->SetStrokeEndMark( TPoint( -1,0 ) ); |
|
765 iWritingBox->AddEventObserver( UiLayout() ); |
|
766 iWritingBox->EnableTraceOutsideWindow( EFalse ); |
|
767 iWritingBox->SetWndTransparencyFactor( 0 ); |
|
768 |
|
769 iWritingBox->InstallPenTraceDecoratorL( KNullDesC,EFalse); |
|
770 } |
|
771 |
|
772 // --------------------------------------------------------------------------- |
|
773 // create all function buttons. |
|
774 // --------------------------------------------------------------------------- |
|
775 // |
|
776 void CPeninputFingerHwrArWnd::CreateButtonsL() |
|
777 { |
|
778 iCloseBtn = CreateEventBtnL( EHwrCtrlIdClose, R_AKN_FEP_HWR_CLOSE ); |
|
779 iOptionBtn = CreateEventBtnL( EHwrCtrlIdLanguageOption, R_AKN_FEP_HWR_OPTION ); |
|
780 |
|
781 iBackspaceBtn = CreateRepBtnL( EHwrCtrlIdBackspace, R_AKN_FEP_HWR_BACK_SPACE, |
|
782 EHwrEventKeyBack, EKeyBackspace ); |
|
783 |
|
784 iArrowLeftBtn = CreateRepBtnL( EHwrCtrlIdArrowLeft, R_AKN_FEP_HWR_ARROWLEFT, |
|
785 EHwrEventNavKeyClicked, EKeyLeftArrow ); |
|
786 iArrowRightBtn = CreateRepBtnL( EHwrCtrlIdArrowRight, R_AKN_FEP_HWR_ARROWRIGHT, |
|
787 EHwrEventNavKeyClicked, EKeyRightArrow ); |
|
788 iArrowUpBtn = CreateRepBtnL( EHwrCtrlIdArrowUp, R_AKN_FEP_HWR_ARROWUP, |
|
789 EHwrEventNavKeyClicked, EKeyUpArrow ); |
|
790 iArrowDownBtn = CreateRepBtnL( EHwrCtrlIdArrowDown, R_AKN_FEP_HWR_ARROWDOWN, |
|
791 EHwrEventNavKeyClicked, EKeyDownArrow ); |
|
792 iSymbolTableBtn = CreateEventBtnL( EHwrCtrlIdSymbolButton, R_AKN_FEP_HWR_SYMBOL_TABLE_BUTTON ); |
|
793 } |
|
794 |
|
795 // --------------------------------------------------------------------------- |
|
796 // create virtual sct pad. |
|
797 // --------------------------------------------------------------------------- |
|
798 // |
|
799 void CPeninputFingerHwrArWnd::CreateSymbolTableL() |
|
800 { |
|
801 iSymbolTable = CPeninputArabicFingerHwrSymbolTable::NewL(UiLayout(),EHwrCtrlIdSymbolTableVkbGroup); |
|
802 iSymbolTable->Hide(ETrue); |
|
803 AddControlL( iSymbolTable ); |
|
804 iSymbolTable->AddEventObserver( UiLayout() ); |
|
805 } |
|
806 |
|
807 // --------------------------------------------------------------------------- |
|
808 // EventButton creation helper. |
|
809 // --------------------------------------------------------------------------- |
|
810 // |
|
811 CAknFepCtrlEventButton* CPeninputFingerHwrArWnd::CreateEventBtnL( TInt aCtrlId, |
|
812 TInt32 aResId, TInt aEvent/*= 0xFFFF*/,TInt aUnicode/*=0*/ ) |
|
813 { |
|
814 CAknFepCtrlEventButton* button = CAknFepCtrlEventButton::NewL( |
|
815 UiLayout(), aCtrlId, aEvent, aUnicode, |
|
816 KAknsIIDQsnFrFunctionButtonNormal, |
|
817 KAknsIIDQsnFrFunctionButtonPressed, |
|
818 KAknsIIDQsnFrFunctionButtonInactive ); |
|
819 |
|
820 button->SetResourceId( aResId ); |
|
821 button->ConstructFromResourceL(); |
|
822 button->AddEventObserver( UiLayout() ); |
|
823 AddControlL( button ); |
|
824 return button; |
|
825 } |
|
826 |
|
827 // --------------------------------------------------------------------------- |
|
828 // RepeatButton creation helper. |
|
829 // --------------------------------------------------------------------------- |
|
830 // |
|
831 CAknFepCtrlRepeatButton* CPeninputFingerHwrArWnd::CreateRepBtnL( const TInt aCtrlId, |
|
832 TInt32 aResId, const TInt aEvent, const TInt aUnicode ) |
|
833 { |
|
834 CAknFepCtrlRepeatButton* button = CAknFepCtrlRepeatButton::NewL( |
|
835 UiLayout(), aCtrlId, aEvent, aUnicode, |
|
836 KAknsIIDQsnFrFunctionButtonNormal, |
|
837 KAknsIIDQsnFrFunctionButtonPressed, |
|
838 KAknsIIDQsnFrFunctionButtonInactive ); |
|
839 |
|
840 button->SetResourceId( aResId ); |
|
841 button->ConstructFromResourceL( ); |
|
842 button->AddEventObserver( UiLayout() ); |
|
843 AddControlL( button ); |
|
844 |
|
845 return button; |
|
846 } |
|
847 |
|
848 // --------------------------------------------------------------------------- |
|
849 // load virtual number pad images. |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CPeninputFingerHwrArWnd::LoadVkbKeyImageL( TInt aResId, const TSize& aKeySize ) |
|
853 { |
|
854 iSymbolTable->LoadVkbKeyImageL(aResId,aKeySize); |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // load virtual sct keys. |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 void CPeninputFingerHwrArWnd::LoadVirtualSctpadKeysL( const TInt aResId, |
|
862 const RArray<TRect>& aCellRects ) |
|
863 { |
|
864 TAknTextLineLayout txtlayout = iLafManager->SctpadKeyTxtLayout(); |
|
865 iSymbolTable->KeyPad()->SetTextLineLayout( txtlayout ); |
|
866 |
|
867 TInt fontid = txtlayout.FontId(); |
|
868 const CFont* font = AknLayoutUtils::FontFromId( fontid ); |
|
869 iSymbolTable->KeyPad()->SetFont( font ); |
|
870 |
|
871 iSymbolTable->LoadVirtualKeypadKeyL(aResId,aCellRects); |
|
872 } |
|
873 |
|
874 // --------------------------------------------------------------------------- |
|
875 // relayout full ui, reset all controls position. |
|
876 // --------------------------------------------------------------------------- |
|
877 // |
|
878 void CPeninputFingerHwrArWnd::ResetLayoutL() |
|
879 { |
|
880 TRect rcScreen = iLafManager->LayoutRect(); |
|
881 SetRect( rcScreen ); |
|
882 |
|
883 TRect rect; |
|
884 |
|
885 //Move ICF |
|
886 rect = iLafManager->CtrlRect( iContextField->ControlId() ); |
|
887 iContextField->SetRect( rect ); |
|
888 |
|
889 //Move Writing box |
|
890 rect = iLafManager->CtrlRect( iWritingBox->ControlId() ); |
|
891 iWritingBox->SetRect( rect ); |
|
892 |
|
893 //resize indicator |
|
894 TRect indicatorRect; |
|
895 indicatorRect.iTl = rect.iTl; |
|
896 indicatorRect.Move(TPoint(10,10)); |
|
897 |
|
898 indicatorRect.SetSize(TSize(50,30)); |
|
899 |
|
900 iHandwritingIndicator->ConstructFromResourceL(R_AKN_FEP_HWR_INDICATOR_ICON); |
|
901 iHandwritingIndicator->SizeChanged(indicatorRect,ETrue); |
|
902 |
|
903 //Move buttons |
|
904 TSize siBtnPadding = iLafManager->ButtonInnerPadding(); |
|
905 TInt pdx = siBtnPadding.iWidth; |
|
906 TInt pdy = siBtnPadding.iHeight; |
|
907 |
|
908 rect = iLafManager->CtrlRect( iCloseBtn->ControlId() ); |
|
909 MoveIconButton( iCloseBtn, rect, pdx, pdy, ETrue ); |
|
910 |
|
911 rect = iLafManager->CtrlRect( iSymbolTableBtn->ControlId() ); |
|
912 MoveIconButton( iSymbolTableBtn, rect, pdx, pdy, ETrue ); |
|
913 |
|
914 rect = iLafManager->CtrlRect( iBackspaceBtn->ControlId() ); |
|
915 MoveIconButton( iBackspaceBtn, rect, pdx, pdy, ETrue ); |
|
916 |
|
917 rect = iLafManager->CtrlRect( iArrowUpBtn->ControlId() ); |
|
918 MoveIconButton( iArrowUpBtn, rect, pdx, pdy, ETrue ); |
|
919 |
|
920 rect = iLafManager->CtrlRect( iArrowLeftBtn->ControlId() ); |
|
921 MoveIconButton( iArrowLeftBtn, rect, pdx, pdy, ETrue ); |
|
922 |
|
923 rect = iLafManager->CtrlRect( iArrowRightBtn->ControlId() ); |
|
924 MoveIconButton( iArrowRightBtn, rect, pdx, pdy, ETrue ); |
|
925 |
|
926 rect = iLafManager->CtrlRect( iArrowDownBtn->ControlId() ); |
|
927 MoveIconButton( iArrowDownBtn, rect, pdx, pdy, ETrue ); |
|
928 |
|
929 rect = iLafManager->CtrlRect( iOptionBtn->ControlId() ); |
|
930 MoveIconButton( iOptionBtn, rect, pdx, pdy, ETrue ); |
|
931 |
|
932 // load vkb key image |
|
933 TSize keysize = iLafManager->VirtualSctpadCellSize().Size(); |
|
934 LoadVkbKeyImageL(R_FINGER_HWR_SCTPAD_IMAGE, keysize ); |
|
935 |
|
936 // get the key rect |
|
937 RArray<TRect> rects; |
|
938 CleanupClosePushL( rects ); |
|
939 iLafManager->GetVirtualKeyRects( rects ); |
|
940 |
|
941 // load keys |
|
942 if(iLafManager->IsLandscape()) |
|
943 { |
|
944 LoadVirtualSctpadKeysL(R_ARABIC_FINGER_HWR_LANDSCAPE_SYMBOL_TABLE, rects); |
|
945 } |
|
946 else |
|
947 { |
|
948 LoadVirtualSctpadKeysL(R_ARABIC_FINGER_HWR_PORTRAIT_SYMBOL_TABLE, rects); |
|
949 } |
|
950 CleanupStack::PopAndDestroy();//rects |
|
951 |
|
952 //move virtual Sctpad |
|
953 TInt rows = iLafManager->VirtualSctpadRowCount(); |
|
954 TInt cols = iLafManager->VirtualSctpadColCount(); |
|
955 |
|
956 rect = iLafManager->CtrlRect(iSymbolTable->ControlId()); |
|
957 iSymbolTable->SetRect(rect); |
|
958 |
|
959 TSize symButtonSize = iLafManager->SymbolGroupButtonSize(); |
|
960 iSymbolTable->SizeChanged(TSize(),symButtonSize,rows,cols,iLafManager->IsLandscape()); |
|
961 } |
|
962 |
|
963 |
|
964 // --------------------------------------------------------------------------- |
|
965 // layout for chinese range standby. |
|
966 // --------------------------------------------------------------------------- |
|
967 // |
|
968 void CPeninputFingerHwrArWnd::SwitchToStandbyView() |
|
969 { |
|
970 // hide following controls |
|
971 iCandidateList->Hide( ETrue ); |
|
972 iNumCandidateList->Hide( ETrue ); |
|
973 iSymbolTable->Hide( ETrue ); |
|
974 |
|
975 // show following controls |
|
976 iArrowLeftBtn->Hide( EFalse ); |
|
977 iArrowRightBtn->Hide( EFalse ); |
|
978 iArrowUpBtn->Hide( EFalse ); |
|
979 iArrowDownBtn->Hide( EFalse ); |
|
980 iOptionBtn->Hide( EFalse ); |
|
981 |
|
982 iSymbolTableBtn->Hide( EFalse ); |
|
983 iSymbolTableBtn->SetHighlight( EFalse); |
|
984 |
|
985 UpdateAllVirtualKeysFeedback( EFingerHwrNativeRange ); |
|
986 Draw(); |
|
987 } |
|
988 |
|
989 // --------------------------------------------------------------------------- |
|
990 // layout for symbol range standby. |
|
991 // --------------------------------------------------------------------------- |
|
992 // |
|
993 void CPeninputFingerHwrArWnd::SwitchToSymbolTableView() |
|
994 { |
|
995 // show following controls |
|
996 iWritingBox->Hide( EFalse ); |
|
997 iSymbolTable->Hide( EFalse ); |
|
998 iOptionBtn->Hide( EFalse ); |
|
999 |
|
1000 // hide follwing controls |
|
1001 iCandidateList->Hide( ETrue ); |
|
1002 iNumCandidateList->Hide( ETrue ); |
|
1003 iArrowLeftBtn->Hide( ETrue ); |
|
1004 iArrowRightBtn->Hide( ETrue ); |
|
1005 iArrowUpBtn->Hide( ETrue ); |
|
1006 iArrowDownBtn->Hide( ETrue ); |
|
1007 iOptionBtn->Hide( EFalse ); |
|
1008 iSymbolTableBtn->SetHighlight( ETrue ); |
|
1009 |
|
1010 TInt pageno = ( iCurCharRangeNoSct == EFingerHwrNativeRange ) ? 0 : 1; |
|
1011 ShowSctPage( pageno, EPagePosPageNo ); |
|
1012 |
|
1013 UpdateAllVirtualKeysFeedback( EFingerHwrSymbolRange ); |
|
1014 iSymbolTable->OpenSymbolTable(); |
|
1015 } |
|
1016 |
|
1017 |
|
1018 // --------------------------------------------------------------------------- |
|
1019 // EventButton layout helper. Move button to specified rect. |
|
1020 // --------------------------------------------------------------------------- |
|
1021 // |
|
1022 void CPeninputFingerHwrArWnd::MoveIconButton( CAknFepCtrlEventButton* aButton, |
|
1023 const TRect& aRect, TInt aXPadding, TInt aYPadding, TBool aReloadImages ) |
|
1024 { |
|
1025 if ( !aButton ) |
|
1026 { |
|
1027 return; |
|
1028 } |
|
1029 |
|
1030 aButton->SetRect( aRect ); |
|
1031 TRect rcInner = aRect; |
|
1032 if ( rcInner.Width()> rcInner.Height() ) |
|
1033 { |
|
1034 TInt dx = ( rcInner.Width() - rcInner.Height() ) / 2; |
|
1035 rcInner.Move( dx, 0 ); |
|
1036 rcInner.SetWidth( rcInner.Height() ); |
|
1037 } |
|
1038 else |
|
1039 { |
|
1040 TInt dy = ( rcInner.Height() - rcInner.Width() ) / 2; |
|
1041 rcInner.Move( 0, dy ); |
|
1042 rcInner.SetHeight( rcInner.Width() ); |
|
1043 } |
|
1044 |
|
1045 rcInner.Shrink( aXPadding, aYPadding ); |
|
1046 aButton->SizeChanged( aRect, rcInner, aReloadImages ); |
|
1047 } |
|
1048 |
|
1049 // --------------------------------------------------------------------------- |
|
1050 // Read control's shadow info. |
|
1051 // --------------------------------------------------------------------------- |
|
1052 // |
|
1053 void CPeninputFingerHwrArWnd::ReadShadowInfoL( const TInt aResId ) |
|
1054 { |
|
1055 TResourceReader resReader; |
|
1056 CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId ); |
|
1057 |
|
1058 TPtrC bmpFileName = resReader.ReadTPtrC(); |
|
1059 TInt32 imgMajorSkinId = resReader.ReadInt32(); |
|
1060 |
|
1061 TAknsItemID id; |
|
1062 TInt skinitemid; |
|
1063 |
|
1064 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1065 |
|
1066 for ( TInt i = 0; i < KShadowBmpBr + 1; i++ ) |
|
1067 { |
|
1068 const TInt16 bmpId = resReader.ReadInt16(); |
|
1069 const TInt16 bmpMskId = resReader.ReadInt16(); |
|
1070 skinitemid = resReader.ReadInt16(); |
|
1071 |
|
1072 id.Set( TInt( imgMajorSkinId ), skinitemid ); |
|
1073 |
|
1074 if ( bmpId != KInvalidImg ) |
|
1075 { |
|
1076 CFbsBitmap* shadowImg = NULL; |
|
1077 CFbsBitmap* shadowMaskImg = NULL; |
|
1078 |
|
1079 if ( bmpMskId != KInvalidImg ) |
|
1080 { |
|
1081 AknsUtils::CreateIconL( skininstance, |
|
1082 id, |
|
1083 shadowImg, |
|
1084 shadowMaskImg, |
|
1085 bmpFileName, |
|
1086 bmpId, |
|
1087 bmpMskId ); |
|
1088 } |
|
1089 else |
|
1090 { |
|
1091 AknsUtils::CreateIconL( skininstance, |
|
1092 id, |
|
1093 shadowImg, |
|
1094 bmpFileName, |
|
1095 bmpId ); |
|
1096 } |
|
1097 |
|
1098 SetShadowBmp( shadowImg, shadowMaskImg, TShadowBitmapIndex( i ) ); |
|
1099 } |
|
1100 } |
|
1101 CleanupStack::PopAndDestroy( 1 ); // reader |
|
1102 |
|
1103 } |
|
1104 |
|
1105 // --------------------------------------------------------------------------- |
|
1106 // Read control's background info. |
|
1107 // --------------------------------------------------------------------------- |
|
1108 // |
|
1109 void CPeninputFingerHwrArWnd::ReadBackgroundInfoL( const TInt aResId ) |
|
1110 { |
|
1111 if ( aResId == 0 ) |
|
1112 return; |
|
1113 |
|
1114 if ( BackgroundBmp() ) |
|
1115 { |
|
1116 CFbsBitmap* bkBmp = BackgroundBmp(); |
|
1117 delete bkBmp; |
|
1118 SetBackgroundBmp( NULL ); |
|
1119 } |
|
1120 if ( BkMaskBmp() ) |
|
1121 { |
|
1122 CFbsBitmap* bkMaskBmp = BkMaskBmp(); |
|
1123 delete bkMaskBmp; |
|
1124 SetBackgroundMaskBmp( NULL ); |
|
1125 } |
|
1126 |
|
1127 TResourceReader resReader; |
|
1128 CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId ); |
|
1129 |
|
1130 TPtrC bmpFileName = resReader.ReadTPtrC(); |
|
1131 TInt32 imgMajorSkinId = resReader.ReadInt32(); |
|
1132 |
|
1133 TAknsItemID id; |
|
1134 TInt skinitemid; |
|
1135 |
|
1136 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1137 const TInt16 bmpId = resReader.ReadInt16(); |
|
1138 const TInt16 bmpMskId = resReader.ReadInt16(); |
|
1139 skinitemid = resReader.ReadInt16(); |
|
1140 id.Set( TInt( imgMajorSkinId ), skinitemid ); |
|
1141 |
|
1142 if ( bmpId != KInvalidImg ) |
|
1143 { |
|
1144 CFbsBitmap* backgroundImg = NULL; |
|
1145 CFbsBitmap* backgroundMaskImg = NULL; |
|
1146 if ( bmpMskId != KInvalidImg ) |
|
1147 { |
|
1148 AknsUtils::CreateIconL( skininstance, id, backgroundImg, |
|
1149 backgroundMaskImg, bmpFileName, bmpId, bmpMskId ); |
|
1150 } |
|
1151 else |
|
1152 { |
|
1153 AknsUtils::CreateIconL( skininstance, id, backgroundImg, |
|
1154 bmpFileName, bmpId ); |
|
1155 } |
|
1156 |
|
1157 SetBackgroundBmp( backgroundImg ); |
|
1158 SetBackgroundMaskBmp( backgroundMaskImg ); |
|
1159 } |
|
1160 CleanupStack::PopAndDestroy( 1 ); //reader |
|
1161 } |
|
1162 |
|
1163 // --------------------------------------------------------------------------- |
|
1164 // read icf appearance info. |
|
1165 // --------------------------------------------------------------------------- |
|
1166 // |
|
1167 void CPeninputFingerHwrArWnd::ReadICFInfoL( const TInt aResId ) |
|
1168 { |
|
1169 if ( aResId == 0 ) |
|
1170 { |
|
1171 return; |
|
1172 } |
|
1173 |
|
1174 TResourceReader icfreader; |
|
1175 CCoeEnv::Static()->CreateResourceReaderLC( icfreader, aResId ); |
|
1176 |
|
1177 TInt32 colorMajorSkinId = icfreader.ReadInt32(); |
|
1178 TInt skinitemid = icfreader.ReadInt16(); |
|
1179 TInt coloridx = icfreader.ReadInt16(); |
|
1180 |
|
1181 TAknsItemID colorid; |
|
1182 colorid.Set( TInt( colorMajorSkinId ), skinitemid ); |
|
1183 |
|
1184 TRgb icftextcolor; |
|
1185 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1186 TInt error = AknsUtils::GetCachedColor( skininstance, icftextcolor, |
|
1187 colorid, coloridx ); |
|
1188 |
|
1189 if ( error != KErrNone ) |
|
1190 { |
|
1191 icftextcolor = TRgb( KDefaultTextColor ); |
|
1192 } |
|
1193 |
|
1194 iContextField->SetTextColorL( icftextcolor ); |
|
1195 |
|
1196 // Set highlight color |
|
1197 TRgb icfhightlightcolor; |
|
1198 error = AknsUtils::GetCachedColor( skininstance, |
|
1199 icfhightlightcolor, |
|
1200 KAknsIIDQsnHighlightColors, |
|
1201 EAknsCIQsnHighlightColorsCG2 ); |
|
1202 if ( error == KErrNone ) |
|
1203 { |
|
1204 iContextField->SetTextSelColorL( icfhightlightcolor ); |
|
1205 } |
|
1206 |
|
1207 skinitemid = icfreader.ReadInt16(); |
|
1208 coloridx = icfreader.ReadInt16(); |
|
1209 |
|
1210 colorid.Set( TInt( colorMajorSkinId ), skinitemid ); |
|
1211 |
|
1212 TRgb icfframecolor; |
|
1213 error = AknsUtils::GetCachedColor( skininstance, icfframecolor, |
|
1214 colorid, coloridx ); |
|
1215 |
|
1216 if ( error != KErrNone ) |
|
1217 { |
|
1218 icfframecolor = TRgb( KDefaultFrameColor ); |
|
1219 } |
|
1220 |
|
1221 iContextField->SetBorderColor( icfframecolor ); |
|
1222 iContextField->SetBgImgSkinId( KAknsIIDQsnFrCall2Rect ); |
|
1223 CleanupStack::PopAndDestroy( 1 ); // icfreader |
|
1224 } |
|
1225 |
|
1226 // --------------------------------------------------------------------------- |
|
1227 // read writingbox appearance info. |
|
1228 // --------------------------------------------------------------------------- |
|
1229 // |
|
1230 void CPeninputFingerHwrArWnd::ReadWritingBoxInfoL( const TInt aResId ) |
|
1231 { |
|
1232 if ( aResId == 0 ) |
|
1233 { |
|
1234 return; |
|
1235 } |
|
1236 |
|
1237 TResourceReader reader; |
|
1238 CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); |
|
1239 |
|
1240 // get write box bg color |
|
1241 TInt32 colorMajorSkinId = reader.ReadInt32(); |
|
1242 TInt skinitemid = reader.ReadInt16(); |
|
1243 TInt coloridx = reader.ReadInt16(); |
|
1244 |
|
1245 TAknsItemID colorid; |
|
1246 colorid.Set( TInt( colorMajorSkinId ), skinitemid ); |
|
1247 |
|
1248 TRgb boxcolor; |
|
1249 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1250 TInt error = AknsUtils::GetCachedColor( skininstance, |
|
1251 boxcolor, |
|
1252 colorid, |
|
1253 coloridx ); |
|
1254 |
|
1255 if ( error != KErrNone ) |
|
1256 { |
|
1257 boxcolor = TRgb( KDefaultWriteBoxBgColor ); |
|
1258 } |
|
1259 |
|
1260 iWritingBox->SetBkColor( boxcolor ); |
|
1261 |
|
1262 skinitemid = reader.ReadInt16(); |
|
1263 coloridx = reader.ReadInt16(); |
|
1264 |
|
1265 colorid.Set( TInt( colorMajorSkinId ), skinitemid ); |
|
1266 |
|
1267 TRgb boxframecolor; |
|
1268 error = AknsUtils::GetCachedColor( skininstance, |
|
1269 boxframecolor, |
|
1270 colorid, |
|
1271 coloridx ); |
|
1272 |
|
1273 if ( error != KErrNone ) |
|
1274 { |
|
1275 boxframecolor = TRgb( KDefaultWriteBoxFrameColor ); |
|
1276 } |
|
1277 |
|
1278 iWritingBox->SetFrameCol( boxframecolor ); |
|
1279 |
|
1280 CleanupStack::PopAndDestroy(); // reader |
|
1281 } |
|
1282 |
|
1283 // --------------------------------------------------------------------------- |
|
1284 // update feedback state of all virtual keys. |
|
1285 // --------------------------------------------------------------------------- |
|
1286 // |
|
1287 void CPeninputFingerHwrArWnd::UpdateAllVirtualKeysFeedback( TInt aType ) |
|
1288 { |
|
1289 iSymbolTable->UpdateAllVirtualKeysFeedback(aType); |
|
1290 } |
|
1291 |
|
1292 // --------------------------------------------------------------------------- |
|
1293 // show bublble or not |
|
1294 // --------------------------------------------------------------------------- |
|
1295 // |
|
1296 void CPeninputFingerHwrArWnd::ShowBubble(TInt aShow) |
|
1297 { |
|
1298 if (aShow > 0) |
|
1299 { |
|
1300 TRect outrect,innerrect; |
|
1301 iCandidateList->ShowBubble(ETrue); |
|
1302 |
|
1303 // Set priview popup size |
|
1304 iCandidateList->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); |
|
1305 |
|
1306 outrect = iLafManager->PreviewBubbleRect(); |
|
1307 innerrect = iLafManager->PreviewBubbleInnerRect(); |
|
1308 iCandidateList->SetTextFormat(iLafManager->PreviewBubbleTextLayout()); |
|
1309 iCandidateList->SetBubbleTextFont(iLafManager->PreviewBubbleFont()); |
|
1310 iCandidateList->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
1311 iCandidateList->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
1312 innerrect.iTl.iY - outrect.iTl.iY, |
|
1313 outrect.iBr.iX - innerrect.iBr.iX, |
|
1314 outrect.iBr.iY - innerrect.iBr.iY); |
|
1315 |
|
1316 iNumCandidateList->ShowBubble(ETrue); |
|
1317 |
|
1318 // Set priview popup size |
|
1319 iNumCandidateList->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); |
|
1320 iNumCandidateList->SetTextFormat(iLafManager->PreviewBubbleTextLayout()); |
|
1321 iNumCandidateList->SetBubbleTextFont(iLafManager->PreviewBubbleFont()); |
|
1322 iNumCandidateList->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf |
|
1323 iNumCandidateList->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, |
|
1324 innerrect.iTl.iY - outrect.iTl.iY, |
|
1325 outrect.iBr.iX - innerrect.iBr.iX, |
|
1326 outrect.iBr.iY - innerrect.iBr.iY); |
|
1327 |
|
1328 } |
|
1329 else |
|
1330 { |
|
1331 iCandidateList->ShowBubble(EFalse); |
|
1332 iNumCandidateList->ShowBubble(EFalse); |
|
1333 } |
|
1334 } |
|
1335 |
|
1336 // -------------------------------------------------------------------------- |
|
1337 // CPeninputHwrBxAbWnd::CalculateGuideLinePos |
|
1338 // (other items were commented in a header) |
|
1339 // -------------------------------------------------------------------------- |
|
1340 // |
|
1341 void CPeninputFingerHwrArWnd::CalculateGuideLinePos() |
|
1342 { |
|
1343 TRect rect = iWritingBox->Rect(); |
|
1344 TInt leftrightmargin = rect.Size().iWidth / 10; |
|
1345 |
|
1346 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
|
1347 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
|
1348 |
|
1349 TInt bottommargin = 0; |
|
1350 hwrLayout->DataStore().GetBottomGuideLinePos(bottommargin); |
|
1351 |
|
1352 iGuideLineBottomTl.iX = rect.iTl.iX + leftrightmargin; |
|
1353 iGuideLineBottomTl.iY = rect.iTl.iY + bottommargin; |
|
1354 |
|
1355 iGuideLineBottomBr.iX = rect.iBr.iX - leftrightmargin; |
|
1356 iGuideLineBottomBr.iY = rect.iTl.iY + bottommargin; |
|
1357 } |
|
1358 |
|
1359 // -------------------------------------------------------------------------- |
|
1360 // CPeninputFingerHwrArWnd::DrawGuideLine |
|
1361 // (other items were commented in a header) |
|
1362 // -------------------------------------------------------------------------- |
|
1363 // |
|
1364 void CPeninputFingerHwrArWnd::DrawGuideLine() |
|
1365 { |
|
1366 if(iGuideLineOn) |
|
1367 { |
|
1368 iWritingBox->HideGuideLine(ETrue); |
|
1369 } |
|
1370 else |
|
1371 { |
|
1372 TInt style = CTransparentHwrWndExt::EGuideLineBottom; |
|
1373 iWritingBox->SetGuideLineStyle( style ); |
|
1374 |
|
1375 // if size changing, or guide line pos has not been set |
|
1376 CalculateGuideLinePos(); |
|
1377 |
|
1378 iWritingBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr); |
|
1379 |
|
1380 iWritingBox->RefreshUI(); |
|
1381 } |
|
1382 } |
|
1383 |
|
1384 // -------------------------------------------------------------------------- |
|
1385 // CPeninputFingerHwrArWnd::OpenSymbolTable |
|
1386 // Open the symbol table |
|
1387 // -------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CPeninputFingerHwrArWnd::OpenSymbolTable() |
|
1390 { |
|
1391 if(!iSymbolTable->IsPopup()) |
|
1392 { |
|
1393 SwitchToSymbolTableView(); |
|
1394 } |
|
1395 } |
|
1396 |
|
1397 // -------------------------------------------------------------------------- |
|
1398 // CPeninputFingerHwrArWnd::CloseSymbolTable |
|
1399 // Close the symbol table |
|
1400 // -------------------------------------------------------------------------- |
|
1401 // |
|
1402 void CPeninputFingerHwrArWnd::CloseSymbolTable() |
|
1403 { |
|
1404 if(iSymbolTable->IsPopup()) |
|
1405 { |
|
1406 iSymbolTable->CloseSymbolTable(); |
|
1407 SwitchToStandbyView(); |
|
1408 } |
|
1409 } |
|
1410 |
|
1411 // -------------------------------------------------------------------------- |
|
1412 // CPeninputFingerHwrArWnd::IsSymbolTableShowingUp |
|
1413 // Check if the symbol table has been shown up |
|
1414 // -------------------------------------------------------------------------- |
|
1415 // |
|
1416 TBool CPeninputFingerHwrArWnd::IsSymbolTableShowingUp() |
|
1417 { |
|
1418 return iSymbolTable->IsPopup(); |
|
1419 } |
|
1420 |
|
1421 // -------------------------------------------------------------------------- |
|
1422 // CPeninputFingerHwrArWnd::IsCandidateShowup |
|
1423 // Check if the candadiate list has been shown up |
|
1424 // -------------------------------------------------------------------------- |
|
1425 // |
|
1426 TBool CPeninputFingerHwrArWnd::IsCandidateShowup() |
|
1427 { |
|
1428 if(!iCandidateList->Hiden() || !iNumCandidateList->Hiden()) |
|
1429 { |
|
1430 return ETrue; |
|
1431 } |
|
1432 return EFalse; |
|
1433 } |
|
1434 |
|
1435 // -------------------------------------------------------------------------- |
|
1436 // CPeninputFingerHwrArWnd::IsCandidateShowup |
|
1437 // Check if the candadiate list has been shown up |
|
1438 // -------------------------------------------------------------------------- |
|
1439 // |
|
1440 void CPeninputFingerHwrArWnd::HideIndicator() |
|
1441 { |
|
1442 if(!iHandwritingIndicator->Hiden()) |
|
1443 { |
|
1444 iHandwritingIndicator->Hide(ETrue); |
|
1445 Draw(); |
|
1446 } |
|
1447 } |
|
1448 |
|
1449 // -------------------------------------------------------------------------- |
|
1450 // CPeninputFingerHwrArWnd::GetCharBeforeCursor |
|
1451 // Get the char by its position in ICF editor |
|
1452 // -------------------------------------------------------------------------- |
|
1453 // |
|
1454 TBool CPeninputFingerHwrArWnd::GetCharBeforeCursor(TInt aCharPos, TUint16& aCharBeforeCursor) |
|
1455 { |
|
1456 TBuf<1> dataBeforeCursor; |
|
1457 iContextField->ExtractText( dataBeforeCursor, aCharPos, 1 ); |
|
1458 if(dataBeforeCursor!= KNullDesC) |
|
1459 { |
|
1460 aCharBeforeCursor = dataBeforeCursor[0]; |
|
1461 return ETrue; |
|
1462 } |
|
1463 else |
|
1464 { |
|
1465 return EFalse; |
|
1466 } |
|
1467 } |
|
1468 |
|
1469 // End Of File |