textinput/peninputhwrfscn/src/peninputhwrfscncontrolbar.cpp
changeset 0 eb1f2e154e89
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 <AknsUtils.h>
       
    20 #include <AknUtils.h>
       
    21 #include <peninputhwrfscn.mbg>
       
    22 #include <peninputhwrfscreencn.rsg>
       
    23 #include <peninputcmd.h>
       
    24 #include <AknFepGlobalEnums.h>
       
    25 #include <peninputlayoutinputmodechoice.h>
       
    26 
       
    27 // USER INCLUDES
       
    28 #include "peninputhwrfscnlayout.h"
       
    29 #include "peninputhwrfscncontrolbar.h"
       
    30 #include "peninputhwrfscncontrolid.h"
       
    31 #include "peninputhwrfscndatastore.h"
       
    32 #include "peninputhwrfscnevent.h"
       
    33 #include "peninputhwrfscnlafmanager.h"
       
    34 
       
    35 #include "peninputhwrfscnbkgnd.h"
       
    36 
       
    37 // CONSTANTS
       
    38 
       
    39 //Range defination
       
    40 const TInt Ranges[3] = {ERangeNative, ERangeEnglish, ERangeNumber};
       
    41 
       
    42 const TUint8 KControlBarWidthUnitNum  = 4;
       
    43 const TUint8 KUnitNumDiffOfMoreFuncAndControlBar = 2;
       
    44 const TUint8 KBackspaceWidthUintNum = 2;
       
    45 
       
    46 // ============================ MEMBER FUNCTIONS ===============================
       
    47   
       
    48 // -----------------------------------------------------------------------------
       
    49 // CPeninputHwrfscnControlBar::NewL()
       
    50 // .
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CPeninputHwrfscnControlBar* CPeninputHwrfscnControlBar::NewL( 
       
    54     CPeninputHwrfscnLayout* aLayout )
       
    55     {
       
    56     CPeninputHwrfscnControlBar* self = new 
       
    57         ( ELeave ) CPeninputHwrfscnControlBar( aLayout );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL( );
       
    60     CleanupStack::Pop( );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CPeninputHwrfscnControlBar::CPeninputHwrfscnControlBar()
       
    66 // .
       
    67 // -----------------------------------------------------------------------------
       
    68 //	
       
    69 CPeninputHwrfscnControlBar::CPeninputHwrfscnControlBar( 
       
    70     CPeninputHwrfscnLayout* aLayout )
       
    71     :CPeninputHwrfscnBasePanel( aLayout ),
       
    72     iRangeSwitchExpanded( EFalse ),
       
    73     iCurrentActiveRange( ERangeInvalid )
       
    74     {
       
    75     // Temp use
       
    76     iPos = TPoint( 0, 0 );
       
    77 
       
    78     // Use the iCurrentActiveRange to record which Range is active now
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CPeninputHwrfscnControlBar::~CPeninputHwrfscnControlBar()
       
    83 // .
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 CPeninputHwrfscnControlBar::~CPeninputHwrfscnControlBar( )
       
    87     {
       
    88     delete iFunctionPanel;
       
    89     iCurrentRangeList.Close( );
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CPeninputHwrfscnControlBar::ConstructL()
       
    94 // .
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CPeninputHwrfscnControlBar::ConstructL( )
       
    98     {
       
    99     // First set all Range available
       
   100     iLayout->DataStore( ).SetPermittedRanges( 
       
   101         ERangeNative | ERangeEnglish | ERangeNumber );
       
   102     iLayout->DataStore( ).AddSubscriber( this );
       
   103 
       
   104     UpdateCurrentActiveRangeList( );
       
   105     
       
   106     ReadLAFInfo( );
       
   107     
       
   108     iBkgndWnd1 = CPeninputHwrfscnBkgnd::NewL( iLayout, EHwrCtrlIdBkgndWnd1 );
       
   109     iBkgndWnd1->SetResourceId( R_PENINPUT_LAYOUT_WINDOW_BACKGROUND );
       
   110     iBkgndWnd1->ConstructFromResourceL();
       
   111     AddToRootControlL( iBkgndWnd1 );
       
   112     
       
   113     iBkgndWnd2 = CPeninputHwrfscnBkgnd::NewL( iLayout, EHwrCtrlIdBkgndWnd2 );
       
   114     iBkgndWnd2->SetResourceId( R_PENINPUT_LAYOUT_WINDOW_BACKGROUND );
       
   115     iBkgndWnd2->ConstructFromResourceL();
       
   116     AddToRootControlL( iBkgndWnd2 );
       
   117     
       
   118     CreateCloseBtnL();
       
   119     
       
   120     CreateOptionBtnL();
       
   121     
       
   122     CreateVkbSwitcherBtnL();
       
   123     
       
   124     CreateRangeSwitchBtnGroupL( );
       
   125 
       
   126     // Create the a button group which cover the first Range switch btn
       
   127     // It is to say, when the Range switch group expanded it use the 
       
   128     // real Range btn, when rolled-up, it will display this cover btn
       
   129     CreateRangeSwitchCoverBtnGroupL( );
       
   130 
       
   131     CreateMoreFuncBtnL( );
       
   132 
       
   133     CreateMoreFuncPanelL( );
       
   134 
       
   135     CreateBackSpaceBtnL( );
       
   136     
       
   137     iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL(
       
   138                                      iLayout,
       
   139                                      EHwrCtrlIdInputModeSwitcher,
       
   140                                      EPluginInputModeFSc );
       
   141     iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
       
   142     iLayout->AddControlL( iInputModeSwitch );
       
   143     iInputModeSwitch->AddEventObserver( iLayout );
       
   144     
       
   145     // resize iBkgndWnd1, cover following buttons: close, option, switcher
       
   146     TRect rect = ControlBarBtnRect( ECloseBtn );
       
   147     rect.BoundingRect( ControlBarBtnRect( EOptionBtn ) );
       
   148     rect.BoundingRect( ControlBarBtnRect( EVkbSwitcherBtn ) );
       
   149     iBkgndWnd1->SetRect( rect );
       
   150 
       
   151     // resize iBkgndWnd2, cover following buttons: more, backspace
       
   152     rect = MoreFuncBtnRect();
       
   153     rect.BoundingRect( BackSpaceBtnRect() );
       
   154     iBkgndWnd2->SetRect( rect );
       
   155     
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CPeninputHwrfscnControlBar::Show()
       
   160 // .
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 void CPeninputHwrfscnControlBar::Show( TBool /*aVisible*/ )
       
   164     {
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CPeninputHwrfscnControlBar::Draw()
       
   169 // .
       
   170 // -----------------------------------------------------------------------------
       
   171 // 
       
   172 void CPeninputHwrfscnControlBar::Draw( )
       
   173     {
       
   174     TRect rect( iMoreFuncBtn->Rect( ) );
       
   175 
       
   176     iMoreFuncBtn->Draw( );
       
   177     iLayout->LayoutOwner( )->UpdateArea( rect, EFalse,EFalse );
       
   178 
       
   179     
       
   180     rect = iCoverRangeSwitchBtnGroup->Rect();
       
   181     iCoverRangeSwitchBtnGroup->Draw( );
       
   182     iLayout->LayoutOwner( )->UpdateArea( rect, EFalse,EFalse );
       
   183     
       
   184     rect = iRangeSwitchBtnGroup->Rect( );
       
   185     iRangeSwitchBtnGroup->Draw( );
       
   186     iLayout->LayoutOwner( )->UpdateArea( rect, EFalse,EFalse ); 
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // CPeninputHwrfscnControlBar::HandleControlEvent()
       
   191 // .
       
   192 // -----------------------------------------------------------------------------
       
   193 //
       
   194 void CPeninputHwrfscnControlBar::HandleControlEvent( 
       
   195     TInt aEventType, 
       
   196     CFepUiBaseCtrl* aCtrl, 
       
   197 	const TDesC& aEventData )
       
   198     {
       
   199     switch( aEventType )
       
   200         {
       
   201         // This event is passed from the symbol list
       
   202         case EEventVirtualKeyUp:
       
   203    		    {
       
   204    		    iMoreFuncBtn->SetHighlight( EFalse );  
       
   205             ReportEvent( aEventType, aCtrl, aEventData );
       
   206    		    Draw( );  
       
   207    		    }
       
   208             break;
       
   209 
       
   210         case EEventButtonUp:
       
   211             {
       
   212             OnControlEvent_ButtonUp( aEventType, aCtrl, aEventData );
       
   213             }
       
   214             break;
       
   215 
       
   216         case EEventButtonDown:
       
   217             {
       
   218             OnControlEvent_ButtonDown( aEventType, aCtrl, aEventData );
       
   219             }
       
   220             break;
       
   221         case EHwrEventKeyBack:
       
   222             ReportEvent( aEventType, aCtrl, aEventData );
       
   223             break;
       
   224         default:
       
   225             break;
       
   226         }
       
   227     }
       
   228 
       
   229 // -----------------------------------------------------------------------------
       
   230 // CPeninputHwrfscnControlBar::HandleCommand()
       
   231 // .
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 void CPeninputHwrfscnControlBar::HandleCommand( TInt aCommand, TUint8* /*aData*/ )
       
   235     {
       
   236     if ( aCommand == EHwrEventPointerOutsideWnd )
       
   237         {
       
   238         // Hide the range list if it is extended
       
   239         if( iRangeSwitchExpanded )
       
   240            {
       
   241            CloseRangeSwitchList( );
       
   242            }
       
   243         
       
   244         // Hide the function panel if it is visible
       
   245         if( iFunctionPanel->IsVisible( ) )
       
   246     	    {
       
   247     	    ShowMoreFuncList( EFalse );
       
   248     	    }
       
   249         }
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CPeninputHwrfscnControlBar::BeforePropertyChangedL()
       
   254 // .
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 TBool CPeninputHwrfscnControlBar::BeforePropertyChangedL( 
       
   258     MPeninputHwrfscnPropertySubscriber::TPeninputHwrfscnProperty /*aProptery*/ )
       
   259     {
       
   260     return EFalse;
       
   261     }
       
   262 
       
   263 // -----------------------------------------------------------------------------
       
   264 // CPeninputHwrfscnControlBar::PropertyChangedL()
       
   265 // .
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 void CPeninputHwrfscnControlBar::PropertyChangedL( 
       
   269 	MPeninputHwrfscnPropertySubscriber::TPeninputHwrfscnProperty aProptery )
       
   270     {
       
   271     // If the permitted range changed, it should reorganized the Range switch btn
       
   272     if ( EPeninputHwrfscnPropertyPermittedRange == aProptery )
       
   273         {
       
   274         //close the range switch list if it was expended before
       
   275         if( iRangeSwitchExpanded )
       
   276             {
       
   277             CloseRangeSwitchList( );
       
   278             }
       
   279        
       
   280         //remove all buttons on range switch and cover range switch group
       
   281         RemoveAllSwitchBtns( );
       
   282         
       
   283         UpdateCurrentActiveRangeList( );
       
   284         
       
   285         UpdateRangeSwitchL( );
       
   286         
       
   287         UpdateCoverRangeSwitchL( );
       
   288         
       
   289         SetActiveCoverRangeBtn( );
       
   290         
       
   291         Draw();
       
   292         }
       
   293     else if( EPeninputHwrfscnPropertyRange == aProptery )
       
   294         {
       
   295         UpdateCurrentActiveRange( );
       
   296        
       
   297         HideCoverRangeSwitchBtns( );
       
   298 		
       
   299 		SetActiveCoverRangeBtn( );
       
   300 		Draw();
       
   301         }
       
   302     }
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CPeninputHwrfscnControlBar::SizeChanged()
       
   306 // .
       
   307 // -----------------------------------------------------------------------------
       
   308 //
       
   309 void CPeninputHwrfscnControlBar::SizeChanged( )
       
   310     {
       
   311     // read related LAF information    
       
   312     ReadLAFInfo( );
       
   313 	
       
   314 	// set the function panel position
       
   315 	iFunctionPanel->SetPostion( 
       
   316 	    TPoint( iPos.iX-KUnitNumDiffOfMoreFuncAndControlBar*iUnitWidth,
       
   317 	    iPos.iY+iUnitHeight ) );
       
   318     
       
   319     // change the cover range buttons size
       
   320 	ResetCoverRangeSwitchSize( );
       
   321 	
       
   322 	// change the range list buttons size
       
   323 	ResetRangeSwitchSize( );
       
   324 	
       
   325 	// change the more function button size
       
   326 	ResetMoreFuncBtnSize( );
       
   327 	
       
   328 	// change the backspce button size
       
   329 	ResetBackSpaceBtnSize( );
       
   330 	
       
   331 	// change option, vkbswitcher, close buttons size
       
   332 	ResetControlBarBtnSize();
       
   333 	
       
   334 	// resize iBkgndWnd1, cover following buttons: close, option, switcher  
       
   335     TRect rect = ControlBarBtnRect( ECloseBtn );
       
   336     rect.BoundingRect( ControlBarBtnRect( EOptionBtn ) );
       
   337     rect.BoundingRect( ControlBarBtnRect( EVkbSwitcherBtn ) );
       
   338     iBkgndWnd1->SetRect( rect );
       
   339 
       
   340     // resize iBkgndWnd2, cover following buttons: more, backspace
       
   341     rect = MoreFuncBtnRect();
       
   342     rect.BoundingRect( BackSpaceBtnRect() );
       
   343     iBkgndWnd2->SetRect( rect );	
       
   344     }
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 // CPeninputHwrfscnControlBar::LafChanged()
       
   348 // .
       
   349 // -----------------------------------------------------------------------------
       
   350 //
       
   351 void CPeninputHwrfscnControlBar::LafChanged( )
       
   352     {
       
   353     }
       
   354 
       
   355 // -----------------------------------------------------------------------------
       
   356 // CPeninputHwrfscnControlBar::OnControlEvent_ButtonDown()
       
   357 // .
       
   358 // -----------------------------------------------------------------------------
       
   359 //
       
   360 void CPeninputHwrfscnControlBar::OnControlEvent_ButtonDown( TInt aEventType, 
       
   361     CFepUiBaseCtrl* aCtrl, 
       
   362 	const TDesC& aEventData )
       
   363     {
       
   364     // When Range switch list shown, click on btn and not release mouse until
       
   365     // move the mouse outside the btn, the display status should not changed, i.e.
       
   366     // the latched status keeps the same
       
   367     if( iRangeSwitchExpanded && ClickIsInRangeSwitchGrp( aCtrl ) )
       
   368 		{
       
   369 		ShowRangeSwitchBtnsLatched( );
       
   370         
       
   371         static_cast<CAknFepCtrlCommonButton*>( aCtrl )->SetHighlight( ETrue );
       
   372 
       
   373         Draw( );
       
   374 		}
       
   375 		
       
   376     ReportEvent( aEventType, aCtrl, aEventData );
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CPeninputHwrfscnControlBar::EventTypeByCtrlId()
       
   381 // .
       
   382 // -----------------------------------------------------------------------------
       
   383 //
       
   384 TInt CPeninputHwrfscnControlBar::EventTypeByCtrlId( TInt aCtrlId )
       
   385 {
       
   386 	TInt eventType = 0;
       
   387     
       
   388     switch ( aCtrlId )
       
   389         {
       
   390         case EHwrCtrlIdBackspace:
       
   391             eventType = EHwrEventKeyBack;
       
   392             break;
       
   393         
       
   394         case EHwrCtrlIdEnter:
       
   395             eventType = EHwrEventKeyEnter;
       
   396             break;
       
   397         
       
   398         case EHwrCtrlIdSpace:
       
   399             eventType = EHwrEventKeySpace;
       
   400             break;
       
   401                 
       
   402         case EHwrCtrlIdMoreFunc:
       
   403             eventType = EHwrEventBtnMoreFunction;
       
   404             break;                
       
   405         
       
   406         case EHwrCtrlIdVkbSwitcher:
       
   407             eventType = EHwrEventVkbSwitch;
       
   408             break;
       
   409         
       
   410         case EHwrCtrlIdLanguageOption:
       
   411             eventType = EHwrEventTouchInputOption; 
       
   412             break;
       
   413         
       
   414         case EHwrCtrlIdChineseButton:
       
   415             eventType = EHwrEventSetRangeChinese;
       
   416             break;
       
   417         
       
   418         case EHwrCtrlIdEnglishButton:
       
   419             eventType = EHwrEventSetRangeEnglish;
       
   420             break;
       
   421         
       
   422         case EHwrCtrlIdNumberButton:
       
   423             eventType = EHwrEventSetRangeNumber;
       
   424             break;
       
   425         
       
   426         case EHwrCtrlIdCoverChineseButton:
       
   427         case EHwrCtrlIdCoverEnglishButton:
       
   428         case EHwrCtrlIdCoverNumberButton:
       
   429         case EHwrCtrlIdCoverSymbolButton:
       
   430             eventType = EHwrEventRangeClick;
       
   431             break;
       
   432             
       
   433         case EHwrCtrlIdClose:
       
   434             eventType = EHwrEventClose;
       
   435             break;
       
   436         default:
       
   437             break;
       
   438         }
       
   439         
       
   440     return eventType;
       
   441 }
       
   442 
       
   443 // ----------------------------------------------------------------------------
       
   444 // CChineseFullScreenLayout::OnControlEvent_ButtonUp
       
   445 // .
       
   446 // ----------------------------------------------------------------------------
       
   447 //
       
   448 void CPeninputHwrfscnControlBar::OnControlEvent_ButtonUp( 
       
   449     TInt aEventType, 
       
   450     CFepUiBaseCtrl* aCtrl, 
       
   451 	const TDesC& aEventData )
       
   452 	{    
       
   453     TBool handled = EFalse;
       
   454     
       
   455     // if the rangelist is expanded and then close it
       
   456     
       
   457     if( aCtrl == iBackSpaceBtn )
       
   458         {
       
   459         handled = ETrue;
       
   460         }
       
   461     
       
   462     if( iRangeSwitchExpanded )
       
   463         {
       
   464         if( aCtrl == iBackSpaceBtn )
       
   465             {
       
   466             handled = ETrue;
       
   467             }
       
   468         CloseRangeSwitchList( );
       
   469         }
       
   470     
       
   471     // check which control was pressed    
       
   472     // event sent by backspace button
       
   473     if( aCtrl == iBackSpaceBtn )
       
   474 		{
       
   475 		if( iFunctionPanel->IsVisible( ) )
       
   476 		    {
       
   477 		    handled = ETrue;
       
   478 		    ShowMoreFuncList( EFalse );
       
   479 		    }
       
   480 		}
       
   481         		
       
   482     // event sent by the button on rang list
       
   483     else if( ClickIsInRangeSwitchGrp( aCtrl ) )
       
   484         {
       
   485         // Set clicked btn as the active control
       
   486 		iRangeSwitchBtnGroup->SetActiveCtrl( aCtrl );   
       
   487         }    
       
   488     // event sent by more function button
       
   489     else if( aCtrl == iMoreFuncBtn )
       
   490 	    {
       
   491 	    ShowMoreFuncList( !iFunctionPanel->IsVisible( ) );    
       
   492 	    }
       
   493 	// event sent by the button on cover range group    
       
   494 	else if( aCtrl == iCoverRangeSwitchBtnGroup->ActiveControl( ) )
       
   495 		{
       
   496         // Hide the more function panel if it is visible 
       
   497 		if( iFunctionPanel->IsVisible( ) )
       
   498 		    {
       
   499 		    ShowMoreFuncList( EFalse );
       
   500 		    }
       
   501         
       
   502         // if the rang number is more than 1, then open ranglist
       
   503         if( iCurrentRangeList.Count( ) > 1 )
       
   504             {
       
   505             OpenRangeSwitchList( );
       
   506             }   
       
   507 		}
       
   508     else if( aCtrl->ControlId() == EHwrCtrlIdVkbSwitcher )
       
   509         {
       
   510         iLayout->ClearScreen();
       
   511 		if( iFunctionPanel->IsVisible( ) )
       
   512 		    {
       
   513 		    ShowMoreFuncList( EFalse );
       
   514 		    }
       
   515 		else
       
   516 		    {
       
   517 		    TRect rect = aCtrl->Rect();   
       
   518             TRAP_IGNORE( iInputModeSwitch->PopUpSwitchListL( rect ) );
       
   519 		    }       
       
   520         }
       
   521     else if( aCtrl->ControlId() == EHwrCtrlIdLanguageOption )
       
   522         {
       
   523 		if( iFunctionPanel->IsVisible( ) )
       
   524 		    {
       
   525 		    ShowMoreFuncList( EFalse );
       
   526 		    }
       
   527         }
       
   528 	//the events sent by function panel
       
   529 	else 
       
   530 	    {
       
   531 	    iMoreFuncBtn->SetHighlight( EFalse );
       
   532 	    Draw( );
       
   533 	    }
       
   534 	
       
   535 	// Give the event to layout if the event was not consumed by this panel
       
   536     if( !handled )
       
   537 	    {	    	
       
   538 	    // convert to eventtype by the control ID
       
   539 	    aEventType = EventTypeByCtrlId( aCtrl->ControlId( ) );
       
   540 	    
       
   541 	    //sent to layout
       
   542 	    ReportEvent( aEventType, aCtrl, aEventData );
       
   543 	    }
       
   544 	}
       
   545 
       
   546 // ----------------------------------------------------------------------------
       
   547 // CChineseFullScreenLayout::CreateCloseBtnL()
       
   548 // .
       
   549 // ----------------------------------------------------------------------------
       
   550 //
       
   551 void CPeninputHwrfscnControlBar::CreateCloseBtnL( )
       
   552     {
       
   553    	iCloseBtn = CAknFepCtrlEventButton::NewL( iLayout, EHwrCtrlIdClose, 
       
   554    											  0xFFFF,
       
   555    											  0,
       
   556             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   557         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   558         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   559    	iCloseBtn->SetResourceId( R_AKN_FEP_HWR_CLOSE );
       
   560    	iCloseBtn->ConstructFromResourceL( );
       
   561    	TRect innerRect;
       
   562 	AknPenImageUtils::CalculateGraphicRect( ControlBarBtnRect( ECloseBtn ), innerRect );
       
   563     iCloseBtn->SizeChanged( ControlBarBtnRect( ECloseBtn ), innerRect, ETrue );
       
   564    	iCloseBtn->SetRect( ControlBarBtnRect( ECloseBtn ) );
       
   565    	iBkgndWnd1->AddControlL( iCloseBtn );
       
   566    	iCloseBtn->AddEventObserver( this );    
       
   567     }
       
   568 
       
   569 // ----------------------------------------------------------------------------
       
   570 // CChineseFullScreenLayout::CreateOptionBtnL()
       
   571 // .
       
   572 // ----------------------------------------------------------------------------
       
   573 //
       
   574 void CPeninputHwrfscnControlBar::CreateOptionBtnL( )
       
   575     {
       
   576    	iOptionBtn = CAknFepCtrlEventButton::NewL( iLayout, EHwrCtrlIdLanguageOption, 
       
   577    											  0xFFFF,
       
   578    											  0,
       
   579             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   580         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   581         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   582    	iOptionBtn->SetResourceId( R_AKN_FEP_HWR_OPTION );
       
   583    	iOptionBtn->ConstructFromResourceL( );
       
   584    	TRect innerRect;
       
   585 	AknPenImageUtils::CalculateGraphicRect( ControlBarBtnRect( EOptionBtn ), innerRect );
       
   586    	
       
   587     iOptionBtn->SizeChanged( ControlBarBtnRect( EOptionBtn ), innerRect, ETrue );
       
   588    	iOptionBtn->SetRect( ControlBarBtnRect( EOptionBtn ) );
       
   589    	iBkgndWnd1->AddControlL( iOptionBtn );
       
   590    	iOptionBtn->AddEventObserver( this );    
       
   591     }
       
   592 
       
   593 // ----------------------------------------------------------------------------
       
   594 // CChineseFullScreenLayout::CreateVkbSwitcherBtnL()
       
   595 // .
       
   596 // ----------------------------------------------------------------------------
       
   597 //
       
   598 void CPeninputHwrfscnControlBar::CreateVkbSwitcherBtnL( )
       
   599     {
       
   600    	iVkbSwitcherBtn = CAknFepCtrlEventButton::NewL( iLayout, EHwrCtrlIdVkbSwitcher, 
       
   601    											  0xFFFF,
       
   602    											  0,
       
   603             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   604         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   605         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   606    	iVkbSwitcherBtn->SetResourceId( R_AKN_FEP_HWR_VKB );
       
   607    	iVkbSwitcherBtn->ConstructFromResourceL( );
       
   608    	TRect innerRect;
       
   609 	AknPenImageUtils::CalculateGraphicRect( ControlBarBtnRect( EVkbSwitcherBtn ), innerRect );   	
       
   610     iVkbSwitcherBtn->SizeChanged( ControlBarBtnRect( EVkbSwitcherBtn ), innerRect, ETrue );
       
   611    	iVkbSwitcherBtn->SetRect( ControlBarBtnRect( EVkbSwitcherBtn ) );
       
   612    	iBkgndWnd1->AddControlL( iVkbSwitcherBtn );
       
   613    	iVkbSwitcherBtn->AddEventObserver( this );    
       
   614     }
       
   615 
       
   616 // ----------------------------------------------------------------------------
       
   617 // CChineseFullScreenLayout::CreateRangeSwitchBtnGroupL()
       
   618 // .
       
   619 // ----------------------------------------------------------------------------
       
   620 //
       
   621 void CPeninputHwrfscnControlBar::CreateRangeSwitchBtnGroupL( )
       
   622     {
       
   623     iRangeSwitchBtnGroup = CPeninputHwrfscnBkgnd::NewL( iLayout, EHwrCtrlIdRangeBar );
       
   624     iRangeSwitchBtnGroup->SetResourceId( R_PENINPUT_LAYOUT_WINDOW_BACKGROUND );
       
   625     iRangeSwitchBtnGroup->ConstructFromResourceL();
       
   626     
       
   627     UpdateRangeSwitchL( );
       
   628     AddToRootControlL( iRangeSwitchBtnGroup );
       
   629     }
       
   630 
       
   631 // ----------------------------------------------------------------------------
       
   632 // CChineseFullScreenLayout::CreateRangeSwitchCoverBtnGroupL()
       
   633 // .
       
   634 // ----------------------------------------------------------------------------
       
   635 //
       
   636 void CPeninputHwrfscnControlBar::CreateRangeSwitchCoverBtnGroupL( )
       
   637     {
       
   638     iCoverRangeSwitchBtnGroup = CPeninputHwrfscnBkgnd::NewL( iLayout, EHwrCtrlIdCoverRangeBar );
       
   639     iCoverRangeSwitchBtnGroup->SetResourceId( R_PENINPUT_LAYOUT_WINDOW_BACKGROUND );
       
   640     iCoverRangeSwitchBtnGroup->ConstructFromResourceL();
       
   641     
       
   642     UpdateCoverRangeSwitchL( );
       
   643 
       
   644     iCoverRangeSwitchBtnGroup->HideControl( ActiveRangeIndex( ), EFalse );
       
   645     
       
   646     iCoverRangeSwitchBtnGroup->
       
   647         SetActiveCtrl( iCoverRangeSwitchBtnGroup->At( ActiveRangeIndex( ) ) );
       
   648 
       
   649     AddToRootControlL( iCoverRangeSwitchBtnGroup );
       
   650     }
       
   651 
       
   652 // ----------------------------------------------------------------------------
       
   653 // CChineseFullScreenLayout::CreateMoreFuncBtnL()
       
   654 // .
       
   655 // ----------------------------------------------------------------------------
       
   656 //
       
   657 void CPeninputHwrfscnControlBar::CreateMoreFuncBtnL( )
       
   658     {
       
   659     iMoreFuncBtn = CAknFepCtrlCommonButton::NewL( iLayout, EHwrCtrlIdMoreFunc,
       
   660             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   661         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   662         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   663 	TResourceReader reader;
       
   664     
       
   665     CCoeEnv::Static()->CreateResourceReaderLC( reader,
       
   666     	 			   R_AKN_FEP_HWR_MORE_FUNC );  
       
   667     iMoreFuncBtn->SetResourceId( R_AKN_FEP_HWR_MORE_FUNC );      
       
   668     iMoreFuncBtn->ConstructFromResourceL(); 
       
   669     
       
   670     // Pop and destroy reader
       
   671     CleanupStack::PopAndDestroy( 1 );	 
       
   672     
       
   673 	TRect innerRect;
       
   674     TRect rect(MoreFuncBtnRect());
       
   675 	AknPenImageUtils::CalculateGraphicRect( rect, innerRect );
       
   676     iMoreFuncBtn->SizeChanged( rect, innerRect, ETrue );
       
   677     iMoreFuncBtn->SetRect( rect );
       
   678        
       
   679     /*iMoreFuncBtn->SetBmpStretchable( );
       
   680 
       
   681     CFbsBitmap* svgMaskLatched = NULL;
       
   682     CFbsBitmap* svgMaskUnLatched = NULL;
       
   683 
       
   684     TLatchPicIndex index = ELatchPicError; 
       
   685     GetLatchedIndexByCtrlID( EHwrCtrlIdMoreFunc,index );
       
   686     CreateBitMapL( EMbmPeninputhwrfscnQgn_indi_fep_button_morefunction, 
       
   687         iLatchedBtnPic[index].iSvgLatchedBMP, 
       
   688         svgMaskLatched );
       
   689 
       
   690     CreateBitMapL( EMbmPeninputhwrfscnQgn_indi_fep_button_morefunction_sel, 
       
   691         iLatchedBtnPic[index].iSvgUnLatchedBMP, 
       
   692         svgMaskUnLatched );
       
   693 
       
   694     iMoreFuncBtn->SetLatchedBitmap( 
       
   695         iLatchedBtnPic[index].iSvgLatchedBMP, svgMaskLatched );
       
   696     iMoreFuncBtn->SetUnLatchedBitmap( 
       
   697         iLatchedBtnPic[index].iSvgUnLatchedBMP, svgMaskUnLatched );
       
   698 
       
   699     iMoreFuncBtn->SetLatched( ETrue );*/
       
   700 
       
   701     iMoreFuncBtn->AddEventObserver( this );
       
   702     
       
   703     iBkgndWnd2->AddControlL( iMoreFuncBtn );
       
   704     }
       
   705 
       
   706 // ----------------------------------------------------------------------------
       
   707 // CChineseFullScreenLayout::CreateMoreFuncPanelL()
       
   708 // .
       
   709 // ----------------------------------------------------------------------------
       
   710 //
       
   711 void CPeninputHwrfscnControlBar::CreateMoreFuncPanelL( )
       
   712     {
       
   713     iFunctionPanel = CPeninputHwrfscnFunctionPanel::NewL( iLayout );
       
   714     iFunctionPanel->Show( EFalse );
       
   715 	iFunctionPanel->SetPostion( 
       
   716 	    TPoint( iPos.iX-KUnitNumDiffOfMoreFuncAndControlBar*iUnitWidth, 
       
   717 	    iPos.iY+iUnitHeight ) );
       
   718     iFunctionPanel->AddEventObserver( this );
       
   719     }
       
   720 
       
   721 // ----------------------------------------------------------------------------
       
   722 // CChineseFullScreenLayout::CreateBackSpaceBtnL()
       
   723 // .
       
   724 // ----------------------------------------------------------------------------
       
   725 //
       
   726 void CPeninputHwrfscnControlBar::CreateBackSpaceBtnL( )
       
   727     {
       
   728    	iBackSpaceBtn = CAknFepCtrlRepeatButton::NewL( iLayout, EHwrCtrlIdBackspace, 
       
   729    	                                          EHwrEventKeyBack,
       
   730    											  EKeyBackspace,
       
   731             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   732         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   733         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   734    	iBackSpaceBtn->SetResourceId( R_AKN_FEP_HWR_BACK_SPACE );
       
   735    	iBackSpaceBtn->ConstructFromResourceL( );
       
   736    	TRect innerRect;
       
   737 	AknPenImageUtils::CalculateGraphicRect( BackSpaceBtnRect( ), innerRect );     	
       
   738     iBackSpaceBtn->SizeChanged( BackSpaceBtnRect( ), innerRect, ETrue );
       
   739    	iBackSpaceBtn->SetRect( BackSpaceBtnRect( ) );
       
   740    	iBkgndWnd2->AddControlL( iBackSpaceBtn );
       
   741    	iBackSpaceBtn->AddEventObserver( this );
       
   742     }
       
   743 
       
   744 // ----------------------------------------------------------------------------
       
   745 // CChineseFullScreenLayout::CreateLatchedBtnLC
       
   746 // .
       
   747 // ----------------------------------------------------------------------------
       
   748 //
       
   749 CAknFepCtrlCommonButton* CPeninputHwrfscnControlBar::CreateLatchedBtnLC( 
       
   750     const TRect aRect, 
       
   751     TInt aCtrlId, 
       
   752     TInt aLatchedPicID, 
       
   753     TInt /*aUnLatchedID*/ )
       
   754 	{
       
   755     CAknFepCtrlMultiImageButton* rangeBtn = CAknFepCtrlMultiImageButton::NewL( iLayout, aCtrlId,
       
   756             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   757         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   758         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   759 
       
   760     rangeBtn->SetResourceId( aLatchedPicID );      
       
   761     rangeBtn->ConstructFromResourceL(); 
       
   762 
       
   763 	TRect innerRect;
       
   764 	AknPenImageUtils::CalculateGraphicRect( aRect, innerRect );   	
       
   765     rangeBtn->SizeChanged( aRect, innerRect, ETrue );
       
   766    	rangeBtn->SetRect( aRect );
       
   767    	rangeBtn->AddEventObserver( this );
       
   768     return rangeBtn;
       
   769 	}
       
   770 
       
   771 // ----------------------------------------------------------------------------
       
   772 // CPeninputHwrfscnControlBar::CreateNormalBtnLC
       
   773 // .
       
   774 // ----------------------------------------------------------------------------
       
   775 //
       
   776 CAknFepCtrlCommonButton* CPeninputHwrfscnControlBar::CreateNormalBtnLC( const TRect aRect, 
       
   777     TInt aCtrlId, 
       
   778     TInt aResID )
       
   779 	{
       
   780    	CAknFepCtrlCommonButton* coverRangeSwitchBtn = 
       
   781    	    CAknFepCtrlCommonButton::NewL( iLayout, aCtrlId,
       
   782             								  KAknsIIDQsnFrFunctionButtonNormal,
       
   783         									  KAknsIIDQsnFrFunctionButtonPressed,
       
   784         									  KAknsIIDQsnFrFunctionButtonInactive );
       
   785    	
       
   786    	coverRangeSwitchBtn->SetResourceId( aResID );
       
   787    	coverRangeSwitchBtn->ConstructFromResourceL( );
       
   788 	TRect innerRect;
       
   789 	AknPenImageUtils::CalculateGraphicRect( aRect, innerRect );   	
       
   790     coverRangeSwitchBtn->SizeChanged( aRect, innerRect, ETrue );
       
   791    	coverRangeSwitchBtn->SetRect( aRect );
       
   792    	coverRangeSwitchBtn->Hide(ETrue);
       
   793    	coverRangeSwitchBtn->AddEventObserver( this );
       
   794 
       
   795     return coverRangeSwitchBtn;
       
   796 	}
       
   797 
       
   798 // -----------------------------------------------------------------------------
       
   799 // CPeninputHwrfscnControlBar::CloseRangeSwitchList()
       
   800 // .
       
   801 // -----------------------------------------------------------------------------
       
   802 //
       
   803 void CPeninputHwrfscnControlBar::CloseRangeSwitchList( )
       
   804     {    
       
   805 	// Hide all Range btns
       
   806 	HideRangeSwitchBtns( ETrue );
       
   807 
       
   808     // Hide all cover range btns
       
   809 	HideCoverRangeSwitchBtns( );
       
   810     
       
   811     // set the active cover range button
       
   812     SetActiveCoverRangeBtn( );
       
   813     
       
   814     // set the switch expanded state to be false
       
   815     iRangeSwitchExpanded = EFalse;
       
   816     
       
   817     // Redraw them
       
   818     Draw( );
       
   819     }
       
   820 
       
   821 // -----------------------------------------------------------------------------
       
   822 // CPeninputHwrfscnControlBar::HideCoverRangeSwitchBtns()
       
   823 // .
       
   824 // -----------------------------------------------------------------------------
       
   825 //    
       
   826 void CPeninputHwrfscnControlBar::HideCoverRangeSwitchBtns( )
       
   827     {
       
   828     TInt count = iCoverRangeSwitchBtnGroup->NumOfControls( ); 
       
   829     
       
   830     for( TInt i = 0; i < count; i++ )
       
   831         {
       
   832         iCoverRangeSwitchBtnGroup->HideControl( i ); 
       
   833         }
       
   834     }
       
   835 
       
   836 // -----------------------------------------------------------------------------
       
   837 // CPeninputHwrfscnControlBar::HideCoverRangeSwitchBtns()
       
   838 // .
       
   839 // -----------------------------------------------------------------------------
       
   840 //    
       
   841 void CPeninputHwrfscnControlBar::SetActiveCoverRangeBtn( )
       
   842     {
       
   843     TInt curActiveRange = ActiveRangeIndex( );
       
   844     iCoverRangeSwitchBtnGroup->HideControl( curActiveRange, EFalse );
       
   845     iCoverRangeSwitchBtnGroup->SetActiveCtrl( curActiveRange );
       
   846     }
       
   847 
       
   848 // -----------------------------------------------------------------------------
       
   849 // CPeninputHwrfscnControlBar::HideCoverRangeSwitchBtns()
       
   850 // .
       
   851 // -----------------------------------------------------------------------------
       
   852 //    
       
   853 void CPeninputHwrfscnControlBar::HideRangeSwitchBtns( TBool aHide )
       
   854     {
       
   855     TInt count = iRangeSwitchBtnGroup->NumOfControls( );
       
   856 	iRangeSwitchBtnGroup->Hide( aHide );
       
   857 	for( TInt i = 0; i < count; i++ )
       
   858     	{
       
   859    		iRangeSwitchBtnGroup->HideControl( i,aHide );
       
   860     	}
       
   861     }
       
   862 
       
   863     
       
   864 // -----------------------------------------------------------------------------
       
   865 // CPeninputHwrfscnControlBar::RemoveAllSwitchBtns()
       
   866 // .
       
   867 // -----------------------------------------------------------------------------
       
   868 //    
       
   869 void CPeninputHwrfscnControlBar::RemoveAllSwitchBtns( )
       
   870     {
       
   871     TInt count = iRangeSwitchBtnGroup->NumOfControls( );
       
   872     
       
   873     for ( int i = 0; i < count; i++ )
       
   874         {
       
   875         iRangeSwitchBtnGroup->RemoveControl( iRangeSwitchBtnGroup->At( 0 ) );
       
   876         iCoverRangeSwitchBtnGroup->RemoveControl( 
       
   877             iCoverRangeSwitchBtnGroup->At( 0 ) );
       
   878         }
       
   879     }        
       
   880 
       
   881 // -----------------------------------------------------------------------------
       
   882 // CPeninputHwrfscnControlBar::OpenRangeSwitchList()
       
   883 // .
       
   884 // -----------------------------------------------------------------------------
       
   885 //	
       
   886 void CPeninputHwrfscnControlBar::OpenRangeSwitchList( )
       
   887     {
       
   888     // Show all items in the Range switch list
       
   889     HideRangeSwitchBtns( EFalse );
       
   890 	
       
   891 	// set the buttons to be latched
       
   892 	ShowRangeSwitchBtnsLatched( );
       
   893 	
       
   894 	// Hide all items of the btns used to cover the Range switch list
       
   895 	HideCoverRangeSwitchBtns( );        
       
   896     
       
   897     // Highlight the previous selected item
       
   898 	static_cast<CAknFepCtrlCommonButton*>
       
   899 	    ( iRangeSwitchBtnGroup->At( ActiveRangeIndex( ) ) )->SetHighlight( ETrue );
       
   900 	
       
   901     iRangeSwitchExpanded = ETrue;
       
   902     
       
   903     Draw( );
       
   904     }
       
   905     
       
   906 // -----------------------------------------------------------------------------
       
   907 // CPeninputHwrfscnControlBar::ShowRangeSwitchBtnsLatched()
       
   908 // .
       
   909 // -----------------------------------------------------------------------------
       
   910 //    
       
   911 void CPeninputHwrfscnControlBar::ShowRangeSwitchBtnsLatched( )
       
   912     {
       
   913     // Show all items in the Range switch list
       
   914 	TInt count = iRangeSwitchBtnGroup->NumOfControls( ); 
       
   915     
       
   916     for( TInt i = 0; i < count; i++ )
       
   917         {
       
   918         static_cast<CAknFepCtrlCommonButton*>
       
   919             ( iRangeSwitchBtnGroup->At( i ) )->SetHighlight( EFalse );
       
   920         }
       
   921     } 
       
   922    
       
   923 // -----------------------------------------------------------------------------
       
   924 // CPeninputHwrfscnControlBar::ShowMoreFuncList()
       
   925 // .
       
   926 // -----------------------------------------------------------------------------
       
   927 //	
       
   928 void CPeninputHwrfscnControlBar::ShowMoreFuncList( TBool aShowNow )
       
   929     {
       
   930     iFunctionPanel->Show( aShowNow );
       
   931     iMoreFuncBtn->SetHighlight( aShowNow );
       
   932     Draw( );
       
   933     }
       
   934     
       
   935 // -----------------------------------------------------------------------------
       
   936 // CPeninputHwrfscnControlBar::ClickIsInRangeSwitchGrp()
       
   937 // .
       
   938 // -----------------------------------------------------------------------------
       
   939 //	
       
   940 TBool CPeninputHwrfscnControlBar::ClickIsInRangeSwitchGrp( CFepUiBaseCtrl* aCtrl )
       
   941     {
       
   942     TInt count = iRangeSwitchBtnGroup->NumOfControls( );
       
   943     
       
   944     for ( int i = 0; i < count; i++ )
       
   945         {
       
   946         if ( aCtrl == iRangeSwitchBtnGroup->At( i ) )
       
   947             {
       
   948             return ETrue;
       
   949             }
       
   950         }
       
   951         
       
   952     return EFalse;
       
   953     }
       
   954 
       
   955     
       
   956 // -----------------------------------------------------------------------------
       
   957 // CPeninputHwrfscnControlBar::UpdateRangeSwitchL()
       
   958 // .
       
   959 // -----------------------------------------------------------------------------
       
   960 //
       
   961 void CPeninputHwrfscnControlBar::UpdateRangeSwitchL( )
       
   962     {
       
   963     for( int i = 0; i < iCurrentRangeList.Count( ); ++i )
       
   964     	{
       
   965     	CAknFepCtrlCommonButton* tempControl = NULL;
       
   966         TBool handled = EFalse;
       
   967         
       
   968         if ( iCurrentRangeList[i] == ERangeNative )
       
   969             {
       
   970             tempControl = CreateNormalBtnLC( 
       
   971    	            RangeSwitchBtnRect( i ), 
       
   972    	            EHwrCtrlIdChineseButton, 
       
   973    	            R_AKN_FEP_HWR_COVER_CHINESE);
       
   974    	        
       
   975    	        handled = ETrue;
       
   976             }
       
   977         else if ( iCurrentRangeList[i] == ERangeEnglish )
       
   978             {
       
   979             tempControl = CreateNormalBtnLC( 
       
   980    	            RangeSwitchBtnRect( i ), 
       
   981    	            EHwrCtrlIdEnglishButton, 
       
   982    	            R_AKN_FEP_HWR_COVER_LATIN);
       
   983    	        
       
   984    	        handled = ETrue;
       
   985             }
       
   986         else if ( iCurrentRangeList[i] == ERangeNumber )
       
   987             {
       
   988             tempControl = CreateNormalBtnLC( 
       
   989    	            RangeSwitchBtnRect( i ), 
       
   990    	            EHwrCtrlIdNumberButton, 
       
   991    	            R_AKN_FEP_HWR_COVER_NUM);
       
   992    	        
       
   993    	        handled = ETrue;
       
   994             }
       
   995             
       
   996 /*		TRect innerRect;
       
   997 	    TRect rect(RangeSwitchBtnRect(i));
       
   998 		AknPenImageUtils::CalculateGraphicRect( rect, innerRect );
       
   999 	    tempControl->SizeChanged( rect, innerRect, ETrue );
       
  1000 	    tempControl->SetRect( rect );  */          
       
  1001             
       
  1002         if ( handled )
       
  1003             {
       
  1004             iRangeSwitchBtnGroup->AddControlL( tempControl );
       
  1005             iRangeSwitchBtnGroup->HideControl( i );
       
  1006             //CleanupStack::Pop( tempControl );            
       
  1007             }
       
  1008         }
       
  1009     }
       
  1010     
       
  1011 // -----------------------------------------------------------------------------
       
  1012 // CPeninputHwrfscnControlBar::UpdateCoverRangeSwitchL()
       
  1013 // .
       
  1014 // -----------------------------------------------------------------------------
       
  1015 //
       
  1016 void CPeninputHwrfscnControlBar::UpdateCoverRangeSwitchL( )
       
  1017     {     
       
  1018     // When only one Range available, use the picture without small
       
  1019     // triangle mark
       
  1020     if ( 1 == iCurrentRangeList.Count( ) )
       
  1021         {
       
  1022         UpdateWithoutMarkL( );     
       
  1023         }
       
  1024     else
       
  1025         {
       
  1026         UpdateWithMarkL( );
       
  1027         }
       
  1028     }
       
  1029 
       
  1030 // -----------------------------------------------------------------------------
       
  1031 // CPeninputHwrfscnControlBar::UpdateWithoutMarkL
       
  1032 // .
       
  1033 // -----------------------------------------------------------------------------
       
  1034 //    
       
  1035 void CPeninputHwrfscnControlBar::UpdateWithoutMarkL( )
       
  1036     {
       
  1037     TBool handled = EFalse;
       
  1038     CFepUiBaseCtrl* tempControl = NULL;
       
  1039     if ( iCurrentActiveRange == ERangeNative )
       
  1040         {
       
  1041         tempControl = CreateNormalBtnLC( CoverRangeSwitchRect( ), 
       
  1042             EHwrCtrlIdCoverChineseButton, 
       
  1043             R_AKN_FEP_HWR_COVER_CHINESE );
       
  1044         
       
  1045         handled = ETrue;
       
  1046         }
       
  1047     else if ( iCurrentActiveRange == ERangeEnglish )
       
  1048         {
       
  1049        	tempControl = CreateNormalBtnLC( CoverRangeSwitchRect( ), 
       
  1050             EHwrCtrlIdCoverEnglishButton, 
       
  1051             R_AKN_FEP_HWR_COVER_LATIN );
       
  1052         
       
  1053         handled = ETrue;
       
  1054         }
       
  1055     else if ( iCurrentActiveRange == ERangeNumber )
       
  1056         {
       
  1057        	tempControl = CreateNormalBtnLC( CoverRangeSwitchRect( ), 
       
  1058             EHwrCtrlIdCoverNumberButton, 
       
  1059             R_AKN_FEP_HWR_COVER_NUM );
       
  1060         
       
  1061         handled = ETrue;                   	        
       
  1062         }
       
  1063         
       
  1064     if ( handled )
       
  1065         {
       
  1066         iCoverRangeSwitchBtnGroup->AddControlL( tempControl );
       
  1067         iCoverRangeSwitchBtnGroup->HideControl( 0 );
       
  1068         }
       
  1069     }
       
  1070 
       
  1071 // -----------------------------------------------------------------------------
       
  1072 // CPeninputHwrfscnControlBar::UpdateWithMarkL
       
  1073 // .
       
  1074 // -----------------------------------------------------------------------------
       
  1075 //    
       
  1076 void CPeninputHwrfscnControlBar::UpdateWithMarkL( )
       
  1077     {
       
  1078     TRect rect( CoverRangeSwitchRect( ) );
       
  1079       	
       
  1080     TInt rangeCount = iCurrentRangeList.Count( );
       
  1081     
       
  1082     for( int i = 0; i < rangeCount; ++i )
       
  1083     	{
       
  1084         CFepUiBaseCtrl* tempControl = NULL;
       
  1085         TBool handled = EFalse;
       
  1086         
       
  1087         if ( iCurrentRangeList[i] == ERangeNative )
       
  1088             {
       
  1089             tempControl = CreateLatchedBtnLC( rect, 
       
  1090                 EHwrCtrlIdCoverChineseButton, 
       
  1091                 R_AKN_FEP_HWR_CHINESE,
       
  1092                 EMbmPeninputhwrfscnQgn_indi_fep_button_chinese_sel );
       
  1093             
       
  1094             handled = ETrue;
       
  1095             }
       
  1096         else if ( iCurrentRangeList[i] == ERangeEnglish )
       
  1097             {
       
  1098            	tempControl = CreateLatchedBtnLC( rect, 
       
  1099                 EHwrCtrlIdCoverEnglishButton, 
       
  1100                 R_AKN_FEP_HWR_LATIN,
       
  1101                 EMbmPeninputhwrfscnQgn_indi_fep_button_chinese_sel );
       
  1102             
       
  1103             handled = ETrue;
       
  1104             }
       
  1105         else if ( iCurrentRangeList[i] == ERangeNumber )
       
  1106             {
       
  1107            	tempControl = CreateLatchedBtnLC( rect, 
       
  1108                 EHwrCtrlIdCoverNumberButton, 
       
  1109                 R_AKN_FEP_HWR_NUM,
       
  1110                 EMbmPeninputhwrfscnQgn_indi_fep_button_chinese_sel );
       
  1111         
       
  1112             
       
  1113             handled = ETrue;
       
  1114             }
       
  1115         
       
  1116         if ( handled )
       
  1117             {
       
  1118             iCoverRangeSwitchBtnGroup->AddControlL( tempControl );
       
  1119             iCoverRangeSwitchBtnGroup->HideControl( i );
       
  1120             }
       
  1121         }
       
  1122     }
       
  1123 // -----------------------------------------------------------------------------
       
  1124 // CPeninputHwrfscnControlBar::UpdateCoverRangeSwitchL()
       
  1125 // .
       
  1126 // -----------------------------------------------------------------------------
       
  1127 //
       
  1128 TInt CPeninputHwrfscnControlBar::ActiveRangeIndex( )
       
  1129     {
       
  1130     return iCurrentRangeList.Find( iCurrentActiveRange );
       
  1131     }
       
  1132     
       
  1133 // -----------------------------------------------------------------------------
       
  1134 // CPeninputHwrfscnControlBar::UpdateCurrentActiveRangeList()
       
  1135 // .
       
  1136 // -----------------------------------------------------------------------------
       
  1137 //
       
  1138 void CPeninputHwrfscnControlBar::UpdateCurrentActiveRangeList( )
       
  1139     {
       
  1140     // Use this list to store the temp permitted Range list, as the list got 
       
  1141     // from DataStore will change when some functions were called
       
  1142     iCurrentRangeList.Reset( );
       
  1143     
       
  1144     // Check whether the three Ranges we cared about were exist in the list from DataSore, 
       
  1145     // If so, add corresponding Range in the iCurrentRangeList follow the sequence:
       
  1146     // ERangeNative -> ERangeEnglish -> ERangeNumber
       
  1147     TInt rangeCount = sizeof( Ranges ) / sizeof( TInt );
       
  1148     
       
  1149     const RArray<TInt>& rangeArray = iLayout->DataStore( ).PermittedRanges( );
       
  1150     
       
  1151     for ( int i = 0; i < rangeCount; i++ )
       
  1152         {
       
  1153         if( rangeArray.Find( Ranges[i] ) != KErrNotFound )
       
  1154 			{
       
  1155 			iCurrentRangeList.Append( Ranges[i] );
       
  1156 			}
       
  1157         }
       
  1158         
       
  1159     UpdateCurrentActiveRange( );
       
  1160     }
       
  1161     
       
  1162 // -----------------------------------------------------------------------------
       
  1163 // CPeninputHwrfscnControlBar::UpdateCurrentActiveRange()
       
  1164 // .
       
  1165 // -----------------------------------------------------------------------------
       
  1166 //
       
  1167 void CPeninputHwrfscnControlBar::UpdateCurrentActiveRange( )
       
  1168     {
       
  1169     iCurrentActiveRange = 
       
  1170         static_cast<TAknFepPenInputRange>( 
       
  1171         iLayout->DataStore( ).PermittedRanges( )[0] );
       
  1172     }
       
  1173 
       
  1174 // -----------------------------------------------------------------------------
       
  1175 // CPeninputHwrfscnControlBar::GetLatchedIndexByCtrlID()
       
  1176 // .
       
  1177 // -----------------------------------------------------------------------------
       
  1178 //
       
  1179 void CPeninputHwrfscnControlBar::GetLatchedIndexByCtrlID( TInt aCtrlID, 
       
  1180     TLatchPicIndex& aIndex )
       
  1181     {
       
  1182     TLatchPicIndex latchedPicID = ELatchPicError;
       
  1183     
       
  1184     switch ( aCtrlID )
       
  1185         {
       
  1186         case EHwrCtrlIdMoreFunc:
       
  1187             latchedPicID = ELatchPicMoreFunc;
       
  1188             break;
       
  1189         
       
  1190         case EHwrCtrlIdChineseButton:
       
  1191             latchedPicID = ELatchPicChineseButton;
       
  1192             break;
       
  1193         
       
  1194         case EHwrCtrlIdEnglishButton:
       
  1195             latchedPicID = ELatchPicEnglishButton;
       
  1196             break;
       
  1197         
       
  1198         case EHwrCtrlIdNumberButton:
       
  1199             latchedPicID = ELatchPicNumberButton;
       
  1200             break;
       
  1201         
       
  1202         default:
       
  1203             break;
       
  1204         }
       
  1205     
       
  1206     aIndex = latchedPicID;
       
  1207     }
       
  1208     
       
  1209 // -----------------------------------------------------------------------------
       
  1210 // CPeninputHwrfscnControlBar::ReadLAFInfo()
       
  1211 // .
       
  1212 // -----------------------------------------------------------------------------
       
  1213 //
       
  1214 void CPeninputHwrfscnControlBar::ReadLAFInfo( )
       
  1215     {
       
  1216     TRect rect( PeninputHwrfscnLAFManager::ControlBarUnitRect( ) ); 	
       
  1217 	iUnitWidth = rect.Width( );
       
  1218 	iUnitHeight = rect.Height( );
       
  1219 
       
  1220 	iPos = PeninputHwrfscnLAFManager::ControlBarLeftTopPosition( );
       
  1221 	
       
  1222 	// Offset lefttop position for fixing bug
       
  1223 	TPoint offsetPt( iUnitWidth*EControlBarBtnCount, 0 );
       
  1224 	iPos += offsetPt;
       
  1225 	
       
  1226     // In case that the control bar and more function panel can not be fully shown
       
  1227 	if( ( iPos.iX - KUnitNumDiffOfMoreFuncAndControlBar * iUnitWidth ) < 0 )
       
  1228 		{
       
  1229 		iPos.iX = KUnitNumDiffOfMoreFuncAndControlBar * iUnitWidth;
       
  1230 		}
       
  1231     else if( ( iPos.iX + KControlBarWidthUnitNum * iUnitWidth ) > 
       
  1232         iLayout->ScreenSize( ).iWidth )
       
  1233 		{
       
  1234 		iPos.iX = iLayout->ScreenSize( ).iWidth - KControlBarWidthUnitNum * iUnitWidth;
       
  1235 		}
       
  1236     }
       
  1237 
       
  1238 // -----------------------------------------------------------------------------
       
  1239 // CPeninputHwrfscnControlBar::ResetCoverRangeSwitchSize()
       
  1240 // .
       
  1241 // -----------------------------------------------------------------------------
       
  1242 //
       
  1243 void CPeninputHwrfscnControlBar::ResetCoverRangeSwitchSize( )
       
  1244 	{
       
  1245     // Get the rect
       
  1246     TRect rect( CoverRangeSwitchRect( ) );
       
  1247     
       
  1248     // change the button group rect
       
  1249     iCoverRangeSwitchBtnGroup->SetRect( rect );
       
  1250     
       
  1251     TInt count = iCoverRangeSwitchBtnGroup->NumOfControls( );
       
  1252     
       
  1253     for ( int i = 0; i < count; i++ )
       
  1254         {
       
  1255         CAknFepCtrlCommonButton* button = 
       
  1256             static_cast<CAknFepCtrlCommonButton*>( iCoverRangeSwitchBtnGroup->At( i ) );
       
  1257             
       
  1258 		TRect innerRect;
       
  1259 		AknPenImageUtils::CalculateGraphicRect( rect, innerRect );
       
  1260         button->SizeChanged( rect, innerRect, ETrue );
       
  1261        
       
  1262         button->SetRect( rect );
       
  1263         }
       
  1264 	}
       
  1265 
       
  1266 // -----------------------------------------------------------------------------
       
  1267 // CPeninputHwrfscnControlBar::ResetRangeSwitchSize()
       
  1268 // .
       
  1269 // -----------------------------------------------------------------------------
       
  1270 //
       
  1271 void CPeninputHwrfscnControlBar::ResetRangeSwitchSize( )
       
  1272 	{
       
  1273     TInt count = iRangeSwitchBtnGroup->NumOfControls( );
       
  1274     
       
  1275     for( int i = 0; i < count; ++i )
       
  1276     	{
       
  1277     	CAknFepCtrlCommonButton* button = 
       
  1278                           static_cast<CAknFepCtrlCommonButton*>(iRangeSwitchBtnGroup->At( i ));
       
  1279     	/*
       
  1280     	TLatchPicIndex index = ELatchPicError; 
       
  1281     	
       
  1282     	GetLatchedIndexByCtrlID( button->ControlId( ), index );
       
  1283         
       
  1284         // Bitmap should be resized by the first time construct
       
  1285         TSize sizeBitMap( iUnitWidth, iUnitHeight );
       
  1286         
       
  1287         AknIconUtils::SetSize( iLatchedBtnPic[index].iSvgLatchedBMP, 
       
  1288             sizeBitMap, EAspectRatioNotPreserved );
       
  1289         
       
  1290         AknIconUtils::SetSize( iLatchedBtnPic[index].iSvgUnLatchedBMP, 
       
  1291             sizeBitMap, EAspectRatioNotPreserved );*/
       
  1292 		TRect innerRect;
       
  1293 		AknPenImageUtils::CalculateGraphicRect( RangeSwitchBtnRect( i ), innerRect );
       
  1294         button->SizeChanged(RangeSwitchBtnRect( i ), innerRect, ETrue);
       
  1295         
       
  1296         button->SetRect( RangeSwitchBtnRect( i ) );
       
  1297     	}
       
  1298 	}
       
  1299 
       
  1300 // -----------------------------------------------------------------------------
       
  1301 // CPeninputHwrfscnControlBar::ResetMoreFuncBtnSize()
       
  1302 // .
       
  1303 // -----------------------------------------------------------------------------
       
  1304 //
       
  1305 void CPeninputHwrfscnControlBar::ResetMoreFuncBtnSize( )
       
  1306 	{
       
  1307 	TLatchPicIndex index = ELatchPicError; 
       
  1308 	GetLatchedIndexByCtrlID( EHwrCtrlIdMoreFunc, index );
       
  1309     
       
  1310     // Bitmap should be resized by the first time construct
       
  1311     /*TSize sizeBitMap( iUnitWidth, iUnitHeight );
       
  1312     
       
  1313     AknIconUtils::SetSize( iLatchedBtnPic[index].iSvgLatchedBMP, 
       
  1314         sizeBitMap, EAspectRatioNotPreserved );
       
  1315                            
       
  1316     AknIconUtils::SetSize( iLatchedBtnPic[index].iSvgUnLatchedBMP, 
       
  1317         sizeBitMap, EAspectRatioNotPreserved );*/
       
  1318         
       
  1319 	TRect innerRect;
       
  1320 	AknPenImageUtils::CalculateGraphicRect( MoreFuncBtnRect(), innerRect );
       
  1321     iMoreFuncBtn->SizeChanged(MoreFuncBtnRect(), innerRect, ETrue);
       
  1322     iMoreFuncBtn->SetRect( MoreFuncBtnRect( ) );    
       
  1323 	}
       
  1324 
       
  1325 // -----------------------------------------------------------------------------
       
  1326 // CPeninputHwrfscnControlBar::ResetBackSpaceBtnSize()
       
  1327 // .
       
  1328 // -----------------------------------------------------------------------------
       
  1329 //
       
  1330 void CPeninputHwrfscnControlBar::ResetBackSpaceBtnSize( )
       
  1331 	{
       
  1332     TRect rect( BackSpaceBtnRect( ) );
       
  1333 	TRect innerRect;
       
  1334 	AknPenImageUtils::CalculateGraphicRect( rect, innerRect );    
       
  1335     iBackSpaceBtn->SizeChanged( rect, innerRect, ETrue );
       
  1336     iBackSpaceBtn->SetRect( rect );
       
  1337 	}
       
  1338 	
       
  1339 // -----------------------------------------------------------------------------
       
  1340 // CPeninputHwrfscnControlBar::ResetControlBarBtnSize()
       
  1341 // .
       
  1342 // -----------------------------------------------------------------------------
       
  1343 //
       
  1344 void CPeninputHwrfscnControlBar::ResetControlBarBtnSize( )
       
  1345 	{
       
  1346 	TRect innerRect;
       
  1347     TRect rect(ControlBarBtnRect(ECloseBtn));
       
  1348 	AknPenImageUtils::CalculateGraphicRect( rect, innerRect );
       
  1349     iCloseBtn->SizeChanged( rect, innerRect, ETrue );
       
  1350     iCloseBtn->SetRect( rect );
       
  1351     
       
  1352 	rect = ControlBarBtnRect(EOptionBtn);
       
  1353     AknPenImageUtils::CalculateGraphicRect( rect, innerRect ); 
       
  1354     iOptionBtn->SizeChanged(rect, innerRect, ETrue);
       
  1355     iOptionBtn->SetRect(rect);
       
  1356     
       
  1357     rect = ControlBarBtnRect(EVkbSwitcherBtn);
       
  1358     AknPenImageUtils::CalculateGraphicRect( rect, innerRect ); 
       
  1359     iVkbSwitcherBtn->SizeChanged(rect, innerRect, ETrue);
       
  1360     iVkbSwitcherBtn->SetRect(rect);
       
  1361 	}	
       
  1362 	
       
  1363 
       
  1364 // -----------------------------------------------------------------------------
       
  1365 // CPeninputHwrfscnControlBar::CoverRangeSwitchRect()
       
  1366 // .
       
  1367 // -----------------------------------------------------------------------------
       
  1368 //
       
  1369 TRect CPeninputHwrfscnControlBar::CoverRangeSwitchRect( )
       
  1370 	{
       
  1371 	return TRect ( iPos, TSize( iUnitWidth, iUnitHeight ) );
       
  1372 	}
       
  1373 
       
  1374 // -----------------------------------------------------------------------------
       
  1375 // CPeninputHwrfscnControlBar::RangeSwitchBtnRect()
       
  1376 // .
       
  1377 // -----------------------------------------------------------------------------
       
  1378 //
       
  1379 TRect CPeninputHwrfscnControlBar::RangeSwitchBtnRect( TInt aIndex )
       
  1380 	{	
       
  1381 	TPoint pos( iPos.iX, iPos.iY + iUnitHeight * aIndex );
       
  1382 	
       
  1383 	return  TRect( pos, TSize( iUnitWidth, iUnitHeight ) );
       
  1384 	}
       
  1385 
       
  1386 // -----------------------------------------------------------------------------
       
  1387 // CPeninputHwrfscnControlBar::MoreFuncBtnRect()
       
  1388 // .
       
  1389 // -----------------------------------------------------------------------------
       
  1390 //
       
  1391 TRect CPeninputHwrfscnControlBar::MoreFuncBtnRect( )
       
  1392 	{
       
  1393 	TRect coverRect( CoverRangeSwitchRect( ) );
       
  1394 	
       
  1395 	TPoint pos( coverRect.iBr.iX, coverRect.iTl.iY );
       
  1396 	
       
  1397 	return TRect ( pos, TSize( iUnitWidth,iUnitHeight ) );
       
  1398 	}
       
  1399 
       
  1400 // -----------------------------------------------------------------------------
       
  1401 // CPeninputHwrfscnControlBar::BackSpaceBtnRect()
       
  1402 // .
       
  1403 // -----------------------------------------------------------------------------
       
  1404 //
       
  1405 TRect CPeninputHwrfscnControlBar::BackSpaceBtnRect( )
       
  1406 	{
       
  1407 	TRect funcRect( MoreFuncBtnRect( ) );
       
  1408 	
       
  1409 	TPoint pos( funcRect.iBr.iX, funcRect.iTl.iY );
       
  1410 	
       
  1411 	TSize size( iUnitWidth * KBackspaceWidthUintNum, iUnitHeight );
       
  1412 	
       
  1413 	return TRect ( pos, size );
       
  1414 	}
       
  1415 	
       
  1416 // -----------------------------------------------------------------------------
       
  1417 // CPeninputHwrfscnControlBar::ControlBarBtnRect()
       
  1418 // .
       
  1419 // -----------------------------------------------------------------------------
       
  1420 //
       
  1421 TRect CPeninputHwrfscnControlBar::ControlBarBtnRect( TInt aIndex )
       
  1422 	{
       
  1423     TSize size( iUnitWidth, iUnitHeight );
       
  1424     
       
  1425     return TRect( TPoint( iPos.iX - iUnitWidth * (EControlBarBtnCount - aIndex), iPos.iY ), size );
       
  1426 	}
       
  1427 	
       
  1428 // -----------------------------------------------------------------------------
       
  1429 // CPeninputHwrfscnControlBar::HandleSkinChanged()
       
  1430 // .
       
  1431 // -----------------------------------------------------------------------------
       
  1432 //	
       
  1433 void CPeninputHwrfscnControlBar::HandleSkinChanged()
       
  1434 	{
       
  1435 	iFunctionPanel->HandleSkinChanged();
       
  1436 	}
       
  1437 
       
  1438 // -----------------------------------------------------------------------------
       
  1439 // CPeninputHwrfscnControlBar::SetEnableSettingBtn()
       
  1440 // .
       
  1441 // -----------------------------------------------------------------------------
       
  1442 //    
       
  1443 void CPeninputHwrfscnControlBar::SetEnableSettingBtn(TBool aEnable)
       
  1444     {
       
  1445     if ( aEnable )    
       
  1446         {
       
  1447         iOptionBtn->SetDimmed(EFalse);
       
  1448         }
       
  1449     else
       
  1450         {
       
  1451         iOptionBtn->SetDimmed(ETrue);
       
  1452         iOptionBtn->SetActive(EFalse);
       
  1453         }
       
  1454     }
       
  1455 	
       
  1456 //End of file