fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlContainerChinese.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2004 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:           
       
    15 *       Provides the CAknFepUICtrlContainerChinese methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include <coemain.h>
       
    31 #include <eikenv.h>
       
    32 #include <eikappui.h>
       
    33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    34 #include <uikon/eikdefmacros.h>
       
    35 #endif
       
    36 
       
    37 
       
    38 #include <AknLayoutDef.h>
       
    39 #include <AknLayout.lag>
       
    40 #include <AknUtils.h>
       
    41 #include <AknsDrawUtils.h>
       
    42 #include <AknsFrameBackgroundControlContext.h>
       
    43 #include <skinlayout.cdl.h>
       
    44 #include <AknDef.h>
       
    45 
       
    46 #include "AknFepUiInterfacePanic.h"
       
    47 #include "AknFepUIAvkonCtrlContainerChinese.h"
       
    48 #include "AknFepUIAvkonCtrlCandidatePane.h"
       
    49 #include "AknFepUIAvkonCtrlInputPane.h"
       
    50 #include "AknFepUIAvkonCtrlPinyinPopup.h"
       
    51 #include "aknfepuictrlpinyineep.h"
       
    52 #include "AknFepManager.h"
       
    53 #include "aknfepchineseuidataconv.h"
       
    54 #include "aknfepuilayoutdatamgr.h"
       
    55 
       
    56 MAknFepUICtrlContainerChinese::~MAknFepUICtrlContainerChinese()
       
    57 	{
       
    58 	}
       
    59 	
       
    60 CAknFepUICtrlContainerChinese::CAknFepUICtrlContainerChinese()
       
    61     :
       
    62     iPaneLayout(ELayoutInput),
       
    63     iContainerPosition(TPoint(0,0)),
       
    64     isPCLPosed(EFalse)
       
    65     {
       
    66 
       
    67     }
       
    68 
       
    69 CAknFepUICtrlContainerChinese* CAknFepUICtrlContainerChinese::NewL()
       
    70     {
       
    71     CAknFepUICtrlContainerChinese* self = new(ELeave) CAknFepUICtrlContainerChinese;
       
    72     CleanupStack::PushL(self);
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop();
       
    75     return self;
       
    76     }
       
    77 
       
    78 MAknFepUICtrlInputPane* CAknFepUICtrlContainerChinese::InputPane() const
       
    79     {
       
    80     return iInputPane;
       
    81     }
       
    82 
       
    83 MAknFepUICtrlCandidatePane* CAknFepUICtrlContainerChinese::CandidatePane() const
       
    84     {
       
    85     return iCandidatePane;
       
    86     }
       
    87 
       
    88 MAknFepUICtrlPinyinPopup* CAknFepUICtrlContainerChinese::PinyinPopupWindow() const
       
    89     {
       
    90     return iPinyinPopupWindow;
       
    91     }
       
    92 
       
    93 MAknFepUICtrlEditPane* CAknFepUICtrlContainerChinese::EditPaneWindow() const
       
    94     {
       
    95     return iEditPane;
       
    96     }
       
    97 
       
    98 TBool CAknFepUICtrlContainerChinese::IsEnabled() const
       
    99     {
       
   100     return iEnabled;
       
   101     }
       
   102 
       
   103 void CAknFepUICtrlContainerChinese::Enable(TBool aEnable)
       
   104     {
       
   105 	if(!COMPARE_BOOLS(iEnabled, aEnable))
       
   106         {
       
   107         iEnabled = aEnable;
       
   108         if(aEnable)
       
   109             {
       
   110             Window().SetOrdinalPosition(0, ECoeWinPriorityFep); // right at the front
       
   111             // make sure we are not faded even if a query has appeared
       
   112             Window().SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); 
       
   113             }
       
   114         else
       
   115             {
       
   116             // make sure that the popup window is disabled as well
       
   117             iInputPane->MakeVisible(aEnable); 
       
   118             iPinyinPopupWindow->Enable(aEnable);
       
   119             iEditPane->Enable(aEnable);
       
   120             iCandidatePane->Enable(aEnable);
       
   121             }
       
   122         MakeVisible(aEnable);
       
   123         }
       
   124     if ( aEnable == EFalse )
       
   125         {
       
   126         if ( iFepMan )
       
   127             {
       
   128             iFepMan->PinyinPhraseCreation( EFalse );
       
   129             iFepMan->EntryPhrase( EFalse );
       
   130             iFepMan->EnableKeyStar( ETrue );
       
   131             iFepMan->PhraseCreation( EFalse );
       
   132             }
       
   133         PinyinPopupWindow()->ResetStrokeArray();
       
   134         PinyinPopupWindow()->SetLastResouce( 0 );
       
   135 	    iPinyinPopupWindow->ResetInputLayoutMiniQwertyZhuyin();
       
   136 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   137 	    iEditPane->ResetAllArray();
       
   138 	    iEditPane->SetEffictiveLength( 0 );
       
   139 	    iEditPane->SetChangeState( EFalse );
       
   140 #endif
       
   141         }
       
   142     }  
       
   143   
       
   144 void CAknFepUICtrlContainerChinese::ConstructL()
       
   145     {
       
   146     CreateWindowL();
       
   147     SetNonFocusing();
       
   148     RWindow& window=Window();
       
   149     window.SetOrdinalPosition(0, ECoeWinPriorityFep); // right at the front
       
   150     MakeVisible(EFalse);
       
   151 
       
   152     iEikonEnv->EikAppUi()->AddToStackL(this, ECoeStackPriorityDefault, ECoeStackFlagRefusesFocus);
       
   153 
       
   154     iLafDataMgr = CAknFepUiLayoutDataMgr::NewL();
       
   155     iInputPane = CAknFepUICtrlInputPane::NewL(window, CAknFepUICtrlInputPane::ELayoutPhraseInputPane, iLafDataMgr);
       
   156     iCandidatePane = CAknFepUICtrlCandidatePane::NewL(window, iLafDataMgr);
       
   157     iPinyinPopupWindow = CAknFepUICtrlPinyinPopup::NewL(window , iLafDataMgr);
       
   158     iEditPane = CAknFepUICtrlPinyinEEP::NewL( window, iLafDataMgr );
       
   159     iInputPane->SetMopParent(this);
       
   160     iCandidatePane->SetMopParent(this);
       
   161     iEditPane->SetMopParent(this);
       
   162 
       
   163     iInputPane->SetSizeChangedObserver(this);
       
   164     iPinyinPopupWindow->SetSizeChangedObserver(this);
       
   165     iPinyinPopupWindow->MakeVisible(EFalse);
       
   166     iEditPane->Enable(EFalse);
       
   167 
       
   168     iCandidatePane->SetPaneLayout(iPaneLayout); // set pane layout
       
   169     iCandidatePane->SetVisibleCandidateCount(iPaneLayout);
       
   170  	iHorizLine = 
       
   171  	    CAknFepChineseUIDataConv::AnyToLayoutRect(iLafDataMgr->RequestData(EHorizLine));	    
       
   172  	iEEPFirstHorizLine = 
       
   173  	    CAknFepChineseUIDataConv::AnyToLayoutRect(iLafDataMgr->RequestData(EEEPFirstHorizLine));
       
   174  	iEEPSecondHorizLine = 
       
   175  	    CAknFepChineseUIDataConv::AnyToLayoutRect(iLafDataMgr->RequestData(EEEPSecondHorizLine));
       
   176  	TInt index = ConvertLayoutToIndex();
       
   177     if ( index == 2 || index == 3 )
       
   178         {
       
   179         index = 0;
       
   180         }
       
   181     iInputPane->SetLayoutIndex(index);
       
   182     TRect outerRect = TRect();
       
   183     TRect innerRect = TRect();
       
   184     CalculateFrameRects(outerRect, innerRect);
       
   185 
       
   186     iBgContext = CAknsFrameBackgroundControlContext::NewL(KAknsIIDQsnFrPopup, outerRect, innerRect, ETrue);
       
   187     LayoutContainer();
       
   188     ActivateL();
       
   189     }
       
   190 
       
   191 CAknFepUICtrlContainerChinese::~CAknFepUICtrlContainerChinese()
       
   192     {
       
   193     iEikonEnv->EikAppUi()->RemoveFromStack(this);
       
   194     delete iLafDataMgr;
       
   195     delete iInputPane;
       
   196     delete iCandidatePane;
       
   197     delete iPinyinPopupWindow;
       
   198     delete iEditPane;
       
   199     delete iBgContext;
       
   200     }
       
   201 
       
   202 CCoeControl* CAknFepUICtrlContainerChinese::ComponentControl(TInt aIndex) const 
       
   203     {
       
   204     CCoeControl* controls[] = 
       
   205         {
       
   206         iInputPane,
       
   207         iCandidatePane,
       
   208         iEditPane,
       
   209         iPinyinPopupWindow
       
   210         } ;
       
   211 
       
   212     for (TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
       
   213         {
       
   214         if (controls[ii] && aIndex-- == 0)
       
   215             {
       
   216             return controls[ii] ;
       
   217             }
       
   218         }
       
   219     // shouldn't be called while no components.
       
   220     return NULL ;
       
   221     }
       
   222 
       
   223 TInt CAknFepUICtrlContainerChinese::CountComponentControls() const
       
   224     {
       
   225     CCoeControl* controls[] = 
       
   226         {
       
   227         iInputPane,
       
   228         iCandidatePane,
       
   229         iEditPane,
       
   230         iPinyinPopupWindow
       
   231         } ;
       
   232 
       
   233     TInt count = 0 ;
       
   234     for (TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
       
   235         {
       
   236         if(controls[ii])
       
   237             {
       
   238             count++ ;
       
   239             }
       
   240         }
       
   241     return count ;
       
   242     }
       
   243 
       
   244 TInt CAknFepUICtrlContainerChinese::ConvertLayoutToIndex() const
       
   245     {
       
   246     TInt layout = -1;
       
   247     // switch on the cases in reverse order, and count our way through
       
   248     // the possible layouts to determine the index into the layout
       
   249     // this means that it is easier to add another layout in between
       
   250     switch(iPaneLayout)
       
   251         {
       
   252         case ELayoutKeystroke: //index 3
       
   253             layout++;
       
   254         case ELayoutPhraseCreation: //index 2
       
   255             layout++;
       
   256 	    case ELayoutCandidate: //index 1
       
   257 		    layout++;
       
   258 	    case ELayoutInput: //index 0
       
   259 		    layout++;
       
   260         default:
       
   261             break;
       
   262         }
       
   263     return layout;
       
   264     }
       
   265 
       
   266 void CAknFepUICtrlContainerChinese::LayoutFrames()
       
   267     {
       
   268     TRect outerRect;
       
   269     TRect innerRect;
       
   270     CalculateFrameRects(outerRect, innerRect);
       
   271     iBgContext->SetFrameRects(outerRect, innerRect);
       
   272     iBgContext->SetParentPos(PositionRelativeToScreen());
       
   273     }
       
   274 
       
   275 void CAknFepUICtrlContainerChinese::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
       
   276     {
       
   277     TRect windowRect = Rect();
       
   278     TPoint lPoint(0,0);
       
   279     TPoint rPoint(0,0);
       
   280     TAknLayoutRect topLeft;
       
   281     topLeft.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_2());
       
   282 
       
   283     TAknLayoutRect bottomRight;
       
   284     bottomRight.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_5());
       
   285     lPoint.iX = bottomRight.Rect().iTl.iX;
       
   286     lPoint.iY = bottomRight.Rect().iTl.iY;
       
   287     rPoint.iX = bottomRight.Rect().iBr.iX;
       
   288     rPoint.iY = bottomRight.Rect().iBr.iY;
       
   289 
       
   290     aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
   291     aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
   292     }
       
   293 
       
   294 void CAknFepUICtrlContainerChinese::Draw(const TRect& /*aRect*/) const
       
   295     {
       
   296     CWindowGc& gc = SystemGc();
       
   297     TBool skinnedDraw = EFalse;
       
   298     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   299 
       
   300     TRect outerRect;
       
   301     TRect innerRect;
       
   302     CalculateFrameRects(outerRect, innerRect);
       
   303     gc.Clear(Rect());
       
   304 
       
   305     skinnedDraw = AknsDrawUtils::DrawFrame(
       
   306 	    skin, gc, 
       
   307 	    outerRect, innerRect, 
       
   308 	    KAknsIIDQsnFrPopupSub, KAknsIIDQsnFrPopupCenterSubmenu); 
       
   309 
       
   310     TRgb separatorColor = iHorizLine.Color();
       
   311     AknsUtils::GetCachedColor( skin, separatorColor,
       
   312           KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG8 );
       
   313     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   314     gc.SetBrushColor( separatorColor );
       
   315 
       
   316     if(!skinnedDraw)
       
   317 	    {
       
   318 	    iRectCoverMainPaneInput.DrawRect(gc);
       
   319 	    iRectFirstShadowInput.DrawRect(gc);
       
   320 	    iRectOutlineFrameInput.DrawRect(gc);
       
   321 	    iRectInsideAreaInput.DrawRect(gc);
       
   322 	    }
       
   323 	    
       
   324     TInt index = ConvertLayoutToIndex();
       
   325     if ( iInputPane->IsVisible( ) || iPinyinPopupWindow->IsVisible() || 
       
   326             iPhraseCreationLaf)
       
   327         {
       
   328         if ( index == 0 || index == 1 )
       
   329             {
       
   330             iHorizLine.DrawRect(gc);
       
   331             }
       
   332         }
       
   333     if ( index == 2 )
       
   334         {
       
   335         iEEPFirstHorizLine.DrawRect(gc);
       
   336         iEEPSecondHorizLine.DrawRect(gc);
       
   337         }
       
   338     else if ( index == 3 )
       
   339         {
       
   340         iEEPFirstHorizLine.DrawRect(gc);
       
   341         }
       
   342 
       
   343     } 
       
   344 
       
   345 void CAknFepUICtrlContainerChinese::SizeChanged()
       
   346     {
       
   347     iLafDataMgr->ReadLafInfo();
       
   348     LayoutRects();
       
   349     LayoutContainedControls();
       
   350     LayoutFrames();
       
   351     }
       
   352 
       
   353 void CAknFepUICtrlContainerChinese::SetLayout(TPaneLayout aPaneLayout)
       
   354     {
       
   355     if(iPaneLayout != aPaneLayout)
       
   356         {
       
   357         iPaneLayout = aPaneLayout;
       
   358         SetControlVisibility();
       
   359         // set visible candidate length 
       
   360         iCandidatePane->SetPaneLayout(aPaneLayout);
       
   361         TInt index = ConvertLayoutToIndex();
       
   362         if ( index == 2 || index == 3)
       
   363             {
       
   364             index = 0;
       
   365             }
       
   366         iCandidatePane->SetVisibleCandidateCount(aPaneLayout - index);
       
   367         iInputPane->SetLayoutIndex( index );
       
   368         LayoutContainer();
       
   369         DrawDeferred();
       
   370         }
       
   371     }
       
   372 
       
   373 void CAknFepUICtrlContainerChinese::FocusCandidatePane(TBool aValue)
       
   374     {
       
   375     iInputPane->SetHighlighted(!aValue);
       
   376     iCandidatePane->SetHighlighted(aValue);
       
   377     }
       
   378 
       
   379 void CAknFepUICtrlContainerChinese::SelectionPopupEnabled(TBool /*aEnabled*/)
       
   380     {
       
   381     // ensure that the input pane is only visible if the popup is not enabled
       
   382     SetControlVisibility();
       
   383     }
       
   384 
       
   385 TTypeUid::Ptr CAknFepUICtrlContainerChinese::MopSupplyObject(TTypeUid aId)
       
   386     {
       
   387     if (aId.iUid == MAknsControlContext::ETypeId)
       
   388         return ( MAknsControlContext::SupplyMopObject(aId, iBgContext));
       
   389     return CCoeControl::MopSupplyObject(aId);
       
   390     }
       
   391 
       
   392 void CAknFepUICtrlContainerChinese::SelectionPopupSizeChanged(TInt /*aNumLines*/)
       
   393     {
       
   394     LayoutContainer();
       
   395     DrawDeferred();
       
   396     }
       
   397 
       
   398 void CAknFepUICtrlContainerChinese::LayoutPinyinPopupWindow()
       
   399     {
       
   400     TRect popupRect(Position(), Size()); 
       
   401     TRect pinyinRect = popupRect;
       
   402     TAknWindowLineLayout entryHorizLine = 
       
   403         CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryHorizLineWindow ));
       
   404     TAknWindowLineLayout entryPaneLine = 
       
   405         CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryPaneWindowLine ));
       
   406     TAknWindowLineLayout eepFirstHorizLine = 
       
   407         CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEEPFirstHorizLineWindow ));
       
   408     TAknWindowLineLayout eepSecondHorizLine = 
       
   409         CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEEPSecondHorizLineWindow ));
       
   410     TAknLayoutRect layoutLineEntry, layoutLineEntryPane, layoutLineFirstHorizEEP, layoutLineSecondHorizEEP;
       
   411     TRect layoutLineRectEntry, layoutLineRectEntryPane, layoutLineRectFirstHorizEEP, layoutLineRectSecondHorizEEP;
       
   412     TInt index = ConvertLayoutToIndex();
       
   413     if ( 2 == index )
       
   414         {
       
   415         layoutLineFirstHorizEEP.LayoutRect( popupRect, eepFirstHorizLine );
       
   416         layoutLineRectFirstHorizEEP = layoutLineFirstHorizEEP.Rect();
       
   417         layoutLineSecondHorizEEP.LayoutRect( popupRect, eepSecondHorizLine );
       
   418         layoutLineRectSecondHorizEEP = layoutLineSecondHorizEEP.Rect();
       
   419         
       
   420         pinyinRect.iTl.iY = layoutLineRectFirstHorizEEP.iBr.iY;
       
   421         pinyinRect.iBr.iY = layoutLineRectSecondHorizEEP.iTl.iY;
       
   422         }
       
   423     else
       
   424         {
       
   425         layoutLineEntry.LayoutRect( popupRect, entryHorizLine );
       
   426         layoutLineRectEntry = layoutLineEntry.Rect();
       
   427         layoutLineEntryPane.LayoutRect( popupRect, entryPaneLine );
       
   428         layoutLineRectEntryPane = layoutLineEntryPane.Rect();
       
   429         pinyinRect.iTl.iY = layoutLineRectEntryPane.iTl.iY;
       
   430         pinyinRect.SetHeight(layoutLineRectEntry.iTl.iY - pinyinRect.iTl.iY);
       
   431         }
       
   432     iPinyinPopupWindow->SetRect(pinyinRect);
       
   433     }
       
   434 
       
   435 void CAknFepUICtrlContainerChinese::LayoutPinyinEEPWindow()
       
   436     {
       
   437     TRect rect = Rect();  
       
   438     TAknWindowLineLayout EEPWindowLayout;
       
   439     if ( iPaneLayout == ELayoutPhraseCreation )
       
   440     	{
       
   441     	EEPWindowLayout =
       
   442     	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEEPWindowLayout));
       
   443     	}
       
   444     else
       
   445     	{
       
   446     	EEPWindowLayout =
       
   447     	    	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEntryPaneWindowLine));
       
   448     	}       
       
   449     AknLayoutUtils::LayoutControl(iEditPane, rect, EEPWindowLayout);
       
   450     }
       
   451 
       
   452 void CAknFepUICtrlContainerChinese::SetControlVisibility()
       
   453     {
       
   454     TBool popupEnabled = iPinyinPopupWindow->IsEnabled();
       
   455 
       
   456     switch(iPaneLayout)
       
   457 	    {
       
   458     case ELayoutCandidate:
       
   459         // predicative candidate state
       
   460         iInputPane->MakeVisible(EFalse);
       
   461         iPhraseCreationLaf = EFalse;
       
   462         break;
       
   463     case ELayoutInput:
       
   464         // input state
       
   465         iInputPane->MakeVisible(!popupEnabled);
       
   466         iPhraseCreationLaf = EFalse;
       
   467         break;
       
   468     case ELayoutPhraseCreation:
       
   469         if ( !iPhraseCreationLaf )
       
   470             {
       
   471             // input state
       
   472             iInputPane->MakeVisible( !popupEnabled );
       
   473             }
       
   474         else
       
   475             {
       
   476             iPhraseCreationLaf= EFalse;
       
   477             }
       
   478     default:
       
   479 	    break;
       
   480 	    }
       
   481     }
       
   482 
       
   483 void CAknFepUICtrlContainerChinese::SetIsShownWithPopupWindows(TBool aValue)
       
   484     {
       
   485     if(!COMPARE_BOOLS(iIsShownWithPopupWindows,aValue))	
       
   486         { 
       
   487         iIsShownWithPopupWindows = aValue;
       
   488         // need to layout container first, so that the parent rect is the right size...
       
   489         LayoutContainer();
       
   490         // ... now we can layout the rects relative to the resized parent
       
   491         LayoutRects();
       
   492         // don't need to layout controls, only the rects are affected
       
   493         DrawDeferred();
       
   494         }
       
   495     }
       
   496 
       
   497 void CAknFepUICtrlContainerChinese::SetContainerPosition(TPoint aCurPos, TInt aHeight)
       
   498     {
       
   499     TRect parentRect;
       
   500     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, parentRect);
       
   501     TInt windowHeight = 0;
       
   502     TInt index = ConvertLayoutToIndex();
       
   503     
       
   504     if ( index != 2 )
       
   505         {
       
   506         windowHeight = 
       
   507             CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEntry ));
       
   508         isPCLPosed = EFalse;
       
   509         }
       
   510     else
       
   511         {
       
   512         windowHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEEP ));
       
   513         isPCLPosed = ETrue;
       
   514         }
       
   515     // Laf comments: In case there is enough space on the main pane to show the window under the entry,
       
   516     // the window is placed 3 pixels below the text baseline of the entry. In case there is no space on 
       
   517     // the main pane to show the window fully under the entry, the window is placed 17(16 pixel font) or
       
   518     // 13(12 pixel font) pixels above the baseline of the entry.
       
   519     if(aCurPos.iY + 3 + windowHeight < parentRect.iBr.iY) 
       
   520         {
       
   521         iContainerPosition.iY = aCurPos.iY + 3; 
       
   522         }
       
   523     else
       
   524         {
       
   525         iContainerPosition.iY = aCurPos.iY - windowHeight - (aHeight + 1); 
       
   526         }
       
   527     if ((( iContainerPosition.iY + windowHeight ) > parentRect.iBr.iY ) ||
       
   528         ( iContainerPosition.iY < parentRect.iTl.iY ))
       
   529     {
       
   530     iContainerPosition.iY = parentRect.iBr.iY - ( parentRect.iBr.iY - 
       
   531                             parentRect.iTl.iY ) / 2 - windowHeight / 2;
       
   532     }
       
   533     LayoutContainer();
       
   534     }
       
   535 
       
   536 void CAknFepUICtrlContainerChinese::ShowHorizontalScrollArrows(TBool aValue)
       
   537     {
       
   538     iCandidatePane->ShowHorizontalScrollArrows(aValue);
       
   539     }    
       
   540    
       
   541 void CAknFepUICtrlContainerChinese::ShowVerticalScrollArrows(TBool aValue)
       
   542     {
       
   543     iCandidatePane->ShowVerticalScrollArrows(aValue);
       
   544     }
       
   545 
       
   546 void CAknFepUICtrlContainerChinese::LayoutInputPane()
       
   547     {
       
   548     TRect rect = Rect();
       
   549     TAknWindowLineLayout entryPaneWindowLine = 
       
   550         CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryPaneWindowLine ));
       
   551     TInt index = ConvertLayoutToIndex();
       
   552     if ( index == 2)
       
   553         {
       
   554         TInt eepPopupHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEEP ));
       
   555         TInt entryPopupHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEntry ));
       
   556         rect.iTl.iY = rect.iTl.iY + eepPopupHeight - entryPopupHeight;
       
   557         }
       
   558     AknLayoutUtils::LayoutControl(iInputPane, rect, entryPaneWindowLine);
       
   559     }
       
   560 
       
   561 void CAknFepUICtrlContainerChinese::LayoutContainedControls()
       
   562     {
       
   563     LayoutInputPane();
       
   564     // layout candidate pane
       
   565     TAknWindowLineLayout candidatePaneWindowLine = 
       
   566                 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( ECandidatePaneWindowLine ));
       
   567     TInt index = ConvertLayoutToIndex();
       
   568     if (index == 2)
       
   569         {
       
   570         if ( isPCLPosed )
       
   571             {
       
   572             iEditPane->Enable( ETrue );      
       
   573             AknLayoutUtils::LayoutControl( iCandidatePane, Rect(), candidatePaneWindowLine );
       
   574             LayoutPinyinPopupWindow();
       
   575             LayoutPinyinEEPWindow();
       
   576             }
       
   577         }
       
   578     else if ( index == 0 || index == 1 ) 
       
   579         {
       
   580         TRect rect = Rect();
       
   581         iEditPane->Enable(EFalse);
       
   582         AknLayoutUtils::LayoutControl(iCandidatePane, rect, candidatePaneWindowLine);
       
   583         LayoutPinyinPopupWindow();
       
   584         }
       
   585     else
       
   586         {
       
   587         iEditPane->Enable(ETrue);
       
   588         iPinyinPopupWindow->Enable(EFalse);
       
   589         AknLayoutUtils::LayoutControl(iCandidatePane, Rect(), candidatePaneWindowLine);
       
   590         LayoutPinyinEEPWindow();
       
   591         }
       
   592     }
       
   593 
       
   594 void CAknFepUICtrlContainerChinese::LayoutContainer()
       
   595     {
       
   596     TInt layoutIndex = ConvertLayoutToIndex(); // 0 : input state layout, 1 : candidate state layout
       
   597     TRect rect;
       
   598     switch ( layoutIndex )
       
   599         {
       
   600         case 2:
       
   601             rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
       
   602             break;
       
   603         case 1:
       
   604             rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectCandatate ));
       
   605             break;
       
   606         default:
       
   607             rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEntry ));
       
   608             break;
       
   609         }
       
   610     TInt rectHeight = rect.iBr.iY - rect.iTl.iY;
       
   611     rect.iTl.iY = iContainerPosition.iY;
       
   612     rect.iBr.iY = iContainerPosition.iY + rectHeight;
       
   613     SetRect(rect); 
       
   614     }
       
   615 
       
   616 void CAknFepUICtrlContainerChinese::LayoutRects()
       
   617     {
       
   618     TInt index = ConvertLayoutToIndex();
       
   619     TRect rect = Rect();
       
   620 
       
   621     if ( index == 3 )
       
   622         {
       
   623         index = 0;
       
   624         }
       
   625     
       
   626     switch (index) // 0 : input state, 1: predicative candidate state
       
   627 	    {
       
   628 	    case 0:
       
   629 		    iRectCoverMainPaneInput = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectCoverMainPaneInputEntry ));
       
   630 		    iRectFirstShadowInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectFirstShadowInputEntry ));
       
   631 		    iRectOutlineFrameInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectOutlineFrameInputEntry ));
       
   632 		    iRectInsideAreaInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectInsideAreaInputEntry ));
       
   633 		    break;
       
   634         case 1:
       
   635 		    iRectCoverMainPaneInput = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectCoverMainPaneInputCandidate ));
       
   636 		    iRectFirstShadowInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectFirstShadowInputCandidate ));
       
   637 		    iRectOutlineFrameInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectOutlineFrameInputCandidate ));
       
   638 		    iRectInsideAreaInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectInsideAreaInputCandidate ));
       
   639 		    break;
       
   640         case 2:
       
   641 		    iRectCoverMainPaneInput = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectCoverMainPaneInputEEP));
       
   642 		    iRectFirstShadowInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectFirstShadowInputEEP ));
       
   643 		    iRectOutlineFrameInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectOutlineFrameInputEEP ));
       
   644 		    iRectInsideAreaInput= CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectInsideAreaInputEEP ));
       
   645             break;
       
   646         default: 
       
   647             break;
       
   648 	    }
       
   649     }
       
   650 
       
   651 void CAknFepUICtrlContainerChinese::HandleResourceChange(TInt aType)
       
   652     {
       
   653     // maybe should be KEikDynamicLayoutVariantSwitch_APAC, need to have a try after it's ready.
       
   654     if(aType == KEikDynamicLayoutVariantSwitch)
       
   655         {
       
   656         LayoutContainer();
       
   657         }
       
   658     else
       
   659         {
       
   660         CCoeControl::HandleResourceChange(aType);
       
   661         }
       
   662     }
       
   663 void CAknFepUICtrlContainerChinese::SetControlInVisible( TBool aVisible )
       
   664     {
       
   665     ShowVerticalScrollArrows( EFalse );
       
   666     if ( aVisible == EFalse )
       
   667         {
       
   668         iCandidatePane->SetInVisiable();
       
   669         }
       
   670     iPinyinPopupWindow->MakeVisible( EFalse );
       
   671     iInputPane->MakeVisible( EFalse );
       
   672     iPhraseCreationLaf= ETrue;
       
   673     }
       
   674 
       
   675 
       
   676 TInt& CAknFepUICtrlContainerChinese::IsPhraseCreation()
       
   677     {
       
   678     return iPhraseCreation;
       
   679     }
       
   680 
       
   681 void CAknFepUICtrlContainerChinese::PhraseCreation(  TBool aPhraseCreation )
       
   682     {
       
   683     if ( iPhraseCreation != aPhraseCreation )
       
   684         {
       
   685         iPhraseCreation = aPhraseCreation;
       
   686         }
       
   687     }
       
   688 
       
   689 void CAknFepUICtrlContainerChinese::SetFepMan( MAknFepManagerUIInterface* aFepMan )
       
   690     {
       
   691     iFepMan = aFepMan;
       
   692     }