textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp
branchRCL_3
changeset 3 f5a1e66df979
child 5 a47de9135b21
equal deleted inserted replaced
0:eb1f2e154e89 3:f5a1e66df979
       
     1 /*
       
     2 * Copyright (c) 2009 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 char range selector.
       
    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 #include <peninputmultiimagebutton.h>
       
    38 #include <peninputpluginutils.h>
       
    39 
       
    40 #include "hbufcarrayar.h"
       
    41 #include "peninputfingerhwrarevent.h"
       
    42 #include "peninputfingerhwrarcontrolid.h"
       
    43 #include "peninputfingerhwrarstoreconstants.h"
       
    44 #include "peninputfingerhwrarmultipagevkb.h"
       
    45 #include "peninputfingerhwrarsymboltable.h"
       
    46 
       
    47 
       
    48 //CONST DEFINATION
       
    49 const TInt KSymbolButtonInnerPadding = 6;
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // Symbian Constructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CPeninputArabicFingerHwrSymbolTable* CPeninputArabicFingerHwrSymbolTable::NewL( 
       
    56     CFepUiLayout* aUiLayout, TInt aId )
       
    57     {
       
    58     CPeninputArabicFingerHwrSymbolTable* self = CPeninputArabicFingerHwrSymbolTable::NewLC( 
       
    59             aUiLayout, aId );
       
    60     
       
    61     CleanupStack::Pop( self ); // self;
       
    62     return self;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // Symbian Constructor
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CPeninputArabicFingerHwrSymbolTable* CPeninputArabicFingerHwrSymbolTable::NewLC( 
       
    70     CFepUiLayout* aUiLayout, TInt aId )
       
    71     {
       
    72     CPeninputArabicFingerHwrSymbolTable* self = new (ELeave) CPeninputArabicFingerHwrSymbolTable( 
       
    73             aUiLayout, aId );
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL();
       
    76     return self;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // c++ destructor
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 CPeninputArabicFingerHwrSymbolTable::~CPeninputArabicFingerHwrSymbolTable()
       
    84     {
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // popup the list.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CPeninputArabicFingerHwrSymbolTable::OpenSymbolTable()
       
    92     {
       
    93     CapturePointer( ETrue );
       
    94     iPopupVisible = ETrue;
       
    95     iPointerMoveBack = EFalse;
       
    96 	Draw();
       
    97     UpdateArea(iRect );    
       
    98 	UiLayout()->LockArea(UiLayout()->Rect(),this);
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // cancel the popup.
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 void CPeninputArabicFingerHwrSymbolTable::CloseSymbolTable()
       
   106     {
       
   107     CapturePointer( EFalse );
       
   108     iPenDownCtrl = NULL;
       
   109     iPopupVisible = EFalse;
       
   110     UiLayout()->UnLockArea(UiLayout()->Rect(),this);
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // get visibility of popup.
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 TBool CPeninputArabicFingerHwrSymbolTable::IsPopup()
       
   118     {
       
   119     return iPopupVisible;
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // Handle pointer down event.
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 CFepUiBaseCtrl* CPeninputArabicFingerHwrSymbolTable::HandlePointerDownEventL(
       
   127     const TPoint& aPoint )
       
   128     {
       
   129     CancelPointerDownL();
       
   130     CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerDownEventL( aPoint );
       
   131     iPenDownCtrl = ctrl;
       
   132     
       
   133     if(!ctrl)
       
   134 	   {
       
   135 	   ReportEvent(EHwrEventOutsideEvent);
       
   136 	   }
       
   137 	else
       
   138        {
       
   139 	   ctrl->Draw();
       
   140 	   ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   141 	   }	
       
   142 	   
       
   143     return ctrl;
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // Handle pointer up event.
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 CFepUiBaseCtrl* CPeninputArabicFingerHwrSymbolTable::HandlePointerUpEventL(
       
   151     const TPoint& aPoint )
       
   152     {
       
   153     CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerUpEventL( aPoint );
       
   154 
       
   155     if(ctrl)
       
   156 	   {
       
   157 	   ctrl->Draw();
       
   158 	   ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   159 	   }
       
   160 
       
   161 	return ctrl;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // Handle pointer move event.
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 CFepUiBaseCtrl* CPeninputArabicFingerHwrSymbolTable::HandlePointerMoveEventL(
       
   169     const TPoint& aPoint )
       
   170     {
       
   171 	CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerMoveEventL( aPoint );
       
   172 	if(ctrl)
       
   173 	    {
       
   174 	    ctrl->Draw();
       
   175 		ctrl->UpdateArea(ctrl->Rect(),EFalse);
       
   176 		iPointerMoveBack = ETrue;
       
   177 		}
       
   178 	else
       
   179 	    {
       
   180 	    if(iPointerMoveBack)
       
   181 	        {
       
   182             if(iPenDownCtrl)
       
   183                 {
       
   184                 iPenDownCtrl->HandlePointerLeave(aPoint);
       
   185                 }
       
   186             iPointerMoveBack = EFalse;
       
   187 	        }
       
   188 	    }
       
   189 
       
   190     return ctrl;
       
   191     }
       
   192 
       
   193 void CPeninputArabicFingerHwrSymbolTable::HandlePointerLeave(const TPoint& aPoint)
       
   194     {
       
   195     CControlGroup::HandlePointerLeave(aPoint);
       
   196     Draw();
       
   197     UpdateArea(Rect(),EFalse);
       
   198     }
       
   199 // ---------------------------------------------------------------------------
       
   200 // C++ constructor.
       
   201 // ---------------------------------------------------------------------------
       
   202 //
       
   203 CPeninputArabicFingerHwrSymbolTable::CPeninputArabicFingerHwrSymbolTable( 
       
   204     CFepUiLayout* aFepUiLayout, TInt aControlId )
       
   205     : CControlGroup( aFepUiLayout, aControlId )
       
   206     {
       
   207     }
       
   208     
       
   209 // ---------------------------------------------------------------------------
       
   210 // Symbian second-phase constructor.
       
   211 // ---------------------------------------------------------------------------
       
   212 //
       
   213 void CPeninputArabicFingerHwrSymbolTable::ConstructL()
       
   214     {
       
   215     BaseConstructL(); 
       
   216 	
       
   217     //disable border
       
   218     SetBorderSize( TSize(0,0) );
       
   219     
       
   220 	CreateVirtualKeypadL();
       
   221 	
       
   222     CreateButtonGroupL();
       
   223     }
       
   224 
       
   225 void CPeninputArabicFingerHwrSymbolTable::SizeChanged(
       
   226                      const TSize /*aKeypadSize*/, const TSize aButtonSize,
       
   227                      const TInt aKeypadRow, const TInt aKeypadCol, TBool aIsLandscape)
       
   228     {
       
   229 	iIsLandscape = aIsLandscape;
       
   230 	
       
   231 	// relayout the button group
       
   232 	TRect spaceBtnRect(iRect.iTl,iRect.iTl+TPoint(aButtonSize.iWidth,aButtonSize.iHeight));
       
   233 	MoveIconButton(iSpaceBtn,spaceBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   234 	
       
   235 	TRect innerRect = spaceBtnRect;
       
   236 	innerRect.Shrink(4*KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   237 	
       
   238 	// that's a not good algrithm in funciton AknPenInputDrawUtils::Draw3PiecesColorIcon for drawing 3Pieces icons 
       
   239 	// as when the  outter rect's height was not equal to the inter rect's height, the target rects the left icons and right icons 
       
   240     // would be bitblited onto are Rect(0.0.0.0.0) [[which should not be that behavior]].
       
   241 	// Please theck the codes: AknPenInputDrawUtils::Draw3PiecesColorIcon: this function should be Updated.
       
   242 	iSpaceBtn->SetDraw3PieceFrameInfo(
       
   243 									  TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
       
   244 									  KAknsIIDQgnIndiInputSpaceMiddle,
       
   245 									  KAknsIIDQgnIndiInputSpaceR,
       
   246 									  innerRect));
       
   247 	TRect enterBtnRect = spaceBtnRect;
       
   248 	enterBtnRect.Move(TPoint(aButtonSize.iWidth,0));
       
   249 	
       
   250 	MoveIconButton(iEnterBtn,enterBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   251 	
       
   252 	TRect pageBtnRect = enterBtnRect;
       
   253 	pageBtnRect.Move(TPoint(aButtonSize.iWidth,0));
       
   254 	
       
   255 	if(aIsLandscape)
       
   256 	    {
       
   257 		i3Page1Btn->Hide(ETrue);
       
   258 		i3Page2Btn->Hide(ETrue);
       
   259 		i3Page3Btn->Hide(ETrue);
       
   260 		i2Page1Btn->Hide(EFalse);
       
   261 		i2Page2Btn->Hide(EFalse);
       
   262 		MoveIconButton(i2Page1Btn,pageBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   263 	    MoveIconButton(i2Page2Btn,pageBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   264 		}
       
   265 	else
       
   266         {
       
   267 		i2Page1Btn->Hide(EFalse);
       
   268 		i2Page2Btn->Hide(EFalse);
       
   269 		i3Page1Btn->Hide(EFalse);
       
   270         i3Page2Btn->Hide(ETrue);
       
   271         i3Page3Btn->Hide(ETrue);
       
   272 		MoveIconButton(i3Page1Btn,pageBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   273 	    MoveIconButton(i3Page2Btn,pageBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   274 	    MoveIconButton(i3Page3Btn,pageBtnRect,KSymbolButtonInnerPadding,KSymbolButtonInnerPadding);
       
   275 		}	
       
   276 
       
   277 	// relayout the virtual key pad
       
   278 	TRect keypadRect = iRect;
       
   279 	keypadRect.iTl = keypadRect.iTl + TPoint(0,aButtonSize.iHeight);
       
   280 	
       
   281 	iMutiPageKeypad->SetRect(keypadRect);
       
   282 	
       
   283 	iMutiPageKeypad->UpdatePaging(aKeypadRow,aKeypadCol);
       
   284 	}
       
   285 	
       
   286 // ---------------------------------------------------------------------------
       
   287 // create symbol table keypad.
       
   288 // ---------------------------------------------------------------------------
       
   289 //
       
   290 void CPeninputArabicFingerHwrSymbolTable::CreateVirtualKeypadL()
       
   291     {
       
   292     TFontSpec spec;
       
   293 
       
   294     iMutiPageKeypad = CMultiPageVirtualKeyboard::NewL( 
       
   295         TRect(0,0,0,0),
       
   296         UiLayout(),
       
   297         EHwrCtrlIdSctpad,
       
   298         spec );
       
   299 
       
   300     AddControlL( iMutiPageKeypad );
       
   301     iMutiPageKeypad->AddEventObserver( UiLayout() );
       
   302     
       
   303     iMutiPageKeypad->SetResourceId( KInvalidResId );
       
   304         
       
   305     iMutiPageKeypad->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 );
       
   306     iMutiPageKeypad->SetDrawOpaqueBackground( EFalse );    
       
   307     }
       
   308 
       
   309 void CPeninputArabicFingerHwrSymbolTable::CreateButtonGroupL()
       
   310     {
       
   311     iEnterBtn     = CreateEventBtnL(EHwrCtrlIdBtnEnter,R_AKN_FEP_HWR_ENTER);
       
   312 	iSpaceBtn     = CreateEventBtnL(EHwrCtrlIdBtnSpace,R_AKN_FEP_HWR_SPACE);
       
   313 	// Create 3-pieces color icon for space button
       
   314 	CPenInput3PiecesColorIcons* colorIcons = 
       
   315 				CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
       
   316 												  R_AKN_FEP_VKB_SPACE_ICON2,
       
   317 												  R_AKN_FEP_VKB_SPACE_ICON3 );
       
   318 	iSpaceBtn->Set3PiecesColorIcons( colorIcons );											  
       
   319 	
       
   320 	// create the page button for portrait
       
   321 	i3Page1Btn  = CreateEventBtnL(EHwrCtrlId3Page1Btn, R_AKN_FEP_ARABIC_3PAGE_HWR_SCT_PAGE_1);
       
   322     i3Page2Btn  = CreateEventBtnL(EHwrCtrlId3Page2Btn, R_AKN_FEP_ARABIC_3PAGE_HWR_SCT_PAGE_2);
       
   323     i3Page3Btn  = CreateEventBtnL(EHwrCtrlId3Page3Btn, R_AKN_FEP_ARABIC_3PAGE_HWR_SCT_PAGE_3);
       
   324 	
       
   325 	// create the page button for landscape
       
   326 	i2Page1Btn  = CreateEventBtnL(EHwrCtrlId2Page1Btn, R_AKN_FEP_ARABIC_2PAGE_HWR_SCT_PAGE_1);
       
   327     i2Page2Btn  = CreateEventBtnL(EHwrCtrlId2Page2Btn, R_AKN_FEP_ARABIC_2PAGE_HWR_SCT_PAGE_2);
       
   328 	}
       
   329 	
       
   330 // ---------------------------------------------------------------------------
       
   331 // EventButton creation helper.
       
   332 // ---------------------------------------------------------------------------
       
   333 //
       
   334 CAknFepCtrlEventButton* CPeninputArabicFingerHwrSymbolTable::CreateEventBtnL( 
       
   335     TInt aCtrlId, TInt32 aResId, TInt aEvent/*= 0xFFFF*/,TInt aUnicode/*=0*/ )
       
   336     {
       
   337     CAknFepCtrlEventButton* button = CAknFepCtrlEventButton::NewL( 
       
   338         UiLayout(), aCtrlId, aEvent, aUnicode,
       
   339         KAknsIIDQsnFrFunctionButtonNormal,
       
   340         KAknsIIDQsnFrFunctionButtonPressed,
       
   341         KAknsIIDQsnFrFunctionButtonInactive );
       
   342     
       
   343     button->SetResourceId( aResId );
       
   344     button->ConstructFromResourceL();
       
   345     button->AddEventObserver( UiLayout() );        
       
   346     AddControlL( button );
       
   347     return button;
       
   348     }
       
   349 
       
   350 // ---------------------------------------------------------------------------
       
   351 //  EventButton layout helper. Move button to specified rect.
       
   352 // ---------------------------------------------------------------------------
       
   353 //
       
   354 void CPeninputArabicFingerHwrSymbolTable::MoveIconButton( CAknFepCtrlEventButton* aButton, 
       
   355     const TRect& aRect, TInt aXPadding, TInt aYPadding, TBool aReloadImages )
       
   356     {
       
   357     if ( !aButton )
       
   358         {
       
   359         return;
       
   360         }
       
   361     
       
   362     aButton->SetRect( aRect );
       
   363     TRect rcInner = aRect;
       
   364     rcInner.Shrink( aXPadding, aYPadding );
       
   365     aButton->SizeChanged( aRect, rcInner, aReloadImages );
       
   366     }
       
   367 
       
   368 void CPeninputArabicFingerHwrSymbolTable::OnActivate()
       
   369     {
       
   370     CControlGroup::OnActivate();
       
   371 	if(IsPopup())
       
   372 	    {
       
   373 	    CapturePointer( ETrue );
       
   374 	    NavigatePage(0,EPagePosPageNo);
       
   375 		}
       
   376 	}
       
   377 	
       
   378 void CPeninputArabicFingerHwrSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize)
       
   379     {
       
   380 	TResourceReader reader;    
       
   381     CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );      
       
   382     
       
   383     TPtrC bmpFileName = reader.ReadTPtrC();
       
   384     TInt32 imgMajorSkinId = reader.ReadInt32();
       
   385     TAknsItemID id;
       
   386     
       
   387     TSize keySize = aKeySize;
       
   388     
       
   389     for ( TInt index = 0; index <= EKeyBmpLastType ; index += 2 )
       
   390         { 
       
   391         // Get the image ids and mask ids from resource
       
   392         TInt bmpId = reader.ReadInt16(); 
       
   393         TInt bmpMskId = reader.ReadInt16();
       
   394         
       
   395         // read skin item id
       
   396         const TInt skinitemid = reader.ReadInt16();
       
   397         id.Set( TInt( imgMajorSkinId ), skinitemid );
       
   398         
       
   399         if ( bmpId != KInvalidImg )
       
   400             {
       
   401             CFbsBitmap* bmp = NULL;
       
   402             CFbsBitmap* maskbmp = NULL;
       
   403 
       
   404             if ( bmpMskId != KInvalidImg )
       
   405                 {
       
   406                 AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
       
   407                    id, bmp, maskbmp, bmpFileName, bmpId, bmpMskId );
       
   408                 
       
   409                 // set maskbmp and size
       
   410                 AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved );
       
   411                 iMutiPageKeypad->SetNonIrregularKeyBitmapL( 
       
   412                 TVirtualKeyBmpType( EKeyBmpNormal + index + 1 ), maskbmp );
       
   413                 }
       
   414             else
       
   415                 {
       
   416                 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id, 
       
   417                     bmp, bmpFileName, bmpId );
       
   418                 }
       
   419             // set bmp and size
       
   420             AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved );
       
   421             iMutiPageKeypad->SetNonIrregularKeyBitmapL( 
       
   422                 TVirtualKeyBmpType( EKeyBmpNormal + index ), bmp );
       
   423             }       
       
   424         }
       
   425     // Pop and destroy reader
       
   426     CleanupStack::PopAndDestroy( 1 );        
       
   427 	}
       
   428 	
       
   429 void CPeninputArabicFingerHwrSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects)
       
   430     {
       
   431 	iMutiPageKeypad->SetResourceId(aResId);
       
   432 	
       
   433 	TResourceReader reader;
       
   434     CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
       
   435 
       
   436     // construct keys
       
   437     TInt resKeyCount = reader.ReadInt16();
       
   438     TInt existsKeyCount = iMutiPageKeypad->KeyArray().Count();
       
   439     TInt rectCount = aCellRects.Count();
       
   440     
       
   441     for ( TInt i = 0; i < resKeyCount; i++ )
       
   442         {
       
   443         if ( i < existsKeyCount )
       
   444             {
       
   445             CVirtualKey* vk = iMutiPageKeypad->KeyArray()[i];
       
   446             UpdateVkbKeyL( vk, reader, aCellRects[i%rectCount] );
       
   447             }
       
   448         else
       
   449             {
       
   450             CVirtualKey* vk = CreateVkbKeyL( reader, aCellRects[i%rectCount] );
       
   451             CleanupStack::PushL( vk );
       
   452             iMutiPageKeypad->AddKeyL( vk );
       
   453             CleanupStack::Pop( vk );
       
   454             }
       
   455         }
       
   456     
       
   457     CleanupStack::PopAndDestroy( 1 ); // reader
       
   458     
       
   459     iMutiPageKeypad->Draw();
       
   460     iMutiPageKeypad->UpdateArea( iMutiPageKeypad->Rect() );
       
   461 	}
       
   462 
       
   463 // ---------------------------------------------------------------------------
       
   464 // create virtual key.
       
   465 // ---------------------------------------------------------------------------
       
   466 //
       
   467 CVirtualKey* CPeninputArabicFingerHwrSymbolTable::CreateVkbKeyL( TResourceReader& aReader, 
       
   468     const TRect aKeyRect )
       
   469     {
       
   470     CHBufCArray* keytexts = CHBufCArray::NewL();
       
   471     CleanupStack::PushL( keytexts );
       
   472     
       
   473     for ( TInt i = 0; i <= EPosLast; i++ )
       
   474         {
       
   475         HBufC* unicode = aReader.ReadHBufCL();
       
   476         keytexts->Array().AppendL( unicode );
       
   477         }
       
   478 
       
   479     TInt keyscancode = aReader.ReadInt16();
       
   480 
       
   481     HBufC* text = keytexts->Array()[0];
       
   482     
       
   483     CVirtualKey* vk = NULL;
       
   484     if ( text )
       
   485         {
       
   486         vk = CVirtualKey::NewL( *text, keyscancode, aKeyRect, aKeyRect, 0 );
       
   487         }
       
   488     else 
       
   489         {
       
   490         vk = CVirtualKey::NewL( KNullDesC, keyscancode, aKeyRect, aKeyRect, 0 );
       
   491         }
       
   492 
       
   493     CleanupStack::PopAndDestroy( keytexts ); //keytexts
       
   494 
       
   495 
       
   496     TRect innerrect = aKeyRect;
       
   497     innerrect.Shrink( TSize(10, 10) );
       
   498     vk->SetInnerRect( innerrect );
       
   499     
       
   500     return vk;
       
   501     }
       
   502 
       
   503 
       
   504 // ---------------------------------------------------------------------------
       
   505 // update virtual key info.
       
   506 // ---------------------------------------------------------------------------
       
   507 //
       
   508 void CPeninputArabicFingerHwrSymbolTable::UpdateVkbKeyL( CVirtualKey* aVirtualKey, 
       
   509     TResourceReader& aReader, const TRect aKeyRect )
       
   510     {
       
   511     CHBufCArray* keytexts = CHBufCArray::NewL();
       
   512     CleanupStack::PushL( keytexts );
       
   513     
       
   514     for ( TInt i = 0; i <= EPosLast; i++ )
       
   515         {
       
   516         HBufC* unicode = aReader.ReadHBufCL();
       
   517         keytexts->Array().AppendL( unicode );
       
   518         }
       
   519 
       
   520     TInt keyscancode = aReader.ReadInt16();
       
   521 
       
   522     HBufC* text = keytexts->Array()[0];
       
   523     if ( text )
       
   524         {
       
   525         aVirtualKey->SetKeyData( *text );
       
   526         }
       
   527     else
       
   528         {
       
   529         aVirtualKey->SetKeyData( KNullDesC );
       
   530         }
       
   531     
       
   532     aVirtualKey->SetKeyScancode( keyscancode );
       
   533 
       
   534     CleanupStack::PopAndDestroy( keytexts ); //keytexts
       
   535 
       
   536     aVirtualKey->SetRect(aKeyRect);
       
   537     TRect innerrect = aKeyRect;
       
   538     innerrect.Shrink( TSize(10,10) );
       
   539     aVirtualKey->SetInnerRect( innerrect );
       
   540     }
       
   541 
       
   542 // ---------------------------------------------------------------------------
       
   543 // Change SCT page.
       
   544 // ---------------------------------------------------------------------------
       
   545 //
       
   546 void CPeninputArabicFingerHwrSymbolTable::NavigatePage( TInt aPageNo, TInt aPos )
       
   547     {
       
   548     switch ( aPos )
       
   549         {
       
   550         case EPagePosPageNo:
       
   551             {
       
   552             iMutiPageKeypad->NavToPage( aPageNo );
       
   553             }
       
   554             break;
       
   555         case EPagePosNextPage:
       
   556             {
       
   557             iMutiPageKeypad->NavToNextPage();
       
   558             }
       
   559             break;
       
   560             
       
   561         case EPagePosPrevPage:
       
   562             {
       
   563             iMutiPageKeypad->NavToPrevPage();
       
   564             }
       
   565             break;
       
   566             
       
   567         case EPagePosLastPage:
       
   568             {
       
   569             iMutiPageKeypad->NavToLastPage( );
       
   570             }
       
   571             break;
       
   572             
       
   573         case EPagePosFirstPage:
       
   574             {
       
   575             iMutiPageKeypad->NavToFirstPage();
       
   576             }
       
   577             break;
       
   578             
       
   579         default:
       
   580             break;
       
   581         }
       
   582 		
       
   583 	iMutiPageKeypad->Draw();		
       
   584     UpdatePageButtonsUi();
       
   585     UpdateAllVirtualKeysFeedback( EFingerHwrSymbolRange );
       
   586 	iEnterBtn->Draw();
       
   587 	iSpaceBtn->Draw();
       
   588 	UpdateArea(iRect);
       
   589     }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // sync sct paging buttons.
       
   593 // ---------------------------------------------------------------------------
       
   594 //
       
   595 void CPeninputArabicFingerHwrSymbolTable::UpdatePageButtonsUi()
       
   596     {
       
   597     TInt curpage = iMutiPageKeypad->CurPageIndex();
       
   598     TInt pagecount = iMutiPageKeypad->PageCount();
       
   599     
       
   600 	if(iIsLandscape)
       
   601 	    {
       
   602 		i2Page1Btn->Hide( curpage != 0 );
       
   603         i2Page2Btn->Hide( curpage != 1 );
       
   604 		}
       
   605 	else
       
   606         {
       
   607 		i3Page1Btn->Hide( curpage != 0 );
       
   608         i3Page2Btn->Hide( curpage != 1 );
       
   609         i3Page3Btn->Hide( curpage != 2 );
       
   610 		}
       
   611     }
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 //  update feedback state of all virtual keys.
       
   615 // ---------------------------------------------------------------------------
       
   616 //
       
   617 void CPeninputArabicFingerHwrSymbolTable::UpdateAllVirtualKeysFeedback( TInt aType )
       
   618     {
       
   619     TBool isSctpad = ( aType == EFingerHwrSymbolRange ) ? ETrue : EFalse;
       
   620     
       
   621     //update sctpad keys
       
   622     TInt keyCount = iMutiPageKeypad->KeyArray().Count();
       
   623     TInt pageSize = iMutiPageKeypad->PageSize();
       
   624     TInt curPage = iMutiPageKeypad->CurPageIndex();
       
   625     for ( TInt i = 0; i < keyCount; i++ )
       
   626         {
       
   627         CVirtualKey* vk = iMutiPageKeypad->KeyArray()[i];
       
   628         TInt page = i / pageSize;
       
   629         TBool enable = !vk->Dimmed() &&  isSctpad && ( page == curPage );
       
   630         iMutiPageKeypad->EnableKeyFeedback( vk, enable );
       
   631         }
       
   632     }
       
   633 // End Of File