textinput/peninputfingerhwrar/src/peninputfingerhwrarnumsymboltable.cpp
branchRCL_3
changeset 12 5e18d8c489d6
child 19 ac7e4d1d9209
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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 symbol table.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE
       
    20 #include <peninputfingerhwrarwnd.rsg>
       
    21 
       
    22 #include <coemain.h>
       
    23 #include <s32mem.h>
       
    24 #include <barsread.h>
       
    25 
       
    26 #include <aknlayoutscalable_apps.cdl.h>
       
    27 #include <aknlayoutscalable_avkon.cdl.h>
       
    28 #include <AknLayoutDef.h>
       
    29 #include <AknUtils.h>
       
    30 #include <AknsUtils.h>
       
    31 #include <akniconutils.h>
       
    32 #include <aknfeppeninputenums.h>
       
    33 #include <AknFepGlobalEnums.h>
       
    34 
       
    35 #include <peninputlayout.h>
       
    36 #include <peninputrepeatbutton.h>
       
    37 
       
    38 #include "hbufcarrayar.h"
       
    39 #include "peninputfingerhwrarevent.h"
       
    40 #include "peninputfingerhwrarcontrolid.h"
       
    41 #include "peninputfingerhwrarstoreconstants.h"
       
    42 #include "peninputlayoutvkb.h"
       
    43 #include "peninputfingerhwrarnumsymboltable.h"
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // Symbian Constructor
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CPeninputArabicFingerHwrNumSymbolTable* CPeninputArabicFingerHwrNumSymbolTable::NewL( 
       
    51     CFepUiLayout* aUiLayout, TInt aId )
       
    52     {
       
    53     CPeninputArabicFingerHwrNumSymbolTable* self = CPeninputArabicFingerHwrNumSymbolTable::NewLC( 
       
    54             aUiLayout, aId );
       
    55     
       
    56     CleanupStack::Pop( self ); // self;
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // Symbian Constructor
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CPeninputArabicFingerHwrNumSymbolTable* CPeninputArabicFingerHwrNumSymbolTable::NewLC( 
       
    65     CFepUiLayout* aUiLayout, TInt aId )
       
    66     {
       
    67     CPeninputArabicFingerHwrNumSymbolTable* self = new (ELeave) CPeninputArabicFingerHwrNumSymbolTable( 
       
    68             aUiLayout, aId );
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL();
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // C++ constructor.
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 CPeninputArabicFingerHwrNumSymbolTable::CPeninputArabicFingerHwrNumSymbolTable( 
       
    79     CFepUiLayout* aFepUiLayout, TInt aControlId )
       
    80     : CControlGroup( aFepUiLayout, aControlId ),iIsNativeNumMode(EFalse)
       
    81     {
       
    82 	SetControlType(ECtrlControlGroup|ECtrlTactileFeedback);
       
    83 	SetTactileFeedbackType(ETouchFeedbackSensitiveInput);
       
    84     }
       
    85 	
       
    86 // ---------------------------------------------------------------------------
       
    87 // c++ destructor
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 CPeninputArabicFingerHwrNumSymbolTable::~CPeninputArabicFingerHwrNumSymbolTable()
       
    91     {
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // popup the list.
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void CPeninputArabicFingerHwrNumSymbolTable::OpenSymbolTable()
       
    99     {
       
   100     CapturePointer( ETrue );
       
   101     iPopupVisible = ETrue; 
       
   102     iCurrentNumSCTType = ENumSCTLatin;
       
   103 	UiLayout()->LockArea(UiLayout()->Rect(),this);  
       
   104     UpdateNumSymbolTable(ENumSCTLatin);
       
   105 	}
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // cancel the popup.
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CPeninputArabicFingerHwrNumSymbolTable::CloseSymbolTable()
       
   112     {
       
   113     CapturePointer( EFalse );
       
   114     iPopupVisible = EFalse;
       
   115     UiLayout()->UnLockArea(UiLayout()->Rect(),this);
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // get visibility of popup.
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TBool CPeninputArabicFingerHwrNumSymbolTable::IsPopup()
       
   123     {
       
   124     return iPopupVisible;
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // Handle pointer down event.
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerDownEventL(
       
   132     const TPoint& aPoint )
       
   133     {
       
   134     CancelPointerDownL();
       
   135     CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerDownEventL( aPoint );
       
   136 	
       
   137     if(!ctrl)
       
   138 	   {
       
   139 	   ReportEvent(EHwrEventOutsideEvent);
       
   140 	   }
       
   141 	else
       
   142        {
       
   143 	    #ifdef RD_TACTILE_FEEDBACK
       
   144         if (UiLayout()->SupportTactileFeedback())
       
   145             {
       
   146             UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput);
       
   147             }
       
   148         #endif //RD_TACTILE_FEEDBACK
       
   149 	   ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   150 	   }	
       
   151 	   
       
   152     return ctrl;
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // Handle pointer up event.
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerUpEventL(
       
   160     const TPoint& aPoint )
       
   161     {
       
   162     CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerUpEventL( aPoint );
       
   163 
       
   164     if(ctrl)
       
   165 	   {
       
   166 	   ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   167 	   }
       
   168 
       
   169 	return ctrl;
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // Handle pointer move event.
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerMoveEventL(
       
   177     const TPoint& aPoint )
       
   178     {
       
   179 	CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerMoveEventL( aPoint );
       
   180 	if(ctrl)
       
   181 	    {
       
   182 		HandlePointerEnter(aPoint);
       
   183 		ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   184 		}
       
   185 	else
       
   186 	    {
       
   187 	    HandlePointerLeave(aPoint);
       
   188 	    UpdateArea(iRect,EFalse);
       
   189 	    }
       
   190 	
       
   191     return ctrl;
       
   192     }
       
   193     
       
   194 // ---------------------------------------------------------------------------
       
   195 // Symbian second-phase constructor.
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 void CPeninputArabicFingerHwrNumSymbolTable::ConstructL()
       
   199     {
       
   200     BaseConstructL(); 
       
   201 	
       
   202     // disable border
       
   203     SetBorderSize( TSize(0,0) );
       
   204     
       
   205 	// construct virtual keypad
       
   206 	CreateVirtualKeypadL();
       
   207     }
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 // SizeChanged
       
   211 // ---------------------------------------------------------------------------
       
   212 //	
       
   213 void CPeninputArabicFingerHwrNumSymbolTable::SizeChanged(
       
   214                      const TRect aVirtualKeypadRect, const RArray<TRect> /*aBtnRects*/,
       
   215                      const TInt /*aKeypadRow*/, const TInt /*aKeypadCol*/, TBool aIsLandscape)
       
   216     {
       
   217 	iIsLandscape = aIsLandscape;
       
   218 	
       
   219 	// relayout the virtual key pad
       
   220 	iNumKeypad->SetRect(aVirtualKeypadRect);
       
   221 	
       
   222 	}
       
   223 	
       
   224 // ---------------------------------------------------------------------------
       
   225 // create symbol table keypad.
       
   226 // ---------------------------------------------------------------------------
       
   227 //
       
   228 void CPeninputArabicFingerHwrNumSymbolTable::CreateVirtualKeypadL()
       
   229     {
       
   230     TFontSpec spec;
       
   231 
       
   232     iNumKeypad = CVirtualKeyboard::NewL( 
       
   233         TRect(0,0,0,0),
       
   234         UiLayout(),
       
   235         EHwrCtrlIdNumSymbolTableVkb,
       
   236         spec );
       
   237 
       
   238     AddControlL( iNumKeypad );
       
   239     iNumKeypad->AddEventObserver( UiLayout() );
       
   240     
       
   241 	iNumKeypad->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
       
   242     iNumKeypad->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
       
   243     iNumKeypad->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
       
   244     iNumKeypad->SetResourceId( KInvalidResId );
       
   245         
       
   246     iNumKeypad->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 );
       
   247     iNumKeypad->SetDrawOpaqueBackground( EFalse );    
       
   248     }
       
   249 
       
   250 void CPeninputArabicFingerHwrNumSymbolTable::OnActivate()
       
   251     {
       
   252     CControlGroup::OnActivate();
       
   253 	}
       
   254 
       
   255 // ---------------------------------------------------------------------------
       
   256 //  Read control's background info.
       
   257 // ---------------------------------------------------------------------------
       
   258 //	
       
   259 void CPeninputArabicFingerHwrNumSymbolTable::ConstructFromResourceL()
       
   260     {
       
   261 	if ( iResourceId == KInvalidResId )
       
   262         {
       
   263         User::Leave( KErrArgument );
       
   264         }
       
   265     
       
   266     TResourceReader reader;
       
   267     CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
       
   268     
       
   269 	const TInt32 bgImageResId = reader.ReadInt32();
       
   270 	LoadBackgroundFromResourceL(bgImageResId);
       
   271 	
       
   272 	CleanupStack::PopAndDestroy( 1 ); //reader
       
   273 	
       
   274 	
       
   275 	CControlGroup::ConstructFromResourceL();
       
   276 	}
       
   277 	
       
   278 // ---------------------------------------------------------------------------
       
   279 //  Read control's background info.
       
   280 // ---------------------------------------------------------------------------
       
   281 //
       
   282 void CPeninputArabicFingerHwrNumSymbolTable::LoadBackgroundFromResourceL( const TInt aResId )
       
   283     {
       
   284     if ( aResId == 0 )
       
   285         return;
       
   286     
       
   287     if ( BackgroundBmp() )
       
   288         {
       
   289         CFbsBitmap* bkBmp = BackgroundBmp();
       
   290         delete bkBmp;   
       
   291         SetBackgroundBmp( NULL );
       
   292         }
       
   293     if ( BkMaskBmp() )
       
   294         {
       
   295         CFbsBitmap* bkMaskBmp = BkMaskBmp();
       
   296         delete bkMaskBmp;
       
   297         SetBackgroundMaskBmp( NULL );
       
   298         }    
       
   299 
       
   300     TResourceReader resReader;
       
   301     CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId ); 
       
   302      
       
   303     TPtrC bmpFileName = resReader.ReadTPtrC();
       
   304     TInt32 imgMajorSkinId = resReader.ReadInt32();
       
   305 
       
   306     TAknsItemID id;
       
   307     TInt skinitemid;
       
   308     
       
   309     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   310     const TInt16 bmpId = resReader.ReadInt16();
       
   311     const TInt16 bmpMskId = resReader.ReadInt16();
       
   312     skinitemid = resReader.ReadInt16();   
       
   313     id.Set( TInt( imgMajorSkinId ), skinitemid );
       
   314     
       
   315     if ( bmpId != KInvalidImg )
       
   316         {
       
   317         CFbsBitmap* backgroundImg = NULL;
       
   318         CFbsBitmap* backgroundMaskImg = NULL;
       
   319         if ( bmpMskId != KInvalidImg )
       
   320             {
       
   321             AknsUtils::CreateIconL( skininstance, id, backgroundImg,
       
   322                     backgroundMaskImg, bmpFileName, bmpId, bmpMskId );
       
   323             }
       
   324         else
       
   325             {
       
   326             AknsUtils::CreateIconL( skininstance, id, backgroundImg,
       
   327                     bmpFileName, bmpId );
       
   328             }
       
   329        
       
   330         SetBackgroundBmp( backgroundImg );
       
   331         SetBackgroundMaskBmp( backgroundMaskImg );           
       
   332         }
       
   333     CleanupStack::PopAndDestroy( 1 ); //reader
       
   334     }
       
   335 	
       
   336 // ---------------------------------------------------------------------------
       
   337 // Load virtual keys image
       
   338 // ---------------------------------------------------------------------------
       
   339 //	
       
   340 void CPeninputArabicFingerHwrNumSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize)
       
   341     {
       
   342 	TResourceReader reader;    
       
   343     CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );      
       
   344     
       
   345     TPtrC bmpFileName = reader.ReadTPtrC();
       
   346     TInt32 imgMajorSkinId = reader.ReadInt32();
       
   347     TAknsItemID id;
       
   348     
       
   349     TSize keySize = aKeySize;
       
   350     
       
   351     for ( TInt index = 0; index <= EKeyBmpLastType ; index += 2 )
       
   352         { 
       
   353         // Get the image ids and mask ids from resource
       
   354         TInt bmpId = reader.ReadInt16(); 
       
   355         TInt bmpMskId = reader.ReadInt16();
       
   356         
       
   357         // read skin item id
       
   358         const TInt skinitemid = reader.ReadInt16();
       
   359         id.Set( TInt( imgMajorSkinId ), skinitemid );
       
   360         
       
   361         if ( bmpId != KInvalidImg )
       
   362             {
       
   363             CFbsBitmap* bmp = NULL;
       
   364             CFbsBitmap* maskbmp = NULL;
       
   365 
       
   366             if ( bmpMskId != KInvalidImg )
       
   367                 {
       
   368                 AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
       
   369                    id, bmp, maskbmp, bmpFileName, bmpId, bmpMskId );
       
   370                 
       
   371                 // set maskbmp and size
       
   372                 AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved );
       
   373                 iNumKeypad->SetNonIrregularKeyBitmapL( 
       
   374                 TVirtualKeyBmpType( EKeyBmpNormal + index + 1 ), maskbmp );
       
   375                 }
       
   376             else
       
   377                 {
       
   378                 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id, 
       
   379                     bmp, bmpFileName, bmpId );
       
   380                 }
       
   381             // set bmp and size
       
   382             AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved );
       
   383             iNumKeypad->SetNonIrregularKeyBitmapL( 
       
   384                 TVirtualKeyBmpType( EKeyBmpNormal + index ), bmp );
       
   385             }       
       
   386         }
       
   387     // Pop and destroy reader
       
   388     CleanupStack::PopAndDestroy( 1 );        
       
   389 	}
       
   390 
       
   391 // ---------------------------------------------------------------------------
       
   392 // Load virtual keys
       
   393 // ---------------------------------------------------------------------------
       
   394 //	
       
   395 void CPeninputArabicFingerHwrNumSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects)
       
   396     {
       
   397 	iNumKeypad->SetResourceId(aResId);
       
   398 	
       
   399 	TResourceReader reader;
       
   400     CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
       
   401 
       
   402     // construct keys
       
   403     TInt resKeyCount = reader.ReadInt16();
       
   404     TInt existsKeyCount = iNumKeypad->KeyArray().Count();
       
   405     TInt rectCount = aCellRects.Count();
       
   406     
       
   407     for ( TInt i = 0; i < resKeyCount; i++ )
       
   408         {
       
   409         if ( i < existsKeyCount )
       
   410             {
       
   411             CVirtualKey* vk = iNumKeypad->KeyArray()[i];
       
   412             UpdateVkbKeyL( vk, reader, aCellRects[i%rectCount] );
       
   413             }
       
   414         else
       
   415             {
       
   416             CVirtualKey* vk = CreateVkbKeyL( reader, aCellRects[i%rectCount] );
       
   417             CleanupStack::PushL( vk );
       
   418             iNumKeypad->AddKeyL( vk );
       
   419             
       
   420             CleanupStack::Pop( vk );
       
   421             }
       
   422         }
       
   423     
       
   424     CleanupStack::PopAndDestroy( 1 ); // reader
       
   425     
       
   426     iNumKeypad->Draw();
       
   427     iNumKeypad->UpdateArea( iNumKeypad->Rect() );
       
   428 	}
       
   429 
       
   430 // ---------------------------------------------------------------------------
       
   431 // create virtual key.
       
   432 // ---------------------------------------------------------------------------
       
   433 //
       
   434 CVirtualKey* CPeninputArabicFingerHwrNumSymbolTable::CreateVkbKeyL( TResourceReader& aReader, 
       
   435     const TRect aKeyRect )
       
   436     {
       
   437     CHBufCArray* keytexts = CHBufCArray::NewL();
       
   438     CleanupStack::PushL( keytexts );
       
   439     
       
   440     for ( TInt i = 0; i <= EPosLast; i++ )
       
   441         {
       
   442         HBufC* unicode = aReader.ReadHBufCL();
       
   443         keytexts->Array().AppendL( unicode );
       
   444         }
       
   445 
       
   446     TInt keyscancode = aReader.ReadInt16();
       
   447 
       
   448     HBufC* text = keytexts->Array()[0];
       
   449     
       
   450     CVirtualKey* vk = NULL;
       
   451     if ( text )
       
   452         {
       
   453         vk = CVirtualKey::NewL( *text, keyscancode, aKeyRect, aKeyRect, 0 );
       
   454         }
       
   455     else 
       
   456         {
       
   457         vk = CVirtualKey::NewL( KNullDesC, keyscancode, aKeyRect, aKeyRect, 0 );
       
   458         }
       
   459 
       
   460     CleanupStack::PopAndDestroy( keytexts ); //keytexts
       
   461 
       
   462     
       
   463     TRect innerrect = aKeyRect;
       
   464     innerrect.Shrink( TSize(10, 10) );
       
   465     vk->SetInnerRect( innerrect );
       
   466     
       
   467     return vk;
       
   468     }
       
   469 
       
   470 // ---------------------------------------------------------------------------
       
   471 // update virtual key info.
       
   472 // ---------------------------------------------------------------------------
       
   473 //
       
   474 void CPeninputArabicFingerHwrNumSymbolTable::UpdateVkbKeyL( CVirtualKey* aVirtualKey, 
       
   475     TResourceReader& aReader, const TRect aKeyRect )
       
   476     {
       
   477     CHBufCArray* keytexts = CHBufCArray::NewL();
       
   478     CleanupStack::PushL( keytexts );
       
   479     
       
   480     for ( TInt i = 0; i <= EPosLast; i++ )
       
   481         {
       
   482         HBufC* unicode = aReader.ReadHBufCL();
       
   483         keytexts->Array().AppendL( unicode );
       
   484         }
       
   485 
       
   486     TInt keyscancode = aReader.ReadInt16();
       
   487 
       
   488     HBufC* text = keytexts->Array()[0];
       
   489     if ( text )
       
   490         {
       
   491         aVirtualKey->SetKeyData( *text );
       
   492         }
       
   493     else
       
   494         {
       
   495         aVirtualKey->SetKeyData( KNullDesC );
       
   496         }
       
   497     
       
   498     aVirtualKey->SetKeyScancode( keyscancode );
       
   499 
       
   500     CleanupStack::PopAndDestroy( keytexts ); //keytexts
       
   501 
       
   502     aVirtualKey->SetRect(aKeyRect);
       
   503     TRect innerrect = aKeyRect;
       
   504     innerrect.Shrink( TSize(10,10) );
       
   505     aVirtualKey->SetInnerRect( innerrect );
       
   506     }
       
   507 
       
   508 // ---------------------------------------------------------------------------
       
   509 // accept editor's number mapping restriction.
       
   510 // ---------------------------------------------------------------------------
       
   511 //
       
   512 void CPeninputArabicFingerHwrNumSymbolTable::SetNumericMapping( const TDesC& aNumMapping )
       
   513     {
       
   514     //format of aNumMapping is "0123456789******"
       
   515     
       
   516     //char offset in aNumMapping
       
   517     //cell 0 using aNumMapping[KNumOffsets[0]]
       
   518     //cell 1 using aNumMapping[KNumOffsets[1]]
       
   519     const TInt KNumOffsets[] = 
       
   520         {
       
   521          12,  1,  2, 3,
       
   522          13,  4,  5, 6,
       
   523          14,  7,  8, 9,
       
   524          15,  10, 0, 11
       
   525         };
       
   526     
       
   527     TInt maxMappingItemCount = sizeof(KNumOffsets)/sizeof(TInt);
       
   528     TInt mappingItemCount = aNumMapping.Length();
       
   529     
       
   530     //numberpad
       
   531     TInt keyCount = iNumKeypad->KeyArray().Count();
       
   532     for ( TInt i = 0; i < keyCount; i++ )
       
   533         {
       
   534         CVirtualKey* vk = iNumKeypad->KeyArray()[i];
       
   535         
       
   536         TInt offset = ( i < maxMappingItemCount ) ? KNumOffsets[i] : -1;
       
   537         
       
   538         if ( offset > -1  && offset < mappingItemCount )
       
   539             {
       
   540             TUint16 unicode = aNumMapping[offset];
       
   541             TUint16 mappedCode = MapLatinNumAccordingToNumMode(unicode);
       
   542             TBuf<1> keydata;
       
   543             keydata.Append(mappedCode);
       
   544             vk->SetKeyData(keydata);
       
   545             vk->SetKeyScancode( mappedCode);
       
   546             vk->SetDimmed( EFalse );
       
   547             }
       
   548         else
       
   549             {
       
   550             vk->SetKeyData( KNullDesC );
       
   551             vk->SetKeyScancode( 0xFFFF );
       
   552             vk->SetDimmed( EFalse );
       
   553             }
       
   554         }
       
   555     
       
   556     
       
   557     //sync feedback
       
   558     UpdateAllVirtualKeysFeedback();
       
   559     }
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // Navigate the symbol page
       
   563 // ---------------------------------------------------------------------------
       
   564 //
       
   565 void CPeninputArabicFingerHwrNumSymbolTable::UpdateNumSymbolTable( TInt aNumSctType)
       
   566     {	
       
   567 
       
   568     iCurrentNumSCTType = aNumSctType;
       
   569 	// Draw the symbol table 
       
   570     Draw();
       
   571 	
       
   572 	// Update the feedback for the virtual key
       
   573     UpdateAllVirtualKeysFeedback();
       
   574 	
       
   575 	// Bitblt the whole symbol table to screen
       
   576 	UpdateArea(iRect);
       
   577     }
       
   578 
       
   579 // ---------------------------------------------------------------------------
       
   580 //  update feedback state of all virtual keys.
       
   581 // ---------------------------------------------------------------------------
       
   582 //
       
   583 void CPeninputArabicFingerHwrNumSymbolTable::UpdateAllVirtualKeysFeedback()
       
   584     {
       
   585     //update sctpad keys
       
   586     TInt keyCount = iNumKeypad->KeyArray().Count();
       
   587     for ( TInt i = 0; i < keyCount; i++ )
       
   588         {
       
   589         CVirtualKey* vk = iNumKeypad->KeyArray()[i];
       
   590         TBool enable = !vk->Dimmed();
       
   591         iNumKeypad->EnableKeyFeedback( vk, enable );
       
   592         }
       
   593     }
       
   594 
       
   595 // ---------------------------------------------------------------------------
       
   596 //  Draw new content to the screen
       
   597 // ---------------------------------------------------------------------------
       
   598 //
       
   599 void CPeninputArabicFingerHwrNumSymbolTable::Draw()
       
   600     {
       
   601 	if(AbleToDraw())
       
   602         {
       
   603 		DrawOpaqueMaskBackground( Rect() );
       
   604 
       
   605 		if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() )
       
   606 			{
       
   607 			AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved);
       
   608 			}
       
   609         // draw background
       
   610 		DrawBackground();    
       
   611 		
       
   612         // draw group		
       
   613 		CControlGroup::Draw();
       
   614 		
       
   615 		// bitblt the new content to screen
       
   616 		UpdateArea(iRect);
       
   617 		}
       
   618 	}
       
   619 // ---------------------------------------------------------------------------
       
   620 //  set native number mode on or off.
       
   621 // ---------------------------------------------------------------------------
       
   622 //
       
   623 void CPeninputArabicFingerHwrNumSymbolTable::SetNativeNumMode(
       
   624         const TBool aIsNativeNumMode)
       
   625     {
       
   626     iIsNativeNumMode = aIsNativeNumMode;
       
   627     }
       
   628 // ---------------------------------------------------------------------------
       
   629 //  map latin number to arabic native number.
       
   630 // ---------------------------------------------------------------------------
       
   631 //
       
   632 TInt16 CPeninputArabicFingerHwrNumSymbolTable:: MapLatinNumAccordingToNumMode(
       
   633         TInt16 aUnicode)
       
   634     {
       
   635     TInt16 ret = aUnicode;
       
   636     if(aUnicode >= 0x30 && aUnicode <= 0x39)
       
   637         {
       
   638         if(iIsNativeNumMode)
       
   639             {
       
   640             ret = aUnicode + 0x0660 - 0x30;
       
   641             }
       
   642         }
       
   643     return ret;
       
   644     }
       
   645 // End Of File