branch | RCL_3 |
changeset 56 | 8152b1f1763a |
parent 50 | 5a1685599b76 |
50:5a1685599b76 | 56:8152b1f1763a |
---|---|
26 #include <aknlayoutscalable_apps.cdl.h> |
26 #include <aknlayoutscalable_apps.cdl.h> |
27 #include <aknlayoutscalable_avkon.cdl.h> |
27 #include <aknlayoutscalable_avkon.cdl.h> |
28 #include <AknLayoutDef.h> |
28 #include <AknLayoutDef.h> |
29 #include <AknUtils.h> |
29 #include <AknUtils.h> |
30 #include <AknsUtils.h> |
30 #include <AknsUtils.h> |
31 #include <AknIconUtils.h> |
31 #include <akniconutils.h> |
32 #include <aknfeppeninputenums.h> |
32 #include <aknfeppeninputenums.h> |
33 #include <AknFepGlobalEnums.h> |
33 #include <AknFepGlobalEnums.h> |
34 |
34 |
35 #include <peninputlayout.h> |
35 #include <peninputlayout.h> |
36 #include <peninputrepeatbutton.h> |
36 #include <peninputrepeatbutton.h> |
39 #include "peninputfingerhwrarevent.h" |
39 #include "peninputfingerhwrarevent.h" |
40 #include "peninputfingerhwrarcontrolid.h" |
40 #include "peninputfingerhwrarcontrolid.h" |
41 #include "peninputfingerhwrarstoreconstants.h" |
41 #include "peninputfingerhwrarstoreconstants.h" |
42 #include "peninputfingerhwrarmultipagevkb.h" |
42 #include "peninputfingerhwrarmultipagevkb.h" |
43 #include "peninputfingerhwrarsymboltable.h" |
43 #include "peninputfingerhwrarsymboltable.h" |
44 #include "peninputfingerhwarvkbutility.h" |
44 |
45 |
45 |
46 //CONST DEFINATION |
46 //CONST DEFINATION |
47 const TInt KSymbolButtonInnerPadding = 6; |
47 const TInt KSymbolButtonInnerPadding = 6; |
48 |
48 |
49 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
214 // --------------------------------------------------------------------------- |
214 // --------------------------------------------------------------------------- |
215 // SizeChanged |
215 // SizeChanged |
216 // --------------------------------------------------------------------------- |
216 // --------------------------------------------------------------------------- |
217 // |
217 // |
218 void CPeninputArabicFingerHwrSymbolTable::SizeChanged( |
218 void CPeninputArabicFingerHwrSymbolTable::SizeChanged( |
219 const TRect aVirtualKeypadRect, const RArray<TRect> & aBtnRects, |
219 const TRect aVirtualKeypadRect, const RArray<TRect> aBtnRects, |
220 const TInt aKeypadRow, const TInt aKeypadCol, TBool aIsLandscape) |
220 const TInt aKeypadRow, const TInt aKeypadCol, TBool aIsLandscape) |
221 { |
221 { |
222 ASSERT(aBtnRects.Count() > 0); |
|
223 |
|
224 iIsLandscape = aIsLandscape; |
222 iIsLandscape = aIsLandscape; |
225 |
223 |
226 // relayout the button |
224 // relayout the button |
227 TRect pageBtnRect = aBtnRects[0]; |
225 TRect pageBtnRect(aBtnRects[0]); |
228 |
226 |
229 if(aIsLandscape) |
227 if(aIsLandscape) |
230 { |
228 { |
231 i2Page1Btn->Hide(EFalse); |
229 i2Page1Btn->Hide(EFalse); |
232 i2Page2Btn->Hide(EFalse); |
230 i2Page2Btn->Hide(EFalse); |
233 |
231 |
253 // relayout the virtual key pad |
251 // relayout the virtual key pad |
254 iMutiPageKeypad->SetRect(aVirtualKeypadRect); |
252 iMutiPageKeypad->SetRect(aVirtualKeypadRect); |
255 |
253 |
256 iMutiPageKeypad->UpdatePaging(aKeypadRow,aKeypadCol); |
254 iMutiPageKeypad->UpdatePaging(aKeypadRow,aKeypadCol); |
257 } |
255 } |
258 |
256 |
259 // --------------------------------------------------------------------------- |
257 // --------------------------------------------------------------------------- |
260 // create symbol table keypad. |
258 // create symbol table keypad. |
261 // --------------------------------------------------------------------------- |
259 // --------------------------------------------------------------------------- |
262 // |
260 // |
263 void CPeninputArabicFingerHwrSymbolTable::CreateVirtualKeypadL() |
261 void CPeninputArabicFingerHwrSymbolTable::CreateVirtualKeypadL() |
330 TRect rcInner = aRect; |
328 TRect rcInner = aRect; |
331 rcInner.Shrink( aXPadding, aYPadding ); |
329 rcInner.Shrink( aXPadding, aYPadding ); |
332 aButton->SizeChanged( aRect, rcInner, aReloadImages ); |
330 aButton->SizeChanged( aRect, rcInner, aReloadImages ); |
333 } |
331 } |
334 |
332 |
333 void CPeninputArabicFingerHwrSymbolTable::OnActivate() |
|
334 { |
|
335 CControlGroup::OnActivate(); |
|
336 } |
|
337 |
|
335 // --------------------------------------------------------------------------- |
338 // --------------------------------------------------------------------------- |
336 // Read control's background info. |
339 // Read control's background info. |
337 // --------------------------------------------------------------------------- |
340 // --------------------------------------------------------------------------- |
338 // |
341 // |
339 void CPeninputArabicFingerHwrSymbolTable::ConstructFromResourceL() |
342 void CPeninputArabicFingerHwrSymbolTable::ConstructFromResourceL() |
417 // Load virtual keys image |
420 // Load virtual keys image |
418 // --------------------------------------------------------------------------- |
421 // --------------------------------------------------------------------------- |
419 // |
422 // |
420 void CPeninputArabicFingerHwrSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize) |
423 void CPeninputArabicFingerHwrSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize) |
421 { |
424 { |
422 PeninputFingerHwrArVkbUtility::LoadVkbKeyImageL(*iMutiPageKeypad,aResId,aKeySize); |
425 TResourceReader reader; |
426 CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); |
|
427 |
|
428 TPtrC bmpFileName = reader.ReadTPtrC(); |
|
429 TInt32 imgMajorSkinId = reader.ReadInt32(); |
|
430 TAknsItemID id; |
|
431 |
|
432 TSize keySize = aKeySize; |
|
433 |
|
434 for ( TInt index = 0; index <= EKeyBmpLastType ; index += 2 ) |
|
435 { |
|
436 // Get the image ids and mask ids from resource |
|
437 TInt bmpId = reader.ReadInt16(); |
|
438 TInt bmpMskId = reader.ReadInt16(); |
|
439 |
|
440 // read skin item id |
|
441 const TInt skinitemid = reader.ReadInt16(); |
|
442 id.Set( TInt( imgMajorSkinId ), skinitemid ); |
|
443 |
|
444 if ( bmpId != KInvalidImg ) |
|
445 { |
|
446 CFbsBitmap* bmp = NULL; |
|
447 CFbsBitmap* maskbmp = NULL; |
|
448 |
|
449 if ( bmpMskId != KInvalidImg ) |
|
450 { |
|
451 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), |
|
452 id, bmp, maskbmp, bmpFileName, bmpId, bmpMskId ); |
|
453 |
|
454 // set maskbmp and size |
|
455 AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved ); |
|
456 iMutiPageKeypad->SetNonIrregularKeyBitmapL( |
|
457 TVirtualKeyBmpType( EKeyBmpNormal + index + 1 ), maskbmp ); |
|
458 } |
|
459 else |
|
460 { |
|
461 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id, |
|
462 bmp, bmpFileName, bmpId ); |
|
463 } |
|
464 // set bmp and size |
|
465 AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved ); |
|
466 iMutiPageKeypad->SetNonIrregularKeyBitmapL( |
|
467 TVirtualKeyBmpType( EKeyBmpNormal + index ), bmp ); |
|
468 } |
|
469 } |
|
470 // Pop and destroy reader |
|
471 CleanupStack::PopAndDestroy( 1 ); |
|
423 } |
472 } |
424 |
473 |
425 // --------------------------------------------------------------------------- |
474 // --------------------------------------------------------------------------- |
426 // Load virtual keys |
475 // Load virtual keys |
427 // --------------------------------------------------------------------------- |
476 // --------------------------------------------------------------------------- |
428 // |
477 // |
429 void CPeninputArabicFingerHwrSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects) |
478 void CPeninputArabicFingerHwrSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects) |
430 { |
479 { |
431 PeninputFingerHwrArVkbUtility::LoadVirtualKeypadKeyL(*iMutiPageKeypad,aResId,aCellRects); |
480 iMutiPageKeypad->SetResourceId(aResId); |
481 |
|
482 TResourceReader reader; |
|
483 CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); |
|
484 |
|
485 // construct keys |
|
486 TInt resKeyCount = reader.ReadInt16(); |
|
487 TInt existsKeyCount = iMutiPageKeypad->KeyArray().Count(); |
|
488 TInt rectCount = aCellRects.Count(); |
|
489 |
|
490 for ( TInt i = 0; i < resKeyCount; i++ ) |
|
491 { |
|
492 if ( i < existsKeyCount ) |
|
493 { |
|
494 CVirtualKey* vk = iMutiPageKeypad->KeyArray()[i]; |
|
495 UpdateVkbKeyL( vk, reader, aCellRects[i%rectCount] ); |
|
496 } |
|
497 else |
|
498 { |
|
499 CVirtualKey* vk = CreateVkbKeyL( reader, aCellRects[i%rectCount] ); |
|
500 CleanupStack::PushL( vk ); |
|
501 iMutiPageKeypad->AddKeyL( vk ); |
|
502 |
|
503 CleanupStack::Pop( vk ); |
|
504 } |
|
505 } |
|
506 |
|
507 CleanupStack::PopAndDestroy( 1 ); // reader |
|
508 |
|
509 iMutiPageKeypad->Draw(); |
|
510 iMutiPageKeypad->UpdateArea( iMutiPageKeypad->Rect() ); |
|
432 } |
511 } |
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // create virtual key. |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 CVirtualKey* CPeninputArabicFingerHwrSymbolTable::CreateVkbKeyL( TResourceReader& aReader, |
|
518 const TRect aKeyRect ) |
|
519 { |
|
520 CHBufCArray* keytexts = CHBufCArray::NewL(); |
|
521 CleanupStack::PushL( keytexts ); |
|
522 |
|
523 for ( TInt i = 0; i <= EPosLast; i++ ) |
|
524 { |
|
525 HBufC* unicode = aReader.ReadHBufCL(); |
|
526 keytexts->Array().AppendL( unicode ); |
|
527 } |
|
528 |
|
529 TInt keyscancode = aReader.ReadInt16(); |
|
530 |
|
531 HBufC* text = keytexts->Array()[0]; |
|
532 |
|
533 CVirtualKey* vk = NULL; |
|
534 if ( text ) |
|
535 { |
|
536 vk = CVirtualKey::NewL( *text, keyscancode, aKeyRect, aKeyRect, 0 ); |
|
537 } |
|
538 else |
|
539 { |
|
540 vk = CVirtualKey::NewL( KNullDesC, keyscancode, aKeyRect, aKeyRect, 0 ); |
|
541 } |
|
542 |
|
543 CleanupStack::PopAndDestroy( keytexts ); //keytexts |
|
544 |
|
545 |
|
546 TRect innerrect = aKeyRect; |
|
547 innerrect.Shrink( TSize(2, 2) ); |
|
548 vk->SetInnerRect( innerrect ); |
|
549 |
|
550 return vk; |
|
551 } |
|
552 |
|
553 // --------------------------------------------------------------------------- |
|
554 // update virtual key info. |
|
555 // --------------------------------------------------------------------------- |
|
556 // |
|
557 void CPeninputArabicFingerHwrSymbolTable::UpdateVkbKeyL( CVirtualKey* aVirtualKey, |
|
558 TResourceReader& aReader, const TRect aKeyRect ) |
|
559 { |
|
560 CHBufCArray* keytexts = CHBufCArray::NewL(); |
|
561 CleanupStack::PushL( keytexts ); |
|
562 |
|
563 for ( TInt i = 0; i <= EPosLast; i++ ) |
|
564 { |
|
565 HBufC* unicode = aReader.ReadHBufCL(); |
|
566 keytexts->Array().AppendL( unicode ); |
|
567 } |
|
568 |
|
569 TInt keyscancode = aReader.ReadInt16(); |
|
570 |
|
571 HBufC* text = keytexts->Array()[0]; |
|
572 if ( text ) |
|
573 { |
|
574 aVirtualKey->SetKeyData( *text ); |
|
575 } |
|
576 else |
|
577 { |
|
578 aVirtualKey->SetKeyData( KNullDesC ); |
|
579 } |
|
580 |
|
581 aVirtualKey->SetKeyScancode( keyscancode ); |
|
582 |
|
583 CleanupStack::PopAndDestroy( keytexts ); //keytexts |
|
584 |
|
585 aVirtualKey->SetRect(aKeyRect); |
|
586 TRect innerrect = aKeyRect; |
|
587 innerrect.Shrink( TSize(2,2) ); |
|
588 aVirtualKey->SetInnerRect( innerrect ); |
|
589 } |
|
433 |
590 |
434 // --------------------------------------------------------------------------- |
591 // --------------------------------------------------------------------------- |
435 // Navigate the symbol page |
592 // Navigate the symbol page |
436 // --------------------------------------------------------------------------- |
593 // --------------------------------------------------------------------------- |
437 // |
594 // |
532 // |
689 // |
533 void CPeninputArabicFingerHwrSymbolTable::Draw() |
690 void CPeninputArabicFingerHwrSymbolTable::Draw() |
534 { |
691 { |
535 if(AbleToDraw()) |
692 if(AbleToDraw()) |
536 { |
693 { |
694 //Draw button area background. |
|
695 // DrawOpaqueMaskBackground( Rect() ); |
|
696 // DrawOpaqueMaskBackground(); |
|
537 DrawOpaqueMaskBackground(iMutiPageKeypad->Rect()); |
697 DrawOpaqueMaskBackground(iMutiPageKeypad->Rect()); |
538 if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() ) |
698 if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() ) |
539 { |
699 { |
540 AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved); |
700 AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved); |
541 } |
701 } |
542 // draw background |
702 // draw background |
703 // DrawBackground(); |
|
543 DrawBackground(iMutiPageKeypad->Rect()); |
704 DrawBackground(iMutiPageKeypad->Rect()); |
544 |
|
545 // draw group |
705 // draw group |
546 CControlGroup::Draw(); |
706 CControlGroup::Draw(); |
547 |
707 |
548 // bitblt the new content to screen |
708 // bitblt the new content to screen |
549 UpdateArea(iRect); |
709 UpdateArea(iRect); |