textinput/peninputhwrfscn/src/peninputhwrfscnfunctionpanel.cpp
changeset 0 eb1f2e154e89
child 7 6defe5d1bd39
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for chinese peninput full screen hwr
       
    15 *
       
    16 */
       
    17 
       
    18 // SYSTEM INCLUDES
       
    19 #include <AknUtils.h>
       
    20 #include <AknsUtils.h>
       
    21 #include <aknfeppeninputenums.h>
       
    22 #include <peninputlayout.h>
       
    23 #include <AknFepGlobalEnums.h>
       
    24 #include <aknlayoutscalable_avkon.cdl.h>
       
    25 
       
    26 // RESOURCE INCLUDES
       
    27 #include <peninputhwrfscreencn.rsg>
       
    28 #include <peninputhwrfscn.mbg>
       
    29 #include <peninputlayoutinputmodechoice.h>
       
    30 
       
    31 // USER INCLUDES
       
    32 #include "peninputhwrfscn.hrh"
       
    33 #include "peninputhwrfscnlayout.h"
       
    34 #include "peninputhwrfscnfunctionpanel.h"
       
    35 #include "peninputhwrfscncontrolid.h"
       
    36 #include "peninputhwrfscnevent.h"
       
    37 #include "peninputhwrfscndatastore.h"
       
    38 #include "peninputhwrfscnlafmanager.h"
       
    39 
       
    40 #include "peninputhwrfscnbkgnd.h"
       
    41 
       
    42 // CONSTANTS
       
    43 //_LIT( KBMPFileName, "\\resource\\apps\\peninputhwrfscn.mbm" );
       
    44 const TUint8 KSymbolTableColumnCount = 6;
       
    45 const TUint8 KSymbolTableRowCount = 5;
       
    46 const TInt KEnterWidthUintNum = 2;
       
    47 const TInt KSpaceWidthUintNum = 2;
       
    48 const TInt KWidthSwitcherBtnWidthUintNum = 2;
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CPeninputHwrfscnFunctionPanel::NewL()
       
    54 // .
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CPeninputHwrfscnFunctionPanel* CPeninputHwrfscnFunctionPanel::NewL( 
       
    58     CPeninputHwrfscnLayout* aLayout )
       
    59     {
       
    60     CPeninputHwrfscnFunctionPanel* self = 
       
    61                new ( ELeave ) CPeninputHwrfscnFunctionPanel( aLayout );
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop();
       
    65     return self;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CPeninputHwrfscnFunctionPanel::CPeninputHwrfscnFunctionPanel()
       
    70 // .
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 CPeninputHwrfscnFunctionPanel::CPeninputHwrfscnFunctionPanel( 
       
    74     CPeninputHwrfscnLayout* aLayout )
       
    75     :CPeninputHwrfscnBasePanel( aLayout )
       
    76     {
       
    77     // Initialze iPos
       
    78     iPos.SetXY( 0, 0 );
       
    79 
       
    80     // Initialize to be EFullWidth
       
    81     iLangWidthState = EFullWidth;
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPeninputHwrfscnFunctionPanel::~CPeninputHwrfscnFunctionPanel()
       
    86 // .
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 CPeninputHwrfscnFunctionPanel::~CPeninputHwrfscnFunctionPanel()
       
    90     {
       
    91     delete iVkbLayout;  
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CPeninputHwrfscnFunctionPanel::Show()
       
    96 // .
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CPeninputHwrfscnFunctionPanel::Show( TBool aVisible )
       
   100     {
       
   101 	iVisible = aVisible;
       
   102 	iSymbolTableGroup->Hide( !aVisible );
       
   103    	iMoreFuncBtnGroup->Hide( !aVisible );
       
   104 	
       
   105 	const RPointerArray<CFepUiBaseCtrl>& moreFuncBtnList = 
       
   106 	    iMoreFuncBtnGroup->ControlList();
       
   107 
       
   108     for ( TInt i = 0; i < EMoreFuncBtnCount; i++ )
       
   109 	    {
       
   110 	    moreFuncBtnList[i]->Hide( !aVisible );
       
   111 	    }
       
   112 	    
       
   113    	iVkbCtrl->Hide( !aVisible );
       
   114     
       
   115     
       
   116     // Added for error when hide vkb calls for dimkey function
       
   117     if ( aVisible )
       
   118         {
       
   119         CAknFepCtrlCommonButton* butonFullHalf = static_cast<CAknFepCtrlCommonButton*>( 
       
   120         iMoreFuncBtnGroup->ControlById( EHwrCtrlIdLanguageWidthFullHalf ) );
       
   121         
       
   122         CAknFepCtrlCommonButton* butonHalfFull = static_cast<CAknFepCtrlCommonButton*>( 
       
   123         iMoreFuncBtnGroup->ControlById( EHwrCtrlIdLanguageWidthHalfFull ) );
       
   124         
       
   125             
       
   126         if ( iLayout->DataStore().PermittedRanges().Find( ERangeNative ) 
       
   127             == KErrNotFound )
       
   128             {
       
   129             iLangWidthState = EHalfWidth;
       
   130 
       
   131            	iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolHalfWidth );
       
   132             
       
   133             butonHalfFull->Hide(EFalse);
       
   134             butonFullHalf->Hide(ETrue);
       
   135             butonHalfFull->SetDimmed( ETrue );
       
   136             
       
   137             //butonFullHalf->SetHighlight( ETrue );
       
   138             
       
   139             //butonFullHalf->SetDimmed( ETrue );
       
   140             }
       
   141         else
       
   142             {
       
   143             if ( iLayout->DataStore().IsChinesePrimaryRange() )
       
   144                 {
       
   145                 iLangWidthState = EFullWidth;
       
   146 
       
   147                	iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolFullWidth );
       
   148                 
       
   149                 //butonFullHalf->SetHighlight( EFalse );
       
   150 	            butonHalfFull->Hide(ETrue);
       
   151 	            butonFullHalf->Hide(EFalse);
       
   152                 }
       
   153             else
       
   154                 {
       
   155                 iLangWidthState = EHalfWidth;
       
   156 
       
   157                	iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolHalfWidth );
       
   158 	            butonHalfFull->Hide(EFalse);
       
   159 	            butonFullHalf->Hide(ETrue);                
       
   160                 //butonFullHalf->SetHighlight( ETrue );
       
   161                 }
       
   162             //butonFullHalf->SetDimmed( EFalse );
       
   163             butonHalfFull->SetDimmed( EFalse );
       
   164             }
       
   165             
       
   166         TVirtualKeyDrawInfo vkbBoardDrawInfo(KAknsIIDQsnFrItutButtonCandiSideL, 
       
   167 									KAknsIIDQsnFrItutButtonCandiMiddle,
       
   168 								    KAknsIIDQsnFrItutButtonCandiSideR,
       
   169 						            KAknsIIDQsnFrItutButtonCandiSideL,
       
   170 						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
   171 						            KAknsIIDQsnFrItutButtonCandiSideR,
       
   172                                     KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
   173                                     KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
   174                                     KAknsIIDQsnFrItutButtonCandiPressedSideR,
       
   175 						            TRgb(194, 221, 242),
       
   176 						            ETrue);
       
   177         iVkbCtrl->SetVirtualKeyImgID(vkbBoardDrawInfo); 
       
   178             
       
   179         // reset rect and dim
       
   180 		iVkbCtrl->SetRect( SymbolTableRect() );
       
   181 		TRAP_IGNORE( NumberModeDimKeysL() );
       
   182 		Draw();
       
   183         }
       
   184     // End
       
   185    
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CPeninputHwrfscnFunctionPanel::Draw()
       
   190 // .
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CPeninputHwrfscnFunctionPanel::Draw()
       
   194     {
       
   195 	iSymbolTableGroup->Draw();
       
   196     TRect rect = iSymbolTableGroup->Rect();
       
   197     iLayout->UpdateArea( iSymbolTableGroup, rect, EFalse,EFalse );
       
   198 
       
   199     iMoreFuncBtnGroup->Draw();
       
   200     rect = iMoreFuncBtnGroup->Rect();
       
   201     iLayout->UpdateArea( iMoreFuncBtnGroup, rect, EFalse,EFalse );
       
   202     }
       
   203 // -----------------------------------------------------------------------------
       
   204 // CPeninputHwrfscnFunctionPanel::HandleControlEvent()
       
   205 // .
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 void CPeninputHwrfscnFunctionPanel::HandleControlEvent( 
       
   209     TInt aEventType, 
       
   210     CFepUiBaseCtrl* aCtrl, 
       
   211 	const TDesC& aEventData )
       
   212     {
       
   213     switch( aEventType )
       
   214         {
       
   215         case EEventButtonUp:
       
   216             {
       
   217             OnControlEvent_ButtonUp( aEventType, aCtrl, aEventData );
       
   218 	        }
       
   219             break;
       
   220 
       
   221         case EEventVirtualKeyUp:
       
   222 			{
       
   223             Show( EFalse );
       
   224             const RPointerArray<CFepUiBaseCtrl>& FsFuncBtnList = 
       
   225                 iMoreFuncBtnGroup->ControlList();            
       
   226             for (TInt i = 0; i < EMoreFuncBtnCount; i++)
       
   227                 {
       
   228                 FsFuncBtnList[i]->UpdateAreaImmed(FsFuncBtnList[i]->Rect(),
       
   229                         EFalse);
       
   230                 }            
       
   231             ReportEvent( aEventType, aCtrl, aEventData );
       
   232     		}
       
   233             break;
       
   234 
       
   235         default:
       
   236         	break;
       
   237 	    }
       
   238     }
       
   239 
       
   240 // -----------------------------------------------------------------------------
       
   241 // CPeninputHwrfscnFunctionPanel::HandleCommand()
       
   242 // .
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 void CPeninputHwrfscnFunctionPanel::HandleCommand( 
       
   246     TInt /*aCommand*/, TUint8* /*aData*/ )
       
   247     {
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // CPeninputHwrfscnFunctionPanel::BeforePropertyChangedL()
       
   252 // .
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 TBool CPeninputHwrfscnFunctionPanel::BeforePropertyChangedL( 
       
   256     MPeninputHwrfscnPropertySubscriber::TPeninputHwrfscnProperty /*aProptery*/ )
       
   257     {
       
   258     return EFalse;
       
   259     }
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // CPeninputHwrfscnFunctionPanel::PropertyChangedL()
       
   263 // .
       
   264 // -----------------------------------------------------------------------------
       
   265 //
       
   266 void CPeninputHwrfscnFunctionPanel::PropertyChangedL( 
       
   267 	MPeninputHwrfscnPropertySubscriber::TPeninputHwrfscnProperty /*aProptery*/ )
       
   268     {
       
   269     }
       
   270 
       
   271 // -----------------------------------------------------------------------------
       
   272 // CPeninputHwrfscnFunctionPanel::ConstructL()
       
   273 // .
       
   274 // -----------------------------------------------------------------------------
       
   275 //
       
   276 void CPeninputHwrfscnFunctionPanel::ConstructL()
       
   277     {
       
   278     iLayout->DataStore().AddSubscriber( this );
       
   279     
       
   280     ReadLAFInfo();
       
   281     
       
   282     CreateSymbolTableL();
       
   283 
       
   284     CreateMoreFuncBtnListL();
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // CPeninputHwrfscnFunctionPanel::SizeChanged()
       
   289 // .
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CPeninputHwrfscnFunctionPanel::SizeChanged()
       
   293     {
       
   294     ReadLAFInfo();
       
   295     
       
   296 	iMoreFuncBtnGroup->SetRect( MoreFuncBtnGroupRect() );
       
   297     iSymbolTableGroup->SetRect( SymbolTableRect() );
       
   298 
       
   299     ResetMoreFuncBtnsSize();
       
   300 	ResetSymbolTableSize();
       
   301     }
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CPeninputHwrfscnFunctionPanel::LafChanged()
       
   305 // .
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 void CPeninputHwrfscnFunctionPanel::LafChanged()
       
   309     {
       
   310     ReadLAFInfo();
       
   311     ResetSymbolTableSize();
       
   312     }
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // CPeninputHwrfscnFunctionPanel::CreateSymbolTableL()
       
   316 // .
       
   317 // -----------------------------------------------------------------------------
       
   318 //
       
   319 void CPeninputHwrfscnFunctionPanel::CreateSymbolTableL()
       
   320 	{
       
   321     const CFont* font = PeninputHwrfscnLAFManager::SymbolTableFont();
       
   322 
       
   323     iVkbCtrl = CPeninputVkbCtrlExt::NewL( SymbolTableRect(), 
       
   324         iLayout, 
       
   325         EHwrCtrlIdSymbolTableVkb,
       
   326         font );
       
   327         
       
   328     //This modification is for EVWG-7VW2Z7, change another smaller layout font 
       
   329     TAknTextLineLayout keypadText =
       
   330 		//AknLayoutScalable_Avkon::cell_hwr_fs_pane_t1().LayoutLine();  
       
   331         AknLayoutScalable_Avkon::cell_vkb_candidate_pane_t1().LayoutLine();
       
   332     //Modification for EVWG-7VW2Z7 end  
       
   333     iVkbCtrl->SetTextLineLayout(keypadText);
       
   334 	iVkbCtrl->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG60 );
       
   335 	iVkbLayout = CAknFepCtrlVkbLayout::NewL();
       
   336     // Add VKB control to the VKB layout
       
   337     iVkbLayout->SetVkbKeyboard( iVkbCtrl );
       
   338 
       
   339     // Construct VKB layout from resource
       
   340     iVkbLayout->SetResourceId( R_AKN_FEP_VKB_VKB_LAYOUT_LIST );
       
   341     iVkbLayout->ConstructFromResourceL();
       
   342 	
       
   343 	iVkbCtrl->SetIrregularKeyBoard(EFalse);
       
   344 	iVkbLayout->SetNonIrregularResourceId(R_AKN_FEP_VKB_NONIRREGULAR_BITMAP);
       
   345 	iVkbLayout->ConstructFromNonIrregularResourceL();
       
   346     // Change the current VKB layout
       
   347     iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolFullWidth );
       
   348     
       
   349 	TVirtualKeyDrawInfo vkbBoardDrawInfo(KAknsIIDQsnFrItutButtonCandiSideL, 
       
   350     									KAknsIIDQsnFrItutButtonCandiMiddle,
       
   351     								    KAknsIIDQsnFrItutButtonCandiSideR,
       
   352     						            KAknsIIDQsnFrItutButtonCandiSideL,
       
   353     						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
   354     						            KAknsIIDQsnFrItutButtonCandiSideR,
       
   355                                         KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
   356                                         KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
   357                                         KAknsIIDQsnFrItutButtonCandiPressedSideR,
       
   358     						            TRgb(194, 221, 242),
       
   359     						            ETrue);
       
   360     iVkbCtrl->SetVirtualKeyImgID(vkbBoardDrawInfo);
       
   361 
       
   362     ResetSymbolTableSize();
       
   363     iVkbCtrl->AddEventObserver( this );
       
   364 
       
   365     // Create a control group, and put vkb in it, to avoid the problem that, 
       
   366     // Root control will add all vkbs on the top of the control list.
       
   367     iSymbolTableGroup = CControlGroup::NewL( iLayout, 
       
   368         EHwrCtrlIdSymbolTableVkbGroup );
       
   369     AddToRootControlL( iSymbolTableGroup );
       
   370 
       
   371    	iSymbolTableGroup->AddControlL( iVkbCtrl );
       
   372     iSymbolTableGroup->SetActiveCtrl( iVkbCtrl );
       
   373 	}
       
   374 
       
   375 // -----------------------------------------------------------------------------
       
   376 // CPeninputHwrfscnFunctionPanel::CreateMoreFuncBtnListL()
       
   377 // .
       
   378 // -----------------------------------------------------------------------------
       
   379 //
       
   380 void CPeninputHwrfscnFunctionPanel::CreateMoreFuncBtnListL()
       
   381 	{
       
   382     // Create container
       
   383     iMoreFuncBtnGroup = CPeninputHwrfscnBkgnd::NewL( iLayout, EHwrCtrlIdMoreFuncGroup );
       
   384     iMoreFuncBtnGroup->SetResourceId( R_PENINPUT_LAYOUT_WINDOW_BACKGROUND );
       
   385     iMoreFuncBtnGroup->ConstructFromResourceL();    
       
   386     
       
   387     AddToRootControlL( iMoreFuncBtnGroup );
       
   388 
       
   389     // Add btns to the container
       
   390     // Since the language width switch btn is a latched btn which diff with other btns, 
       
   391     // it should be created separately
       
   392     /*AddBtnToMoreFuncGrpL( WidthSwitcherBtnRect(),
       
   393         EHwrCtrlIdLanguageWidthFullHalf,
       
   394         EMbmPeninputhwrfscnQgn_indi_fep_button_full_half_width,
       
   395         EMbmPeninputhwrfscnQgn_indi_fep_button_full_half_width_mask,
       
   396         EMbmPeninputhwrfscnQgn_indi_fep_button_half_full_width,
       
   397         EMbmPeninputhwrfscnQgn_indi_fep_button_half_full_width_mask );*/
       
   398 
       
   399     CAknFepCtrlCommonButton* langFullHalfWidthBtn = 
       
   400         CAknFepCtrlCommonButton::NewL( iLayout, EHwrCtrlIdLanguageWidthFullHalf,
       
   401             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   402         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   403         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   404 
       
   405 	TResourceReader reader;
       
   406     
       
   407     CCoeEnv::Static()->CreateResourceReaderLC( reader,
       
   408     	 			   R_AKN_FEP_HWR_SCT_PAGE_1 );  
       
   409     langFullHalfWidthBtn->SetResourceId( R_AKN_FEP_HWR_SCT_PAGE_1 );      
       
   410     langFullHalfWidthBtn->ConstructFromResourceL(); 
       
   411     
       
   412     // Pop and destroy reader
       
   413     CleanupStack::PopAndDestroy( 1 );
       
   414 
       
   415     langFullHalfWidthBtn->AddEventObserver( this );
       
   416 	iMoreFuncBtnGroup->AddControlL( langFullHalfWidthBtn );
       
   417 
       
   418 
       
   419 
       
   420     CAknFepCtrlCommonButton* langHalfFullWidthBtn = 
       
   421         CAknFepCtrlCommonButton::NewL( iLayout, EHwrCtrlIdLanguageWidthHalfFull,
       
   422             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   423         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   424         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   425 
       
   426     
       
   427     CCoeEnv::Static()->CreateResourceReaderLC( reader,
       
   428     	 			   R_AKN_FEP_HWR_SCT_PAGE_2 );  
       
   429     langHalfFullWidthBtn->SetResourceId( R_AKN_FEP_HWR_SCT_PAGE_2 );      
       
   430     langHalfFullWidthBtn->ConstructFromResourceL(); 
       
   431     
       
   432     // Pop and destroy reader
       
   433     CleanupStack::PopAndDestroy( 1 );
       
   434 
       
   435     langHalfFullWidthBtn->AddEventObserver( this );
       
   436 	iMoreFuncBtnGroup->AddControlL( langHalfFullWidthBtn );
       
   437 
       
   438 
       
   439 
       
   440 
       
   441    	AddBtnToMoreFuncGrpL( SpaceBtnRect(), 
       
   442    	    EHwrCtrlIdSpace, 
       
   443    	    R_AKN_FEP_HWR_SPACE );
       
   444 	// Space button          
       
   445     CAknFepCtrlEventButton* spaceButton = 
       
   446     	static_cast<CAknFepCtrlEventButton*>(iMoreFuncBtnGroup->ControlById(EHwrCtrlIdSpace));
       
   447     // Create 3-pieces color icon for space button
       
   448 	CPenInput3PiecesColorIcons* colorIcons = 
       
   449 				CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
       
   450 												  R_AKN_FEP_VKB_SPACE_ICON2,
       
   451 												  R_AKN_FEP_VKB_SPACE_ICON3 );
       
   452 	spaceButton->Set3PiecesColorIcons( colorIcons );
       
   453 
       
   454 	
       
   455    	AddBtnToMoreFuncGrpL( EnterBtnRect(), 
       
   456    	    EHwrCtrlIdEnter, 
       
   457    	    R_AKN_FEP_HWR_RETURN );
       
   458 	}
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CPeninputHwrfscnFunctionPanel::AddBtnToMoreFuncGrpL()
       
   462 // .
       
   463 // -----------------------------------------------------------------------------
       
   464 //
       
   465 void CPeninputHwrfscnFunctionPanel::AddBtnToMoreFuncGrpL( 
       
   466     const TRect aRect, 
       
   467     TInt aCtrlId, 
       
   468     TInt aResID )
       
   469 		{
       
   470 		CAknFepCtrlEventButton* moreFuncBtn = 
       
   471 		  CAknFepCtrlEventButton::NewL( iLayout, aCtrlId,
       
   472 		  									0xFFFF,
       
   473 											  0,
       
   474 		      								  KAknsIIDQsnFrFunctionButtonNormal,
       
   475 		  									  KAknsIIDQsnFrFunctionButtonPressed,
       
   476 		  									  KAknsIIDQsnFrFunctionButtonInactive );
       
   477 		moreFuncBtn->SetResourceId( aResID );
       
   478 		moreFuncBtn->ConstructFromResourceL();
       
   479 		TRect innerRect;
       
   480 		AknPenImageUtils::CalculateGraphicRect( aRect, innerRect );   	
       
   481 		moreFuncBtn->SizeChanged( aRect, innerRect, ETrue );
       
   482 		moreFuncBtn->SetRect( aRect );
       
   483 		moreFuncBtn->AddEventObserver( this );
       
   484 		
       
   485 		
       
   486 		iMoreFuncBtnGroup->AddControlL( moreFuncBtn );
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CPeninputHwrfscnFunctionPanel::OnControlEvent_ButtonUp()
       
   491 // .
       
   492 // -----------------------------------------------------------------------------
       
   493 //
       
   494 void CPeninputHwrfscnFunctionPanel::OnControlEvent_ButtonUp( 
       
   495     TInt aEventType, 
       
   496     CFepUiBaseCtrl* aCtrl, 
       
   497 	const TDesC& aEventData )
       
   498     {
       
   499     if( aCtrl->ControlId() == EHwrCtrlIdLanguageWidthFullHalf 
       
   500       || aCtrl->ControlId() == EHwrCtrlIdLanguageWidthHalfFull)
       
   501         {
       
   502         if( iLayout->DataStore().PermittedRanges().Find( ERangeNative ) != 
       
   503             KErrNotFound )
       
   504             {
       
   505             // Switch language width state
       
   506             iLangWidthState == EFullWidth? iLangWidthState = EHalfWidth:
       
   507                                            iLangWidthState = EFullWidth;
       
   508             
       
   509             // Show VKB layout corresponding to current language width state
       
   510             iLangWidthState == EFullWidth ? 
       
   511             	iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolFullWidth ) : 
       
   512             	iVkbLayout->ChangeVkbLayout( EAknFepVkbSymbolHalfWidth );
       
   513             
       
   514             TVirtualKeyDrawInfo vkbBoardDrawInfo(KAknsIIDQsnFrItutButtonCandiSideL, 
       
   515     									KAknsIIDQsnFrItutButtonCandiMiddle,
       
   516     								    KAknsIIDQsnFrItutButtonCandiSideR,
       
   517     						            KAknsIIDQsnFrItutButtonCandiSideL,
       
   518     						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
   519     						            KAknsIIDQsnFrItutButtonCandiSideR,
       
   520                                         KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
   521                                         KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
   522                                         KAknsIIDQsnFrItutButtonCandiPressedSideR,
       
   523     						            TRgb(194, 221, 242),
       
   524     						            ETrue);
       
   525             iVkbCtrl->SetVirtualKeyImgID(vkbBoardDrawInfo);
       
   526             
       
   527 	        CAknFepCtrlCommonButton* butonFullHalf = static_cast<CAknFepCtrlCommonButton*>( 
       
   528 	        iMoreFuncBtnGroup->ControlById( EHwrCtrlIdLanguageWidthFullHalf ) );
       
   529 	        
       
   530 	        CAknFepCtrlCommonButton* butonHalfFull = static_cast<CAknFepCtrlCommonButton*>( 
       
   531 	        iMoreFuncBtnGroup->ControlById( EHwrCtrlIdLanguageWidthHalfFull ) );  
       
   532 	        
       
   533             iLangWidthState == EFullWidth? butonFullHalf->Hide(EFalse):
       
   534                                            butonHalfFull->Hide(EFalse);
       
   535                                            
       
   536             iLangWidthState == EFullWidth? butonHalfFull->Hide(ETrue):
       
   537                                            butonFullHalf->Hide(ETrue);
       
   538             
       
   539             // reset rect and dim
       
   540 	        iVkbCtrl->SetRect( SymbolTableRect() );
       
   541 		    TRAP_IGNORE( NumberModeDimKeysL() );
       
   542 		    iLayout->LayoutOwner()->UpdateArea( SymbolTableRect(), EFalse, EFalse );
       
   543             }
       
   544         }
       
   545     /*
       
   546     else if( aCtrl->ControlId() == EHwrCtrlIdVkbSwitcher )
       
   547         {
       
   548         TRect rect = aCtrl->Rect();   
       
   549         TRAP_IGNORE( iInputModeSwitch->PopUpSwitchListL( rect ) );        
       
   550         }
       
   551     */
       
   552     else
       
   553         {
       
   554         Show( EFalse );
       
   555         ReportEvent( aEventType, aCtrl, aEventData );
       
   556         }
       
   557     }
       
   558 
       
   559 // -----------------------------------------------------------------------------
       
   560 // CPeninputHwrfscnFunctionPanel::NumberModeDimKeysL()
       
   561 // .
       
   562 // -----------------------------------------------------------------------------
       
   563 //
       
   564 void CPeninputHwrfscnFunctionPanel::NumberModeDimKeysL()
       
   565     {
       
   566    	iVkbCtrl->CancelDims();
       
   567 
       
   568     if( iLayout->DataStore().PermittedRanges().Count() == 1
       
   569         && iLayout->DataStore().PermittedRanges()[0] == ERangeNumber )
       
   570         {
       
   571         HBufC* rs = iLayout->DataStore().KeyMappingStringL();
       
   572         iVkbCtrl->DimKeys( rs );
       
   573         delete rs;
       
   574         rs = NULL;
       
   575         }
       
   576 
       
   577     iVkbCtrl->Draw();
       
   578     }
       
   579 
       
   580 
       
   581 // -----------------------------------------------------------------------------
       
   582 // CPeninputHwrfscnFunctionPanel::ReadLAFInfo()
       
   583 // .
       
   584 // -----------------------------------------------------------------------------
       
   585 //
       
   586 void CPeninputHwrfscnFunctionPanel::ReadLAFInfo()
       
   587     {
       
   588 	TRect rect( PeninputHwrfscnLAFManager::ControlBarUnitRect() );
       
   589 	iUnitWidth = rect.Width();
       
   590 	iUnitHeight = rect.Height();
       
   591     }
       
   592 
       
   593 // -----------------------------------------------------------------------------
       
   594 // CPeninputHwrfscnFunctionPanel::ResetMoreFuncBtnsSize()
       
   595 // .
       
   596 // -----------------------------------------------------------------------------
       
   597 //
       
   598 void CPeninputHwrfscnFunctionPanel::ResetMoreFuncBtnsSize()
       
   599 	{
       
   600 	const CFont* font = PeninputHwrfscnLAFManager::SymbolTableFont();
       
   601 	
       
   602 	RPointerArray<CFepUiBaseCtrl> moreFuncBtnList = 
       
   603 	    iMoreFuncBtnGroup->ControlList();
       
   604 
       
   605     for ( int i = 0; i < EMoreFuncBtnCount; i++ )
       
   606 	    {
       
   607 	    CAknFepCtrlCommonButton* button = 
       
   608 	        static_cast<CAknFepCtrlCommonButton*>( moreFuncBtnList[i] );
       
   609 	    
       
   610         switch( button->ControlId() )
       
   611             {
       
   612             case EHwrCtrlIdLanguageWidthFullHalf:
       
   613             case EHwrCtrlIdLanguageWidthHalfFull:
       
   614                 {
       
   615         	    TRect rect( WidthSwitcherBtnRect() );
       
   616 				TRect innerRect;
       
   617 				AknPenImageUtils::CalculateLongBtnGraphicRect( rect, innerRect );
       
   618 				button->SizeChanged( rect, innerRect, ETrue );
       
   619         	    button->SetRect( rect );
       
   620     	        }
       
   621                 break;
       
   622 
       
   623             case EHwrCtrlIdSpace:
       
   624     			{
       
   625         	    TRect rect( SpaceBtnRect() );
       
   626 				TRect innerRect;
       
   627 				innerRect = rect;
       
   628 				innerRect.Shrink(10, 0);
       
   629         	    button->SizeChanged( rect, innerRect, ETrue );
       
   630 			    TRect spaceIconRect = innerRect;
       
   631 			    spaceIconRect.Shrink(10, 0);
       
   632 				button->SetDraw3PieceFrameInfo(TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
       
   633 																  KAknsIIDQgnIndiInputSpaceMiddle,
       
   634 																  KAknsIIDQgnIndiInputSpaceR,
       
   635 																  spaceIconRect));         	    
       
   636         	    button->SetRect( rect );
       
   637         	    button->SetFont( font );            
       
   638         		}
       
   639                 break;
       
   640             
       
   641             case EHwrCtrlIdEnter:
       
   642                 {
       
   643         	    TRect rect( EnterBtnRect() );
       
   644 				TRect innerRect;
       
   645 				AknPenImageUtils::CalculateGraphicRect( rect, innerRect );   	    
       
   646         	    button->SizeChanged( rect, innerRect, ETrue );
       
   647         	    button->SetRect( rect );
       
   648         	    button->SetFont( font );            
       
   649                 }
       
   650                 break;
       
   651             default:
       
   652             	break;
       
   653     	    }
       
   654 	    }
       
   655 	
       
   656 	// Bitmap should be resized by the first time construct
       
   657 	TSize bitMapSize( iUnitWidth, iUnitHeight );
       
   658 	AknIconUtils::SetSize( iSvgLatched, bitMapSize, EAspectRatioNotPreserved );
       
   659 	AknIconUtils::SetSize( iSvgUnLatched, bitMapSize, EAspectRatioNotPreserved );
       
   660     
       
   661 	}
       
   662 
       
   663 // -----------------------------------------------------------------------------
       
   664 // CPeninputHwrfscnFunctionPanel::ResetSymbolTableSize()
       
   665 // .
       
   666 // -----------------------------------------------------------------------------
       
   667 //
       
   668 void CPeninputHwrfscnFunctionPanel::ResetSymbolTableSize()
       
   669     {
       
   670     const CFont* font = PeninputHwrfscnLAFManager::SymbolTableFont();
       
   671     
       
   672     TPoint charLeftTop( 0, 0 );
       
   673     
       
   674     TSize size( PeninputHwrfscnLAFManager::GetSymbolTableCharSizeOffset() );
       
   675     
       
   676     TInt unitCharWidth = iUnitWidth - 2*size.iWidth;
       
   677     TInt unitCharHeight = iUnitHeight - 2*size.iHeight;
       
   678 
       
   679     // Get all VKB layout information and resize them
       
   680     RPointerArray<CPeninputVkbLayoutInfo> vkbList = 
       
   681         iVkbLayout->VkbLayoutInfoList();
       
   682     
       
   683     TInt count = vkbList.Count();
       
   684     
       
   685     for ( TInt i = 0; i < count; i++ )
       
   686         {
       
   687         vkbList[i]->ResetSize( iUnitWidth, 
       
   688                                iUnitHeight, 
       
   689                                unitCharWidth, 
       
   690                                unitCharHeight, 
       
   691                                charLeftTop, 
       
   692                                font );
       
   693         }
       
   694 	
       
   695   	TSize curSize = TSize( iUnitWidth, iUnitHeight );
       
   696     size = iVkbCtrl->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
   697 	if( curSize != size )	
       
   698 		{
       
   699         for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
   700             {
       
   701             if( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
   702             	{
       
   703                 AknIconUtils::SetSize( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
   704                                        curSize, EAspectRatioNotPreserved );                    		
       
   705             	}
       
   706             }
       
   707 		}	
       
   708 	iVkbCtrl->SetRect( SymbolTableRect() );
       
   709     iVkbCtrl->SetFont( font );
       
   710     
       
   711     //This modification is for EVWG-7VW2Z7, change another smaller layout font 
       
   712     TAknTextLineLayout keypadText =
       
   713 		//AknLayoutScalable_Avkon::cell_hwr_candidate_pane_t1().LayoutLine();
       
   714         AknLayoutScalable_Avkon::cell_vkb_candidate_pane_t1().LayoutLine();
       
   715     //Modification for EVWG-7VW2Z7 end
       
   716     iVkbCtrl->SetTextLineLayout(keypadText);
       
   717     }
       
   718 
       
   719 // -----------------------------------------------------------------------------
       
   720 // CPeninputHwrfscnFunctionPanel::MoreFuncBtnGroupRect()
       
   721 // .
       
   722 // -----------------------------------------------------------------------------
       
   723 //
       
   724 TRect CPeninputHwrfscnFunctionPanel::MoreFuncBtnGroupRect()
       
   725 	{
       
   726 	TSize size( KSymbolTableColumnCount * iUnitWidth, iUnitHeight );
       
   727 	
       
   728 	return TRect( iPos, size );
       
   729 	}
       
   730 
       
   731 // -----------------------------------------------------------------------------
       
   732 // CPeninputHwrfscnFunctionPanel::WidthSwitcherBtnRect()
       
   733 // .
       
   734 // -----------------------------------------------------------------------------
       
   735 //
       
   736 TRect CPeninputHwrfscnFunctionPanel::WidthSwitcherBtnRect( )
       
   737 	{
       
   738 	TPoint pos( iPos );
       
   739 	
       
   740 	TSize size( iUnitWidth * KWidthSwitcherBtnWidthUintNum, iUnitHeight );
       
   741 	
       
   742 	return TRect ( pos, size );
       
   743 	}
       
   744 
       
   745 // -----------------------------------------------------------------------------
       
   746 // CPeninputHwrfscnFunctionPanel::SpaceBtnRect()
       
   747 // .
       
   748 // -----------------------------------------------------------------------------
       
   749 //
       
   750 TRect CPeninputHwrfscnFunctionPanel::SpaceBtnRect( )
       
   751 	{
       
   752 	TRect funcRect(WidthSwitcherBtnRect());
       
   753 	
       
   754 	TPoint pos( funcRect.iBr.iX, funcRect.iTl.iY );
       
   755 	
       
   756 	TSize size( iUnitWidth * KSpaceWidthUintNum, iUnitHeight );
       
   757 	
       
   758 	return TRect ( pos, size );
       
   759 	}
       
   760 
       
   761 // -----------------------------------------------------------------------------
       
   762 // CPeninputHwrfscnFunctionPanel::EnterBtnRect()
       
   763 // .
       
   764 // -----------------------------------------------------------------------------
       
   765 //
       
   766 TRect CPeninputHwrfscnFunctionPanel::EnterBtnRect( )
       
   767 	{
       
   768 	TRect funcRect( SpaceBtnRect() );
       
   769 	
       
   770 	TPoint pos( funcRect.iBr.iX, funcRect.iTl.iY );
       
   771 	
       
   772 	TSize size( iUnitWidth * KEnterWidthUintNum, iUnitHeight );
       
   773 	
       
   774 	return TRect ( pos, size );
       
   775 	}
       
   776 		
       
   777 
       
   778 // -----------------------------------------------------------------------------
       
   779 // CPeninputHwrfscnFunctionPanel::SymbolTableRect()
       
   780 // .
       
   781 // -----------------------------------------------------------------------------
       
   782 // 
       
   783 TRect CPeninputHwrfscnFunctionPanel::SymbolTableRect()
       
   784 	{
       
   785     TSize size( KSymbolTableColumnCount * iUnitWidth,
       
   786         KSymbolTableRowCount * iUnitHeight );
       
   787     
       
   788     return TRect( TPoint( iPos.iX, iPos.iY+iUnitHeight ), size );
       
   789 	}
       
   790 	
       
   791 // -----------------------------------------------------------------------------
       
   792 // CPeninputHwrfscnFunctionPanel::HandleSkinChanged()
       
   793 // .
       
   794 // -----------------------------------------------------------------------------
       
   795 // 
       
   796 void CPeninputHwrfscnFunctionPanel::HandleSkinChanged()
       
   797 	{
       
   798 	TRAP_IGNORE(iVkbLayout->ConstructFromNonIrregularResourceL());
       
   799 	ResetSymbolTableSize();
       
   800 	TInt newValue = iLayout->DataStore().GetPenTrailColor();
       
   801 	iLayout->DataStore().SetBoxPenColor(TRgb(newValue));
       
   802 	
       
   803 	}
       
   804 
       
   805 //End of file