textinput/peninputgenericitut/src/peninputgenericitutwindow.cpp
branchRCL_3
changeset 44 ecbabf52600f
child 50 5a1685599b76
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  drop-down list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknlayoutscalable_apps.cdl.h>
       
    20 #include <peninputgeneralitutnew.rsg>
       
    21 #include <peninputitutconfig_chinese.rsg>
       
    22 #include <skinlayout.cdl.h>
       
    23 #include <AknsDrawUtils.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <AknUtils.h> 
       
    26 #include <peninputrawkeybutton.h>
       
    27 #include <peninputrepeatbutton.h>
       
    28 #include <peninputcommonbutton.h>
       
    29 #include "peninputrepeatbuttonex.h"
       
    30 #include <AknFepGlobalEnums.h>
       
    31 #include <aknfeppeninputenums.h>
       
    32 #include <peninputdropdownlist.h>
       
    33 #include <peninputlayoutchoicelist.h>
       
    34 #include <peninputscrollablelist.h>
       
    35 #include <s32mem.h>
       
    36 #include <peninputlabel.h>
       
    37 #include <peninputlayoutinputmodechoice.h>
       
    38 #include <peninputlayoutbubblectrl.h>
       
    39 
       
    40 #include "peninputgenericitutwindow.h"
       
    41 #include "peninputgenericitutdatamgr.h"
       
    42 #include "peninputgenericitutuimgrbase.h"
       
    43 #include "peninputgenericitutuistatebase.h"
       
    44 #include "peninputitutchnuimgr.h"
       
    45 #include "peninputitutwesternuimgr.h"
       
    46 #include "peninputgenericitutconverter.h"
       
    47 #include "peninputcommonbgctrl.h"
       
    48 
       
    49 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputgenericitut.mbm");
       
    50 _LIT(KEmptyString, "");
       
    51 
       
    52 const TInt KImageMajorSkinId = EAknsMajorGeneric;
       
    53 const TUint KDefaultSpellTextColor = 0;
       
    54 const TUint KDefaultIcfTextColor = 0x000000;
       
    55 const TUint KDefaultIcfFrameColor = 0x000000;
       
    56 
       
    57 const TInt KSpaceUnicode = 32;
       
    58 const TInt KButtonOneUnicode = 49;
       
    59 
       
    60 CGenericItutWindow* CGenericItutWindow::NewL(CGenericItutWindowManager* aWindowMgr,
       
    61                                              CGenericItutUiLayout* aLayoutOwner,
       
    62                                              CGenericItutDataMgr* aDataMgr)
       
    63     {
       
    64     CGenericItutWindow* window = new (ELeave) CGenericItutWindow(aWindowMgr,aLayoutOwner,aDataMgr);
       
    65 
       
    66     CleanupStack::PushL(window);
       
    67     window->ConstructL();
       
    68     CleanupStack::Pop(window);
       
    69 
       
    70     return window;
       
    71     }
       
    72 
       
    73 CGenericItutWindow::CGenericItutWindow(CGenericItutWindowManager* aWindowMgr, 
       
    74                                        CGenericItutUiLayout* aLayoutOwner,
       
    75                                        CGenericItutDataMgr* aDataMgr)
       
    76     : iDataMgr(aDataMgr),
       
    77       iLayoutOwner(aLayoutOwner),
       
    78       iWindowMgr(aWindowMgr),
       
    79       iIndiWithText( EFalse )
       
    80     {
       
    81     }
       
    82 
       
    83 CGenericItutWindow::~CGenericItutWindow()
       
    84     {
       
    85     delete iBmpRotator;
       
    86     }
       
    87 
       
    88 void CGenericItutWindow::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, 
       
    89                                         const TDesC& aPropertyValue)
       
    90     {
       
    91     switch (aPropertyName)
       
    92         {
       
    93         case MItutPropertySubscriber::EItutPropertyKeypadResourceId:
       
    94         case MItutPropertySubscriber::EItutPropertyCandidateListResourceId:
       
    95             {
       
    96             TInt resId = TItutDataConverter::AnyToInt(const_cast<TUint16*>(aPropertyValue.Ptr()));
       
    97             
       
    98             if (resId == KInvalidResId)
       
    99                 {
       
   100                 return;
       
   101                 }
       
   102 
       
   103             if (aPropertyName == MItutPropertySubscriber::EItutPropertyKeypadResourceId)
       
   104                 {
       
   105                 ConstructItutKeypadFromResourceL(resId);
       
   106                 }
       
   107             else if (iCandsList)
       
   108                 {
       
   109                 iCandsList->ResetAndClear(CFepCtrlDropdownList::EListExpandable);
       
   110                 iCandsList->SetResourceId(resId);
       
   111                 iCandsList->ConstructFromResourceL();                  
       
   112                 }
       
   113             }
       
   114             break;
       
   115         case MItutPropertySubscriber::EItutPropertyLandscape:
       
   116             {
       
   117             TBool landscape = *((TInt*)(aPropertyValue.Ptr()));
       
   118 
       
   119             if (iDataMgr->IsChinese())
       
   120                 {
       
   121                 if (landscape)
       
   122                     {
       
   123                     // expand upward
       
   124                     iSpellCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   125                     iCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   126                     }
       
   127                 else
       
   128                     {
       
   129                     // portrait, expand downward
       
   130                     iSpellCandsList->SetCandExpandType();
       
   131                     iCandsList->SetCandExpandType();
       
   132                     }
       
   133                 }
       
   134             }
       
   135             break;
       
   136         default:
       
   137             break;    
       
   138         }
       
   139     }
       
   140 
       
   141 void CGenericItutWindow::CreateItutKeypadL()
       
   142     {
       
   143     TRect keypadRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EKeypadRect));
       
   144 
       
   145     TFontSpec spec;
       
   146 
       
   147     iStandardItutKp = CVirtualKeyboard::NewL(keypadRect,
       
   148                                              iLayoutOwner,
       
   149                                              ECtrlIdStdItut,
       
   150                                              spec);
       
   151     AddControlL(iStandardItutKp);
       
   152 
       
   153     iStandardItutKp->SetResourceId(KInvalidResId);
       
   154 	
       
   155 	// read keypad image info
       
   156 	ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP );
       
   157 	
       
   158     iStandardItutKp->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG65 );
       
   159     iStandardItutKp->SetDrawOpaqueBackground(EFalse);
       
   160     
       
   161     // read key shift icon res
       
   162     CPenInputColorIcon* shiftIcon = CPenInputColorIcon::NewL( R_ITUT_KEYPAD_SHIFT_ICON );
       
   163     if ( iDataMgr->IsPortraitWest())
       
   164         {
       
   165     	CPenInputColorIcon* starIcon = CPenInputColorIcon::NewL( R_ITUT_KEYPAD_STAR_ICON );
       
   166         shiftIcon->ResizeL( iDataMgr->iShiftIconRectForPrtWest.Size());
       
   167         starIcon->ResizeL( iDataMgr->iStarIconRectForPrtWest.Size());
       
   168         iStandardItutKp->SetStarIcon( starIcon );
       
   169         }
       
   170     else
       
   171         {
       
   172         shiftIcon->ResizeL( iDataMgr->iShiftIconRect.Size());
       
   173         }
       
   174     iStandardItutKp->SetShiftIcon( shiftIcon );
       
   175 
       
   176     //set key to be 9 piece graphics
       
   177     iStandardItutKp->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
       
   178     iStandardItutKp->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
       
   179     iStandardItutKp->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
       
   180     }
       
   181 
       
   182 void CGenericItutWindow::CreateLayoutIconL(TInt aMajorSkinId,
       
   183                                              TInt aMinorSkinId,
       
   184                                              const TDesC& aBmpFileName,
       
   185                                              TInt aBmpId,
       
   186                                              TInt aMaskBmpId,
       
   187                                              CFbsBitmap*& aBmp,
       
   188                                              CFbsBitmap*& aMaskBmp,
       
   189                                              TSize aSize)
       
   190     {
       
   191     TAknsItemID id;
       
   192     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   193     id.Set(TInt(aMajorSkinId), aMinorSkinId);
       
   194 
       
   195     if (aBmpId != KInvalidBmp)
       
   196         {
       
   197         if (aMaskBmpId != KInvalidBmp)
       
   198             {
       
   199             AknsUtils::CreateIconL(skininstance,
       
   200                                    id,
       
   201                                    aBmp,
       
   202                                    aMaskBmp,
       
   203                                    aBmpFileName,
       
   204                                    aBmpId,
       
   205                                    aMaskBmpId);
       
   206             AknIconUtils::SetSize(aMaskBmp, aSize, EAspectRatioNotPreserved);
       
   207             }
       
   208         else
       
   209             {
       
   210             AknsUtils::CreateIconL(skininstance,
       
   211                                    id,
       
   212                                    aBmp,
       
   213                                    aBmpFileName,
       
   214                                    aBmpId);
       
   215             }
       
   216 
       
   217         AknIconUtils::SetSize(aBmp, aSize, EAspectRatioNotPreserved);
       
   218         }
       
   219     }
       
   220 
       
   221 void CGenericItutWindow::ConstructItutKeypadFromResourceL(TInt aResId)
       
   222     {
       
   223     iStandardItutKp->SetResourceId(aResId);
       
   224 
       
   225     iStandardItutKp->SetTextLineLayout(
       
   226         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
   227         EPosLeft);
       
   228     iStandardItutKp->SetTextLineLayout(
       
   229         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
   230         EPosRight1);
       
   231     iStandardItutKp->SetTextLineLayout(
       
   232         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
   233         EPosRight2);
       
   234     iStandardItutKp->SetTextLineLayout(
       
   235         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
   236         EPosRight3);
       
   237 
       
   238     TResourceReader reader;
       
   239     CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId);
       
   240 
       
   241     // construct keys
       
   242     TInt countkeys = reader.ReadInt16();
       
   243 
       
   244     RPointerArray<CVirtualKey>& keys = 
       
   245         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
   246 
       
   247     if (keys.Count() == 0)
       
   248         {
       
   249         for (TInt i = 0; i < countkeys; i++)
       
   250             {
       
   251             RArray<TRect>& cellrects = 
       
   252                        TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
   253 
       
   254             CVirtualKey* vk = CreateKeyL(reader,
       
   255                                          cellrects[i]);
       
   256             CleanupStack::PushL(vk);
       
   257             iStandardItutKp->AddRawKeyL(vk);
       
   258             CleanupStack::Pop(vk);
       
   259             }
       
   260         }
       
   261     else
       
   262         {
       
   263         countkeys = keys.Count();
       
   264         for (TInt i = 0; i < countkeys; i++)
       
   265             {
       
   266             ChangeVirtualKeyInfoL(reader, keys[i]);
       
   267             }
       
   268         }
       
   269 
       
   270     CleanupStack::PopAndDestroy(1); // reader
       
   271 	
       
   272 	iStandardItutKp->Draw();
       
   273     iStandardItutKp->UpdateArea( iStandardItutKp->Rect() );
       
   274 
       
   275 	//iLayoutOwner->RootControl()->Draw();
       
   276     }
       
   277 
       
   278 void CGenericItutWindow::ChangeVirtualKeyInfoL(TResourceReader& aReader, 
       
   279                                                 CVirtualKey* aKey)
       
   280     {
       
   281 
       
   282     TBuf<5> mapData;
       
   283     //Init Data
       
   284     for (TInt i = 0; i < 5; i++)
       
   285         {
       
   286         mapData.Append(0);
       
   287         }
       
   288     
       
   289     RPointerArray<HBufC> unicodesArr;
       
   290     for (TInt i = 0; i <= EPosLast; i++)
       
   291         {
       
   292         HBufC* unicode = aReader.ReadHBufCL();
       
   293         if (i == 0 && unicode != NULL)
       
   294             {
       
   295             mapData = unicode->Des();
       
   296             }
       
   297         unicodesArr.AppendL(unicode);
       
   298         }
       
   299 
       
   300     TInt keyscancode = aReader.ReadInt16();
       
   301     if (keyscancode != aKey->ScanCode())
       
   302         {
       
   303         return;
       
   304         }
       
   305     
       
   306     TInt curMode = TItutDataConverter::AnyToInt(
       
   307             iLayoutOwner->DataMgr()->RequestData(EInputMode));
       
   308     TBool isChinese = iLayoutOwner->DataMgr()->IsChinese();
       
   309     TBool isThai = iLayoutOwner->DataMgr()->IsThai();
       
   310     
       
   311     TInt latinOnly = TItutDataConverter::AnyToInt(
       
   312             iLayoutOwner->DataMgr()->RequestData(ELatinOnly));     
       
   313             
       
   314     //No symbol in Number range. Symbols under chinese are read from res 
       
   315     if ( curMode != ENumber && curMode != ENativeNumber 
       
   316          && iSymbolData.iSymbol1 != 0 && keyscancode == KButtonOneUnicode 
       
   317          && ( !isChinese || latinOnly )
       
   318          && ( !isThai ) && (curMode != EHangul) )
       
   319         {
       
   320         //This array is alloced when
       
   321         //HBufC* unicode = aReader.ReadHBufCL();
       
   322         //unicodesArr.AppendL(unicode);
       
   323         //So we should delete it
       
   324         for (TInt i = 0; i <= EPosLast; i++)
       
   325             {
       
   326             delete unicodesArr[i];
       
   327             }
       
   328         SetUnicodesForHardKey1(aKey, mapData);
       
   329         }
       
   330     else
       
   331         {
       
   332         aKey->SetUnicodesL(unicodesArr);
       
   333         }
       
   334 
       
   335     unicodesArr.Close();
       
   336     }
       
   337 
       
   338 CVirtualKey* CGenericItutWindow::CreateKeyL(TResourceReader& aReader,
       
   339                                               TRect aKeyRect)
       
   340     {
       
   341     RPointerArray<HBufC> unicodesArr;
       
   342     for (TInt i = 0; i <= EPosLast; i++)
       
   343         {
       
   344         HBufC* unicode = aReader.ReadHBufCL();
       
   345         unicodesArr.AppendL(unicode);
       
   346         }
       
   347 
       
   348     TInt keyscancode = aReader.ReadInt16();
       
   349 
       
   350     CVirtualKey* vk = CVirtualKey::NewL(unicodesArr,
       
   351                                         keyscancode, 
       
   352                                         aKeyRect);
       
   353     unicodesArr.Close();
       
   354     CleanupStack::PushL(vk);
       
   355     
       
   356     TRect innerrect = aKeyRect;
       
   357     innerrect.Shrink(TSize(7, 7));
       
   358     vk->SetInnerRect(innerrect);
       
   359 
       
   360     CleanupStack::Pop(vk);
       
   361 
       
   362     return vk;
       
   363     }
       
   364 
       
   365 void CGenericItutWindow::CreateBackGroundControlL()
       
   366 	{
       
   367     iBackgroundCtrl = CAknFepCtrlCommonBgCtrl::NewL(
       
   368                                           iLayoutOwner,
       
   369                                           ECtrlIdBackground,
       
   370                                           KAknsIIDQsnFrPopup,
       
   371                                           KAknsIIDQsnFrPopupCenter);
       
   372 
       
   373 
       
   374 	iBackgroundCtrl->SetRect(TItutDataConverter::AnyToRect(
       
   375 					iLayoutOwner->DataMgr()->RequestData(ELayoutRect)));
       
   376 					    
       
   377 	AddControlL(iBackgroundCtrl);
       
   378 	}
       
   379 
       
   380 
       
   381 CAknFepCtrlCommonButton* CGenericItutWindow::CreateRawKeyButtonL(const TInt aControlId,
       
   382                                                         const TInt aCommand)
       
   383     {
       
   384     CAknFepCtrlCommonButton* temp = NULL;
       
   385     
       
   386     if (aCommand == KUnavailableID)
       
   387         {
       
   388         temp =  CAknFepCtrlRawKeyButton::NewL(iLayoutOwner,
       
   389                                              aControlId,
       
   390                                              KAknsIIDQsnFrFunctionButtonNormal,
       
   391 											 KAknsIIDQsnFrFunctionButtonPressed,
       
   392 											 KAknsIIDQsnFrFunctionButtonInactive,  
       
   393                                              EEventRawKeyDownEvent,
       
   394                                              EEventRawKeyUpEvent); 
       
   395         }
       
   396     else
       
   397         {
       
   398         temp =  CAknFepCtrlRawKeyButton::NewL(iLayoutOwner,
       
   399                                              aControlId,
       
   400                                              KAknsIIDQsnFrFunctionButtonNormal,
       
   401 											 KAknsIIDQsnFrFunctionButtonPressed,
       
   402 											 KAknsIIDQsnFrFunctionButtonInactive,  
       
   403                                              EEventRawKeyDownEvent,
       
   404                                              EEventRawKeyUpEvent,
       
   405                                              aCommand); 
       
   406         }
       
   407                                          
       
   408     return temp;       
       
   409     }
       
   410     
       
   411 CAknFepCtrlCommonButton* CGenericItutWindow::CreateCommonButtonL(const TInt aControlId)
       
   412     {
       
   413     return CAknFepCtrlCommonButton::NewL(iLayoutOwner, 
       
   414     									 aControlId,
       
   415     									 KAknsIIDQsnFrFunctionButtonNormal,
       
   416 										 KAknsIIDQsnFrFunctionButtonPressed,
       
   417 										 KAknsIIDQsnFrFunctionButtonInactive );
       
   418      
       
   419     }    
       
   420     
       
   421 CAknFepCtrlCommonButton* CGenericItutWindow::CreateRepeatButtonL(const TInt aControlId,
       
   422                                                                    const TInt aCommand)
       
   423     {
       
   424     return CAknFepCtrlRepeatButtonEx::NewL(iLayoutOwner,
       
   425                                            aControlId,
       
   426                                            KAknsIIDQsnFrFunctionButtonNormal,
       
   427 										   KAknsIIDQsnFrFunctionButtonPressed,
       
   428 										   KAknsIIDQsnFrFunctionButtonInactive,
       
   429                                            aCommand);
       
   430      
       
   431     }     
       
   432 
       
   433     
       
   434 CFepUiBaseCtrl* CGenericItutWindow::CreateButtonL(TButtonType aType,
       
   435                                                   const TInt aControlId,
       
   436                                                   const TInt aRectId,
       
   437                                                   const TInt aInnerRectId,
       
   438                                                   const TInt aResourceId,
       
   439                                                   const TInt aCommand)
       
   440     {
       
   441     CAknFepCtrlCommonButton* temp = NULL;
       
   442     
       
   443     switch(aType)
       
   444         {
       
   445         case ERawKeyButton:
       
   446             {
       
   447             temp = CreateRawKeyButtonL(aControlId, aCommand);    
       
   448             }
       
   449         break;
       
   450         case ECommonButton:
       
   451             {
       
   452             temp = CreateCommonButtonL(aControlId);    
       
   453             }
       
   454         break;
       
   455         case ERepeatButtonEx:
       
   456             {
       
   457             temp = CreateRepeatButtonL(aControlId, aCommand);    
       
   458             }
       
   459         break;
       
   460         default:
       
   461             {
       
   462             User::Leave(KErrArgument);    
       
   463             }                
       
   464         }
       
   465 
       
   466     TRect btnrect;
       
   467     TRect btnInnerRect;
       
   468     
       
   469     if (aRectId != KUnavailableID &&
       
   470         aInnerRectId != KUnavailableID)
       
   471         {
       
   472         btnrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectId));
       
   473         btnInnerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRectId));
       
   474            
       
   475         temp->SetRect(btnrect);
       
   476         temp->SetForgroundBmpRect(btnInnerRect);
       
   477         }
       
   478         
       
   479     if (aResourceId != KUnavailableID)
       
   480         {
       
   481         temp->SetResourceId(aResourceId);
       
   482         temp->ConstructFromResourceL();            
       
   483         }
       
   484       
       
   485     if (aRectId != KUnavailableID &&
       
   486         aInnerRectId != KUnavailableID)
       
   487         {
       
   488         temp->SizeChanged(temp->Rect(), btnInnerRect, ETrue);
       
   489         }        
       
   490 
       
   491     AddControlL(temp);
       
   492     
       
   493     return temp;
       
   494     }
       
   495 
       
   496 
       
   497 void CGenericItutWindow::CreateAllButtonL()
       
   498     {
       
   499     //CFepUiBaseCtrl* temp = NULL;
       
   500     //create backgrand 
       
   501     CreateBackGroundControlL();
       
   502     
       
   503     //create backspace
       
   504     CreateButtonL(ERawKeyButton, ECtrlIdBackspace, EBackspaceRect, 
       
   505                   EBackspaceInnerRect,R_FINGER_RAWKEY_BACKSPACE);
       
   506 
       
   507     //create switch
       
   508     /*
       
   509     CreateButtonL(ECommonButton, ECtrlIdSwitch, ESwitchRect, 
       
   510                   ESwitchInnerRect, R_FINGER_LAYOUT_SWITCH);
       
   511                       
       
   512     //If open indicator menu, please use the following 2 lines
       
   513     temp = CreateButtonL(ECommonButton, ECtrlIdIndicator, KUnavailableID, 
       
   514                   KUnavailableID,KUnavailableID);
       
   515                   
       
   516     if (temp)
       
   517         {
       
   518         temp->Hide(ETrue);   
       
   519         }
       
   520     
       
   521     temp = NULL;
       
   522     */
       
   523 
       
   524     // create navi 
       
   525     CreateButtonL(ERawKeyButton, ECtrlIdArrowLeft, EArrowLeftRect, 
       
   526                   ELeftInnerRect,R_FINGER_RAWKEY_LEFTARROW);    
       
   527     
       
   528     CreateButtonL(ERawKeyButton, ECtrlIdArrowRight, EArrowRightRect, 
       
   529                   ERightInnerRect,R_FINGER_RAWKEY_RIGHTARROW); 
       
   530 
       
   531     CreateButtonL(ERepeatButtonEx, ECtrlIdArrowUp, EArrowUpRect, 
       
   532                   EUpInnerRect,R_PENINPUT_FINGER_CURSOR_UP); 
       
   533 
       
   534     CreateButtonL(ERepeatButtonEx, ECtrlIdArrowDown, EArrowDownRect, 
       
   535                   EDownInnerRect,R_PENINPUT_FINGER_CURSOR_DOWN);
       
   536 
       
   537     //create option 
       
   538     CreateButtonL(ECommonButton, ECtrlIdOptions, EOptionsRect, 
       
   539                   EOptionInnerRect, R_PENINPUT_FINGER_OPTIONS);    
       
   540     
       
   541     //Crease close
       
   542     CreateButtonL(ECommonButton, ECtrlIdClose, ECloseRect, 
       
   543                   ECloseInnerRect, R_PENINPUT_FINGER_CLOSE);  
       
   544                   
       
   545                   
       
   546     //CAknFepCtrlLabel* spellIndicator = CAknFepCtrlLabel::NewL(iLayoutOwner, ECtrlIdSpellIndicator);
       
   547     //AddControlL(spellIndicator);
       
   548     //spellIndicator->Hide(ETrue);
       
   549 
       
   550     }
       
   551 
       
   552 void CGenericItutWindow::CreateDropdownListL()
       
   553     {
       
   554 	TRect outrect,innerrect;
       
   555 	outrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleRect));  
       
   556 	innerrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleInnerRect));
       
   557     TAknTextLineLayout bubbleTextLayout = 
       
   558         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EPreviewBubbleTextlayout));
       
   559     CFont* bubbleFont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EPreviewBubbleFont));
       
   560     
       
   561     TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, 
       
   562     									KAknsIIDQsnFrFunctionButtonNormal,
       
   563     								    KAknsIIDQsnFrFunctionButtonPressed,
       
   564     						            KAknsIIDQsnFrItutButtonCandiSideL,
       
   565     						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
   566     						            KAknsIIDQsnFrItutButtonCandiSideR,
       
   567     						            KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
   568     						            KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
   569     						            KAknsIIDQsnFrItutButtonCandiPressedSideR,
       
   570     						            TRgb(194, 221, 242),
       
   571     						            ETrue);
       
   572     						            
       
   573     TDropdownListDrawInfo compositionDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, 
       
   574     									KAknsIIDQsnFrFunctionButtonNormal,
       
   575     								    KAknsIIDQsnFrFunctionButtonPressed,
       
   576     						            KAknsIIDQsnFrItutButtonComposeSideL,
       
   577     						            KAknsIIDQsnFrItutButtonComposeMiddle,
       
   578     						            KAknsIIDQsnFrItutButtonComposeSideR,
       
   579     						            KAknsIIDQsnFrItutButtonComposePressedSideL,
       
   580     						            KAknsIIDQsnFrItutButtonComposePressedSideR,
       
   581     						            KAknsIIDQsnFrItutButtonComposePressedMiddle,
       
   582     						            TRgb(194, 221, 242),
       
   583     						            ETrue);    						            
       
   584     TInt unitWidth =  TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth));
       
   585     TInt unitHeight = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitHeight));
       
   586     TInt horizontalMargin =  
       
   587         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin));
       
   588     TInt verticalMargin =  
       
   589         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin));
       
   590 
       
   591     CFont* listfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EDropdownListFont));
       
   592     TInt textmargin = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListTextMargin));
       
   593     TRgb textcolor = TItutDataConverter::AnyToRgb(iDataMgr->RequestData(EDropdownListTextColor));
       
   594 
       
   595     TPoint spellListLTPos = 
       
   596         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListSpellLTPos));
       
   597     // create spelling drop list
       
   598     iSpellCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   599                                                  ECtrlIdSpellCandsList,
       
   600                                                  R_AKN_FEP_PINYIN_SPELLING_DROP_DOWN_LIST,
       
   601                                                  spellListLTPos,
       
   602                                                  TSize(unitWidth, unitHeight),
       
   603                                                  5,
       
   604                                                  3);
       
   605 
       
   606     if (iDataMgr->IsLandScape())
       
   607         {
       
   608         iSpellCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   609         }
       
   610 
       
   611     iSpellCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   612     iSpellCandsList->SetFont(listfont);
       
   613     AddControlL(iSpellCandsList);
       
   614     iSpellCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   615     iSpellCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateFromBeginning);
       
   616     iSpellCandsList->SetFuzzyBoundry(10);
       
   617     iSpellCandsList->Hide(ETrue);
       
   618 	iSpellCandsList->SetDropdownListImgID(compositionDrawInfo);
       
   619 
       
   620     TPoint candListLTPos = 
       
   621         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListCandsLTPos));
       
   622     // create candidate drop list
       
   623     iCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   624                                             ECtrlIdStdCandsList,
       
   625                                             R_AKN_FEP_NORMAL_CAND_DROP_DOWN_LIST,
       
   626                                             candListLTPos,
       
   627                                             TSize(unitWidth, unitHeight),
       
   628                                             5,
       
   629                                             3);
       
   630 
       
   631     if (iDataMgr->IsLandScape())
       
   632         {
       
   633         iCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   634         }
       
   635 
       
   636     iCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   637     iCandsList->SetFont(listfont);
       
   638     AddControlL(iCandsList);
       
   639     iCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   640     iCandsList->SetEventIdForNextPageCandidate(EItutCmdGetNextCandidatePage);
       
   641     iCandsList->SetEventIdForCandidateExisted(EItutCmdCandidateExisted);
       
   642     iCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateAsEllipsis);        
       
   643     iCandsList->SetFuzzyBoundry(10);
       
   644     iCandsList->Hide(ETrue);
       
   645 	iCandsList->SetDropdownListImgID(candiDrawInfo);
       
   646 
       
   647     TPoint puncListLTPos = 
       
   648         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListPuncLTPos));
       
   649     // create punctuation drop list
       
   650     iPuncCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   651                                                 ECtrlIdPuncCandsList,
       
   652                                                 R_AKN_FEP_PUNC_DROP_DOWN_LIST,
       
   653                                                 puncListLTPos,
       
   654                                                 TSize(unitWidth, unitHeight),
       
   655                                                 5,
       
   656                                                 1);
       
   657     iPuncCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   658     iPuncCandsList->SetFont(listfont);
       
   659     AddControlL(iPuncCandsList);
       
   660     iPuncCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   661 	iPuncCandsList->SetDropdownListImgID(candiDrawInfo);
       
   662     iPuncCandsList->Hide(ETrue);
       
   663     }
       
   664 
       
   665 void CGenericItutWindow::ConstructIcfFromResourceL()
       
   666     {
       
   667     if (!iICF->ResourceId())
       
   668         {
       
   669         return;
       
   670         }
       
   671 
       
   672     TResourceReader icfreader;
       
   673     CCoeEnv::Static()->CreateResourceReaderLC(icfreader, iICF->ResourceId());
       
   674     TInt32 colorMajorSkinId = icfreader.ReadInt32();
       
   675     TInt skinitemid = icfreader.ReadInt16();
       
   676     TInt coloridx = icfreader.ReadInt16();
       
   677 
       
   678     TAknsItemID colorid;
       
   679     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   680 
       
   681     TRgb icftextcolor;
       
   682     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   683     TInt error = AknsUtils::GetCachedColor(skininstance, 
       
   684                                            icftextcolor, 
       
   685                                            colorid, 
       
   686                                            coloridx);
       
   687 
       
   688     if (error != KErrNone)
       
   689         {
       
   690         icftextcolor = TRgb(KDefaultIcfTextColor);
       
   691         }
       
   692 
       
   693     iICF->SetTextColorL(icftextcolor);    
       
   694     
       
   695     // Set highlight color
       
   696     TRgb icfhightlightcolor;
       
   697     error = AknsUtils::GetCachedColor( skininstance, 
       
   698                                        icfhightlightcolor, 
       
   699                                        KAknsIIDQsnHighlightColors,
       
   700                                        EAknsCIQsnHighlightColorsCG2 ); 
       
   701     if ( error == KErrNone ) 
       
   702         {
       
   703         iICF->SetTextSelColorL( icfhightlightcolor );
       
   704         }
       
   705 
       
   706     skinitemid = icfreader.ReadInt16();
       
   707     coloridx = icfreader.ReadInt16();
       
   708     
       
   709     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   710     
       
   711     TRgb icfframecolor;
       
   712     error = AknsUtils::GetCachedColor(skininstance, 
       
   713                                       icfframecolor, 
       
   714                                       colorid, 
       
   715                                       coloridx);
       
   716 
       
   717     if (error != KErrNone)
       
   718         {
       
   719     	icfframecolor = TRgb(KDefaultIcfFrameColor);
       
   720         }
       
   721 
       
   722     iICF->SetBorderColor(icfframecolor);
       
   723     CleanupStack::PopAndDestroy( 1 ); // icfreader
       
   724     }
       
   725 
       
   726 void CGenericItutWindow::CreateICFL()
       
   727     {
       
   728     CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
   729     TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect));
       
   730     iICF = CFepLayoutMultiLineIcf::NewL(rect, 
       
   731                                         iLayoutOwner, 
       
   732                                         ECtrlIdICF, 
       
   733                                         icffont->HeightInPixels(),
       
   734                                         icffont->FontMaxHeight(),
       
   735                                         icffont);
       
   736 
       
   737     iICF->SetFocus(ETrue);
       
   738 
       
   739     iICF->SetResourceId(R_FINGER_ICF);
       
   740     ConstructIcfFromResourceL();
       
   741     iICF->SetBgImgSkinId(KAknsIIDQgnGrafFepInputBg);
       
   742     //iDataMgr->SetTextAlignment();
       
   743     
       
   744     AddControlL(iICF);
       
   745     }
       
   746 
       
   747 void CGenericItutWindow::AddEditorMenuL()
       
   748     {
       
   749     iEditorMenu = CPeninputCommonChoiceList::NewL( iLayoutOwner, 
       
   750                                         			ECtrlIdEditorMenu,
       
   751                                         			KAknsIIDQsnFrList,
       
   752                                         			KAknsIIDQsnFrPopupSub );
       
   753     
       
   754     AddControlL( iEditorMenu );
       
   755     }
       
   756 
       
   757 void CGenericItutWindow::ShowEditorMenuL(TInt* aData)
       
   758     {
       
   759     if ( NULL == iEditorMenu )
       
   760         {
       
   761         return;
       
   762         }
       
   763     TInt count = *aData;
       
   764     iEditorMenu->ClearItemsL();
       
   765     for (TInt i=1;i<=count;i++ )
       
   766         {
       
   767         TInt menucommand = *(aData+i);
       
   768         CGenericItutDataMgr::TMenuItem* menuitem = iDataMgr->GetMenuItem(menucommand);
       
   769         if ( menuitem )
       
   770             {
       
   771             CFepLayoutChoiceList::SItem item;
       
   772             item.iCommand = menucommand;
       
   773             item.iText = menuitem->iText;
       
   774             iEditorMenu->AddItemL(item);                        
       
   775             }
       
   776         }
       
   777            
       
   778     if ( count > 0 )
       
   779         {
       
   780         iEditorMenu->SetListColumnNumWithLafL(count); 
       
   781         iEditorMenu->Display(Control(ECtrlIdIndicator)->Rect());
       
   782         }                
       
   783     }
       
   784 
       
   785 void CGenericItutWindow::ConstructL()
       
   786     {
       
   787     iBmpRotator = CPeninputSyncBitmapRotator::NewL();
       
   788     CreateAllButtonL();
       
   789     CreateItutKeypadL();
       
   790     CreateICFL();
       
   791     CreateMatchSelectionCtrlL();
       
   792     
       
   793     /*
       
   794     AddEditorMenuL();
       
   795     
       
   796     iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL(
       
   797                                      iLayoutOwner,
       
   798                                      ECtrlIdInputSwitch,
       
   799                                      EPluginInputModeItut );
       
   800     iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
       
   801     AddControlL( iInputModeSwitch );
       
   802     */
       
   803     
       
   804    
       
   805     iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
       
   806     iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
       
   807     
       
   808     iICF->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
   809     iICF->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   810     //Change the ID when ID into release
       
   811     iICF->MsgBubbleCtrl()->SetBitmapParam(NULL,
       
   812     									  NULL,
       
   813     									  KAknsIIDQsnFrInputPreviewSideL,
       
   814     									  KAknsIIDQsnFrInputPreviewMiddle,
       
   815     									  KAknsIIDQsnFrInputPreviewSideR);  
       
   816     iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   817     iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
       
   818     /* Teleca change start, 18.05.2009 ssal */ 
       
   819     iICF->InfoBubbleCtrl()->SetTextFormat(iBubbleTextLayout); 
       
   820     iICF->InfoBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   821     iICF->InfoBubbleCtrl()->SetBitmapParam(NULL,
       
   822     									  NULL,
       
   823     									  KAknsIIDQsnFrInputPreviewSideL,
       
   824     									  KAknsIIDQsnFrInputPreviewMiddle,
       
   825     									  KAknsIIDQsnFrInputPreviewSideR);  
       
   826     iICF->SetInfoBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   827     }
       
   828 
       
   829 void CGenericItutWindow::AddControlL(CFepUiBaseCtrl* aControl)
       
   830     {
       
   831     iLayoutOwner->AddControlL(aControl);   
       
   832     }
       
   833 
       
   834 void CGenericItutWindow::CreateChineseSpecificCtrlsIfNeededL()
       
   835     {
       
   836     if (iChnCtrlInited)
       
   837         {
       
   838         return;
       
   839         }
       
   840 
       
   841     if( !Control( ECtrlIdSwitch ))
       
   842         {
       
   843         // create switch
       
   844         CreateButtonL(ECommonButton, ECtrlIdSwitch, ESwitchRect, 
       
   845                       ESwitchInnerRect, R_FINGER_LAYOUT_SWITCH);
       
   846         }
       
   847 
       
   848     if( !Control( ECtrlIdIndicator ) ) 
       
   849         {
       
   850         // create indicator button
       
   851         CFepUiBaseCtrl* indicatorBtn = CreateButtonL(ECommonButton, 
       
   852                 ECtrlIdIndicator, KUnavailableID, 
       
   853                 KUnavailableID,KUnavailableID);
       
   854 
       
   855         // create input case type menu
       
   856         AddEditorMenuL();
       
   857         }
       
   858     
       
   859     if( ! iInputModeSwitch )
       
   860     	{
       
   861 		// create switch input mode menu
       
   862 		iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL(
       
   863 										 iLayoutOwner,
       
   864 										 ECtrlIdInputSwitch,
       
   865 										 EPluginInputModeItut );
       
   866 		iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
       
   867 		AddControlL( iInputModeSwitch );
       
   868     	}
       
   869     // create spell indicator
       
   870     CAknFepCtrlLabel* spellIndicator = CAknFepCtrlLabel::NewL(iLayoutOwner, ECtrlIdSpellIndicator);
       
   871     AddControlL(spellIndicator);
       
   872     spellIndicator->Hide(ETrue);
       
   873     
       
   874     
       
   875     CreateDropdownListL();
       
   876     // create spell control for stroke/zhuyin
       
   877     TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESpellRect));
       
   878     iSpell = CFepInputContextField::NewL(rect, iLayoutOwner, ECtrlIdSpellICF);
       
   879 
       
   880     iSpell->SetResourceId(R_FINGER_SPELL);
       
   881     ConstructSpellCtrlFromResourceL();
       
   882 
       
   883     iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont)));
       
   884     AddControlL(iSpell); 
       
   885 
       
   886     iSpell->Hide(ETrue);
       
   887     
       
   888   
       
   889     iChnCtrlInited = ETrue;
       
   890     }
       
   891 
       
   892 void CGenericItutWindow::ConstructSpellCtrlFromResourceL()
       
   893     {
       
   894     if (!iSpell || !iSpell->ResourceId())
       
   895         {
       
   896         return;
       
   897         }
       
   898 
       
   899     TResourceReader spellreader;
       
   900     CCoeEnv::Static()->CreateResourceReaderLC(spellreader, iSpell->ResourceId());
       
   901 
       
   902     TInt bgimgResId = spellreader.ReadInt32();
       
   903     TResourceReader bgreader;
       
   904     CCoeEnv::Static()->CreateResourceReaderLC(bgreader, bgimgResId);
       
   905 
       
   906     TInt bmpid = bgreader.ReadInt16();
       
   907     TInt maskbmpid = bgreader.ReadInt16();
       
   908     TInt bmpskinid = bgreader.ReadInt16();
       
   909 
       
   910     CFbsBitmap* bmp = NULL;
       
   911     CFbsBitmap* maskbmp = NULL;
       
   912     
       
   913     CreateLayoutIconL(KImageMajorSkinId,
       
   914                       bmpskinid,
       
   915                       KBmpFileName,
       
   916                       bmpid,
       
   917                       maskbmpid,
       
   918                       bmp,
       
   919                       maskbmp,
       
   920                       iSpell->Rect().Size());
       
   921 
       
   922     CleanupStack::PushL( bmp );       
       
   923     CleanupStack::PushL( maskbmp );       
       
   924 
       
   925     if (bmp)
       
   926         {
       
   927         iSpell->SetBackgroundBitmapL(bmp);
       
   928         }
       
   929   
       
   930     CleanupStack::PopAndDestroy( maskbmp );       
       
   931     CleanupStack::Pop( bmp );
       
   932 
       
   933     CleanupStack::PopAndDestroy( 1 ); // bgreader
       
   934 
       
   935     TInt colorMajorSkinId = spellreader.ReadInt32();
       
   936     TInt skinitemid= spellreader.ReadInt16();
       
   937     TInt coloridx = spellreader.ReadInt16();
       
   938 
       
   939     TAknsItemID colorid;
       
   940     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   941 
       
   942     TRgb spelltextcolor;
       
   943     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   944     TInt error = AknsUtils::GetCachedColor(skininstance, 
       
   945                                            spelltextcolor, 
       
   946                                            colorid, 
       
   947                                            coloridx);
       
   948 
       
   949     if (error != KErrNone)
       
   950         {
       
   951         spelltextcolor = TRgb(KDefaultSpellTextColor);
       
   952         }
       
   953 
       
   954     iSpell->SetTextColor(spelltextcolor);
       
   955 
       
   956     CleanupStack::PopAndDestroy( 1 ); // spellreader
       
   957     }
       
   958 
       
   959 
       
   960 TRgb CGenericItutWindow::GetMatchListTextColor()
       
   961     {
       
   962     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   963     TRgb matchlistcolor;
       
   964     TInt error = AknsUtils::GetCachedColor(skininstance, 
       
   965                                            matchlistcolor, 
       
   966                                            KAknsIIDQsnTextColors,
       
   967                                            EAknsCIQsnTextColorsCG43);
       
   968 
       
   969     if (error != KErrNone)
       
   970         {
       
   971         matchlistcolor = TRgb(KDefaultIcfTextColor);
       
   972         }
       
   973     
       
   974     return matchlistcolor;
       
   975     }
       
   976 
       
   977 void CGenericItutWindow::CreateMatchSelectionCtrlL()
       
   978     {
       
   979     // size and pos info of new match selection list should get from laf: later
       
   980     iMatchSelection = CFepLayoutScrollableList::NewL(iLayoutOwner, 
       
   981                                                      ECtrlIdMatchSelection,
       
   982                                                      iDataMgr->iSelectionItemSize,
       
   983                                                      iDataMgr->iSelectionHorMargin,
       
   984                                                      iDataMgr->iSelectionVerMargin,
       
   985                                                      iDataMgr->iSelectionNaviSize,
       
   986                                                      iDataMgr->iSelectionNaviInnerSize);
       
   987      
       
   988     iMatchSelection->SetImgFrId(KAknsIIDQsnFrPopupSub, 
       
   989                                 KAknsIIDQsnFrFunctionButtonNormal,
       
   990 								KAknsIIDQsnFrFunctionButtonPressed,
       
   991 								KAknsIIDQsnFrFunctionButtonInactive,
       
   992                                 KAknsIIDQsnFrList,
       
   993                                 KAknsIIDQsnFrPopupSub);
       
   994     CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
   995     TRgb textcolor = GetMatchListTextColor();
       
   996 
       
   997     iMatchSelection->SetTextProperty(itemfont, textcolor);
       
   998     iMatchSelection->SetResourceId(R_FINGER_SELECTION_LIST);
       
   999     iMatchSelection->ConstructFromResourceL();
       
  1000     iMatchSelection->SetTextLineLayout( iDataMgr->iSelectionTextLine );
       
  1001     iMatchSelection->SetPageInfoTextLineLayout( iDataMgr->iSelectionPageTextLine );
       
  1002     iMatchSelection->SetPageInfoResID( R_PENINPUT_SELECTION_LIST_PAGE_NUM );
       
  1003     AddControlL(iMatchSelection);
       
  1004     }
       
  1005 
       
  1006 TInt CGenericItutWindow::OnAppEditorTextComing(const TFepInputContextFieldData& aData)
       
  1007     {
       
  1008     TRAPD(err, iICF->SetTextL(aData));
       
  1009 
       
  1010     // make sure if selection list on top of multiline icf,
       
  1011     // it will not be hidden by icf
       
  1012     if (!iMatchSelection->Hiden())
       
  1013         {
       
  1014         iMatchSelection->Draw();
       
  1015         }
       
  1016 
       
  1017     return err;
       
  1018     }
       
  1019 
       
  1020 void CGenericItutWindow::SetIndiBubbleImageL( const TInt aImgID1,
       
  1021                                               const TInt aMaskID1,
       
  1022                                               const TInt aImgID2,
       
  1023                                               const TInt aMaskID2 )
       
  1024     {
       
  1025     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
  1026 
       
  1027     CFbsBitmap* bmp1 = NULL;
       
  1028     CFbsBitmap* mask1 = NULL;
       
  1029     
       
  1030     TInt colorIndex = EAknsCIQsnIconColorsCG30;
       
  1031 
       
  1032     AknsUtils::CreateColorIconL(skininstance,
       
  1033                                 KAknsIIDQsnIconColors,
       
  1034                                 KAknsIIDQsnIconColors,
       
  1035                                 colorIndex,
       
  1036                                 bmp1,
       
  1037                                 mask1,
       
  1038                                 AknIconUtils::AvkonIconFileName(),
       
  1039                                 aImgID1,
       
  1040                                 aMaskID1,
       
  1041                                 KRgbGray);
       
  1042     CleanupStack::PushL( bmp1 );
       
  1043     CleanupStack::PushL( mask1 );
       
  1044                                 
       
  1045     AknIconUtils::GetContentDimensions(bmp1, iIndicatorSize);
       
  1046 
       
  1047     CFbsBitmap* bmp2 = NULL;
       
  1048     CFbsBitmap* mask2 = NULL;
       
  1049     AknsUtils::CreateColorIconL(skininstance,
       
  1050                                 KAknsIIDQsnIconColors,
       
  1051                                 KAknsIIDQsnIconColors,
       
  1052                                 colorIndex,
       
  1053                                 bmp2,
       
  1054                                 mask2,
       
  1055                                 AknIconUtils::AvkonIconFileName(),
       
  1056                                 aImgID2,
       
  1057                                 aMaskID2,
       
  1058                                 KRgbGray);
       
  1059  
       
  1060     CleanupStack::PushL( bmp2 );
       
  1061     CleanupStack::PushL( mask2 );
       
  1062     
       
  1063     AknIconUtils::GetContentDimensions(bmp2, iIndicatorTextSize);
       
  1064     
       
  1065     TRect boundRect;
       
  1066     if ( iIndiWithText )
       
  1067         {
       
  1068         boundRect = TItutDataConverter::AnyToRect(
       
  1069                 iDataMgr->RequestData(EIndiIconWithTextRect));
       
  1070         }
       
  1071     else
       
  1072         {
       
  1073         boundRect = TItutDataConverter::AnyToRect(
       
  1074                 iDataMgr->RequestData(EIndiIconWithoutTextRect));
       
  1075         }
       
  1076     TRect imgrect, textrect;
       
  1077     
       
  1078     CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter);
       
  1079     AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1080     AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1081     AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved);
       
  1082     AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved);
       
  1083 
       
  1084     CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, bmp1->DisplayMode());
       
  1085     CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
       
  1086     
       
  1087     iICF->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, 
       
  1088                     KAknsIIDQsnFrInputPreviewSideL,
       
  1089                     KAknsIIDQsnFrInputPreviewMiddle,
       
  1090                     KAknsIIDQsnFrInputPreviewSideR );
       
  1091     
       
  1092     CleanupStack::PopAndDestroy( mask2 );
       
  1093     CleanupStack::PopAndDestroy( bmp2 );
       
  1094     CleanupStack::PopAndDestroy( mask1 );
       
  1095     CleanupStack::PopAndDestroy( bmp1 );
       
  1096     }
       
  1097 void CGenericItutWindow::SetIndicatorImageL(CFepUiBaseCtrl* aIndicator,
       
  1098                                               const TInt aImgID1,
       
  1099                                               const TInt aMaskID1,
       
  1100                                               const TInt aImgID2,
       
  1101                                               const TInt aMaskID2)
       
  1102     {
       
  1103     if ( NULL == aIndicator )
       
  1104         {
       
  1105         return;
       
  1106         }
       
  1107     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
  1108 
       
  1109     CFbsBitmap* bmp1 = NULL;
       
  1110     CFbsBitmap* mask1 = NULL;
       
  1111     
       
  1112     TInt colorIndex;
       
  1113     if (iLayoutOwner->UiMgr()->CurrentState()->StateType() ==
       
  1114             CGenericItutUiMgrBase::EStateSpelling)
       
  1115 		{
       
  1116 		colorIndex = EAknsCIQsnIconColorsCG10;
       
  1117 		}
       
  1118     else
       
  1119 		{
       
  1120 		colorIndex = EAknsCIQsnIconColorsCG30;
       
  1121 		}
       
  1122     AknsUtils::CreateColorIconL(skininstance,
       
  1123                                 KAknsIIDQsnIconColors,
       
  1124                                 KAknsIIDQsnIconColors,
       
  1125                                 colorIndex,
       
  1126                                 bmp1,
       
  1127                                 mask1,
       
  1128                                 AknIconUtils::AvkonIconFileName(),
       
  1129                                 aImgID1,
       
  1130                                 aMaskID1,
       
  1131                                 KRgbGray);
       
  1132     CleanupStack::PushL( bmp1 );
       
  1133     CleanupStack::PushL( mask1 );
       
  1134                                 
       
  1135     AknIconUtils::GetContentDimensions(bmp1, iIndicatorSize);
       
  1136 
       
  1137     CFbsBitmap* bmp2 = NULL;
       
  1138     CFbsBitmap* mask2 = NULL;
       
  1139     AknsUtils::CreateColorIconL(skininstance,
       
  1140                                 KAknsIIDQsnIconColors,
       
  1141                                 KAknsIIDQsnIconColors,
       
  1142                                 colorIndex,
       
  1143                                 bmp2,
       
  1144                                 mask2,
       
  1145                                 AknIconUtils::AvkonIconFileName(),
       
  1146                                 aImgID2,
       
  1147                                 aMaskID2,
       
  1148                                 KRgbGray);
       
  1149  
       
  1150     CleanupStack::PushL( bmp2 );
       
  1151     CleanupStack::PushL( mask2 );
       
  1152     
       
  1153     AknIconUtils::GetContentDimensions(bmp2, iIndicatorTextSize);
       
  1154 
       
  1155     TRect boundRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EImIndicatorRect));
       
  1156     TRect imgrect, textrect;
       
  1157 
       
  1158     if (aIndicator->ControlId() == ECtrlIdIndicator)
       
  1159         {
       
  1160         CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter);
       
  1161         AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1162         AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1163         AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved);
       
  1164         AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved);
       
  1165 
       
  1166         CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256);
       
  1167         CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
       
  1168         
       
  1169         TInt bigger = imgrect.Height() > textrect.Height() ? imgrect.Height() : textrect.Height();
       
  1170         TRect indirect(imgrect.iTl, TSize(imgrect.Width() + textrect.Width(), bigger));
       
  1171         // button like indicator
       
  1172         CAknFepCtrlCommonButton* indibtn = static_cast<CAknFepCtrlCommonButton*>(aIndicator);
       
  1173         TRect outerrect = 
       
  1174                        TItutDataConverter::AnyToRect(iDataMgr->RequestData(EImIndicatorOuterRect));
       
  1175         /*if (IsChineseMode())
       
  1176             {
       
  1177             indirect.Move( TPoint(0 , 0));
       
  1178             }
       
  1179         else
       
  1180             {
       
  1181             indirect.Move(TPoint( -20 ,0));//
       
  1182             }
       
  1183         */
       
  1184         indibtn->SetForgroundBmpRect(indirect);
       
  1185         indibtn->SetForegroundBmpL(bmp3, mask3);
       
  1186         indibtn->SetRect(outerrect);
       
  1187         //indibtn->Hide(EFalse);
       
  1188         }
       
  1189     else
       
  1190         {
       
  1191         CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignRight);
       
  1192         AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1193         AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved);
       
  1194         AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved);
       
  1195         AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved);
       
  1196 
       
  1197         CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256);
       
  1198         CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
       
  1199         
       
  1200         TInt bigger = imgrect.Height() > textrect.Height() ? imgrect.Height() : textrect.Height();
       
  1201         TRect indirect(imgrect.iTl, TSize(imgrect.Width() + textrect.Width(), bigger));
       
  1202  		
       
  1203         // label like indicator
       
  1204         CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>(aIndicator);
       
  1205         indilabel->SetBitmapL(bmp3);
       
  1206         indilabel->SetMaskBitmapL(mask3);
       
  1207         indilabel->SetRect(indirect);
       
  1208         //indilabel->Hide(EFalse);
       
  1209         }
       
  1210 
       
  1211     CleanupStack::PopAndDestroy( mask2 );
       
  1212     CleanupStack::PopAndDestroy( bmp2 );
       
  1213     CleanupStack::PopAndDestroy( mask1 );
       
  1214     CleanupStack::PopAndDestroy( bmp1 );    
       
  1215     }
       
  1216 
       
  1217 void CGenericItutWindow::UpdateIndiBubbleL( TUint8* aData )
       
  1218     {
       
  1219     RDesReadStream readStream;
       
  1220     TFepIndicatorInfo indicatorData;
       
  1221 
       
  1222     TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) );            
       
  1223     readStream.Open(countPtr);
       
  1224     CleanupClosePushL(readStream);
       
  1225 
       
  1226     indicatorData.iIndicatorImgID = readStream.ReadInt32L();
       
  1227     indicatorData.iIndicatorMaskID = readStream.ReadInt32L();
       
  1228     indicatorData.iIndicatorTextImgID = readStream.ReadInt32L();
       
  1229     indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L();
       
  1230 
       
  1231     CleanupStack::PopAndDestroy(&readStream);
       
  1232 
       
  1233     if (indicatorData.iIndicatorImgID != 0 && 
       
  1234         indicatorData.iIndicatorMaskID != 0 && 
       
  1235         indicatorData.iIndicatorTextImgID != 0 &&
       
  1236         indicatorData.iIndicatorTextMaskID != 0)
       
  1237         {
       
  1238         iDataMgr->SetIndicatorData(indicatorData);
       
  1239         iImDimensionSet = ETrue;
       
  1240         
       
  1241         SetIndiBubbleImageL( indicatorData.iIndicatorImgID,
       
  1242                              indicatorData.iIndicatorMaskID,
       
  1243                              indicatorData.iIndicatorTextImgID,
       
  1244                              indicatorData.iIndicatorTextMaskID);
       
  1245         
       
  1246         if ( iLayoutOwner->UiMgr()->CurrentState()->StateType() ==
       
  1247             CGenericItutUiMgrBase::EStateSpelling )
       
  1248             {
       
  1249 			TRect bubbleRect = TItutDataConverter::AnyToRect( 
       
  1250 					iDataMgr->RequestData( ESpellIndiPaneWithoutTextRect ));
       
  1251 			TRect iconRect = TItutDataConverter::AnyToRect( 
       
  1252 					iDataMgr->RequestData( ESpellIndiIconWithoutTextRect ));
       
  1253 			TSize offset;
       
  1254 	        offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  1255 	        offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
       
  1256 			TSize size( iconRect.Width(), iconRect.Height());
       
  1257 			
       
  1258 			iICF->MsgBubbleCtrl()->SetRect( bubbleRect );
       
  1259 			iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
       
  1260             iICF->ShowBubble( KEmptyString, iICF->MsgBubbleCtrl()->Rect());
       
  1261             }
       
  1262         else
       
  1263             {
       
  1264             TBuf<100> text;
       
  1265             iICF->MsgBubbleCtrl()->GetText( text );
       
  1266             iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect());
       
  1267             }
       
  1268         }
       
  1269     }
       
  1270 
       
  1271 void CGenericItutWindow::UpdateIndicatorL(TUint8* aData)
       
  1272     {
       
  1273     if ( iLayoutOwner->UiMgr()->CurrentState()->StateType() == 
       
  1274             CGenericItutUiMgrBase::EStateComposition ||
       
  1275          iLayoutOwner->UiMgr()->CurrentState()->StateType() == 
       
  1276             CGenericItutUiMgrBase::EStatePredict )
       
  1277         {
       
  1278         return;
       
  1279         }
       
  1280         
       
  1281 	RDesReadStream readStream;
       
  1282 
       
  1283     TFepIndicatorInfo indicatorData;
       
  1284 
       
  1285     TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) );            
       
  1286 	readStream.Open(countPtr);
       
  1287 	CleanupClosePushL(readStream);
       
  1288 
       
  1289     indicatorData.iIndicatorImgID = readStream.ReadInt32L();
       
  1290     indicatorData.iIndicatorMaskID = readStream.ReadInt32L();
       
  1291     indicatorData.iIndicatorTextImgID = readStream.ReadInt32L();
       
  1292     indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L();
       
  1293 
       
  1294     CleanupStack::PopAndDestroy(&readStream);
       
  1295 
       
  1296     if (indicatorData.iIndicatorImgID != 0 && 
       
  1297         indicatorData.iIndicatorMaskID != 0 && 
       
  1298         indicatorData.iIndicatorTextImgID != 0 &&
       
  1299         indicatorData.iIndicatorTextMaskID != 0)
       
  1300         {
       
  1301         iDataMgr->SetIndicatorData(indicatorData);
       
  1302         iImDimensionSet = ETrue;
       
  1303         
       
  1304         
       
  1305         CFepUiBaseCtrl* temp = NULL;
       
  1306         
       
  1307         
       
  1308         if (iLayoutOwner->UiMgr()->CurrentState()->StateType() ==
       
  1309             CGenericItutUiMgrBase::EStateSpelling)
       
  1310             {
       
  1311             temp = Control(ECtrlIdSpellIndicator);
       
  1312             if ( !temp )
       
  1313                 {
       
  1314                 return;
       
  1315                 }
       
  1316             
       
  1317             CFepUiBaseCtrl* indi = Control(ECtrlIdIndicator);
       
  1318             if ( !indi )
       
  1319                 {
       
  1320                 return;
       
  1321                 }
       
  1322             indi->Hide(ETrue);  
       
  1323 	        SetIndicatorImageL(temp, 
       
  1324 	                           indicatorData.iIndicatorImgID,
       
  1325 	                           indicatorData.iIndicatorMaskID,
       
  1326 	                           indicatorData.iIndicatorTextImgID,
       
  1327 	                           indicatorData.iIndicatorTextMaskID);
       
  1328 	        if( temp->Hiden() )               
       
  1329 	            {
       
  1330 	            temp->Hide( EFalse );    
       
  1331 	            }
       
  1332 	        else
       
  1333 	            {
       
  1334 	           	iLayoutOwner->RootControl()->ReDrawRect(temp->Rect()); 
       
  1335 	            iLayoutOwner->RootControl()->UpdateArea( temp->Rect() );
       
  1336 	            }
       
  1337             }
       
  1338         else
       
  1339             {
       
  1340             temp = Control(ECtrlIdIndicator); 
       
  1341             
       
  1342             CFepUiBaseCtrl* indi = Control(ECtrlIdSpellIndicator);
       
  1343             if( indi )
       
  1344             	{
       
  1345 				indi->Hide(ETrue);
       
  1346             	}
       
  1347             
       
  1348             if( temp )
       
  1349             	{
       
  1350 				SetIndicatorImageL(temp, 
       
  1351 								   indicatorData.iIndicatorImgID,
       
  1352 								   indicatorData.iIndicatorMaskID,
       
  1353 								   indicatorData.iIndicatorTextImgID,
       
  1354 								   indicatorData.iIndicatorTextMaskID);
       
  1355 				if( temp->Hiden() )               
       
  1356 					{
       
  1357 					temp->Hide( EFalse );    
       
  1358 					}
       
  1359 				else
       
  1360 					{
       
  1361 						temp->ClearRect( temp->Rect() );
       
  1362 					temp->Draw();
       
  1363 					temp->UpdateArea( temp->Rect() );
       
  1364 					iLayoutOwner->RootControl()->ReDrawRect( temp->Rect() );
       
  1365 					} 
       
  1366             	}
       
  1367             }
       
  1368         }
       
  1369     }
       
  1370 
       
  1371 void CGenericItutWindow::CalIndicatorRect(const TRect& aBoundRect,
       
  1372                                           TRect& aRealRect1,
       
  1373                                           TRect& aRealRect2,
       
  1374                                           TIndicatorAlign aAlign) 
       
  1375 	{
       
  1376 	if (!iImDimensionSet)
       
  1377 		{
       
  1378 		return;
       
  1379 		}
       
  1380 	
       
  1381 	TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight;
       
  1382 	TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight;
       
  1383     TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, 
       
  1384     			  	   aBoundRect.Size().iHeight );
       
  1385 	TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, 
       
  1386     			   			   aBoundRect.Size().iHeight );
       
  1387 	// check if the length of img > bound rect width
       
  1388 	TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth;
       
  1389 	if( nTotalWidth > aBoundRect.Size().iWidth )
       
  1390 		{
       
  1391 		TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth;
       
  1392 		imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect;
       
  1393 		imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth;
       
  1394 		imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText;
       
  1395 		// make sure the height of two rect is equal
       
  1396 		imgSizeIndi.iHeight = imgSizeText.iHeight;
       
  1397 		
       
  1398 		/*	TInt n = (nTotalWidth - aBoundRect.Size().iWidth) / 2;
       
  1399 		imgSizeText.iWidth -= n;
       
  1400 		imgSizeIndi.iWidth -= n;
       
  1401 		imgSizeText.iHeight -= n / imgAspectText;
       
  1402 		imgSizeIndi.iHeight -= n / imgAspectIndi;
       
  1403 		*/
       
  1404 		}
       
  1405 	if( aAlign == EIndiAlignRight )
       
  1406 		{
       
  1407     	aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY),
       
  1408     			   	   imgSizeText);
       
  1409 		aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
       
  1410 				       imgSizeIndi);
       
  1411 		}
       
  1412 	else if( aAlign == EIndiAlignCenter )
       
  1413 		{
       
  1414 		TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2;
       
  1415 		TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2;
       
  1416     	aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, 
       
  1417     							   aBoundRect.iTl.iY + offsetY),
       
  1418     			   	   	    imgSizeText );
       
  1419 		aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
       
  1420 				       imgSizeIndi );
       
  1421 		}
       
  1422 	else if( aAlign == EIndiAlignLeft )
       
  1423 		{
       
  1424 		aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi );
       
  1425 		aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText );
       
  1426 		}
       
  1427 	}
       
  1428 
       
  1429 void CGenericItutWindow::SetPromptTextL(TUint8* aData)
       
  1430     {
       
  1431     RDesReadStream readStream;
       
  1432 
       
  1433     TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt));
       
  1434 	  readStream.Open(countPtr);
       
  1435 	  CleanupClosePushL(readStream);
       
  1436     const TInt dataCount = readStream.ReadInt32L();
       
  1437 	  const TInt textCount = readStream.ReadInt32L();
       
  1438     CleanupStack::PopAndDestroy(&readStream);
       
  1439     
       
  1440     TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount );            
       
  1441 	  readStream.Open(ptr);
       
  1442 	  CleanupClosePushL(readStream);
       
  1443 	
       
  1444 	  HBufC8* dataBuf = HBufC8::NewLC(dataCount);
       
  1445 	  TPtr8 dataBufPtr = dataBuf->Des();
       
  1446 	  readStream.ReadL(dataBufPtr, dataCount);
       
  1447 
       
  1448     TFepPromptText* pIcfData = 
       
  1449         reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1450 
       
  1451     HBufC* textBuf;
       
  1452     if (textCount > 0)
       
  1453         {
       
  1454         textBuf = HBufC::NewLC(textCount/2);
       
  1455     	TPtr textBufPtr = textBuf->Des();
       
  1456     	readStream.ReadL(textBufPtr, textCount/2);
       
  1457          
       
  1458         const HBufC* icfPromptText = iICF->PromptText();
       
  1459         
       
  1460         if (!icfPromptText || icfPromptText->Compare(textBuf->Des()) != 0 )
       
  1461         	{
       
  1462         	iICF->SetPromptTextL( textBuf->Des(), pIcfData->iCleanContent );	
       
  1463         	}
       
  1464         
       
  1465         CleanupStack::PopAndDestroy(textBuf);
       
  1466         }
       
  1467     else
       
  1468         {
       
  1469         iICF->SetPromptTextL(KNullDesC, pIcfData->iCleanContent);
       
  1470         }
       
  1471 
       
  1472     CleanupStack::PopAndDestroy(dataBuf);
       
  1473 	  CleanupStack::PopAndDestroy(&readStream);
       
  1474     }
       
  1475 
       
  1476 void CGenericItutWindow::SetSpellDisplayContentL( TUint8* aData )
       
  1477 	{
       
  1478 	TBool isInSpell = iDataMgr->IsSpellMode();
       
  1479 	if ( isInSpell )
       
  1480 		{
       
  1481 	    return;
       
  1482 		}
       
  1483 	
       
  1484 	RDesReadStream readStream;
       
  1485 
       
  1486 	TPtr8 countPtr( aData, 3 * sizeof(TInt), 3 * sizeof(TInt));
       
  1487 	readStream.Open( countPtr );
       
  1488 	CleanupClosePushL( readStream );
       
  1489 	
       
  1490 	const TInt dataCount = readStream.ReadInt32L();
       
  1491 	const TInt icfTextCount = readStream.ReadInt32L();
       
  1492 	const TInt promptTextCount = readStream.ReadInt32L();
       
  1493 	CleanupStack::PopAndDestroy( &readStream );
       
  1494 	
       
  1495 	TPtr8 ptr( aData + 3 * sizeof(TInt), 
       
  1496 		dataCount + icfTextCount + promptTextCount, 
       
  1497 		dataCount + icfTextCount + promptTextCount );
       
  1498 	
       
  1499     readStream.Open( ptr );
       
  1500     CleanupClosePushL(readStream);
       
  1501     
       
  1502     HBufC8* dataBuf = HBufC8::NewLC( dataCount );
       
  1503     TPtr8 dataBufPtr = dataBuf->Des();
       
  1504     readStream.ReadL( dataBufPtr, dataCount );
       
  1505     
       
  1506     TFepSpellICFDisplayContent* pContent = 
       
  1507     		reinterpret_cast<TFepSpellICFDisplayContent*>(
       
  1508     				const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1509     
       
  1510     TFepInputContextFieldData icfData;
       
  1511 	icfData.iCmd = EPeninputICFInitial;
       
  1512 	icfData.iCurSel.iCursorPos = pContent->iCurPos;
       
  1513 	icfData.iCursorSelVisible = ETrue;
       
  1514 	icfData.iCursorVisibility = ETrue;
       
  1515     		
       
  1516     if ( icfTextCount > 0 )
       
  1517     	{
       
  1518 		HBufC* textIcfBuf;
       
  1519 		textIcfBuf = HBufC::NewLC( icfTextCount/2 );
       
  1520 		TPtr textBufPtr = textIcfBuf->Des();
       
  1521 		readStream.ReadL( textBufPtr, icfTextCount/2 );
       
  1522 		
       
  1523 		icfData.iLength = icfTextCount;
       
  1524 		icfData.iText.Set( textIcfBuf->Des());
       
  1525 		
       
  1526 		iICF->SetTextL( icfData );
       
  1527 		
       
  1528 		CleanupStack::PopAndDestroy( textIcfBuf );
       
  1529     	}
       
  1530     else
       
  1531     	{
       
  1532 		icfData.iLength = 0;
       
  1533 		icfData.iText.Set( KNullDesC );
       
  1534 		
       
  1535 		iICF->SetTextL( icfData );
       
  1536     	}
       
  1537     
       
  1538     if ( promptTextCount > 0 )
       
  1539     	{
       
  1540 		HBufC* textPromptBuf;
       
  1541 		textPromptBuf = HBufC::NewLC( promptTextCount/2 );
       
  1542 		TPtr promptBufPtr = textPromptBuf->Des();
       
  1543 		readStream.ReadL( promptBufPtr, promptTextCount/2 );
       
  1544 		
       
  1545 		iICF->SetPromptTextL( textPromptBuf->Des(), ETrue );	
       
  1546 		
       
  1547 		CleanupStack::PopAndDestroy( textPromptBuf );
       
  1548     	}
       
  1549     else
       
  1550     	{
       
  1551 		iICF->SetPromptTextL( KNullDesC, ETrue );
       
  1552     	}
       
  1553     
       
  1554     CleanupStack::PopAndDestroy( dataBuf );
       
  1555 	CleanupStack::PopAndDestroy( &readStream );
       
  1556 	}
       
  1557 
       
  1558 TInt CGenericItutWindow::PenInputType()
       
  1559     {
       
  1560     return EPluginInputModeItut;
       
  1561     }
       
  1562 
       
  1563 void CGenericItutWindow::SetCtrlRect(CFepUiBaseCtrl* aCtrl, TInt aRectIdx)
       
  1564     {
       
  1565     aCtrl->SetRect(TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectIdx)));
       
  1566     }
       
  1567 
       
  1568 TInt CGenericItutWindow::SizeChanged(TBool aIcfOverlap)
       
  1569     {
       
  1570     // resize all controls
       
  1571     SetCtrlRect(iStandardItutKp, EKeypadRect);
       
  1572 
       
  1573     iStandardItutKp->SetTextLineLayout(
       
  1574         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
  1575         EPosLeft);
       
  1576     iStandardItutKp->SetTextLineLayout(
       
  1577         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
  1578         EPosRight1);
       
  1579     iStandardItutKp->SetTextLineLayout(
       
  1580         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
  1581         EPosRight2);
       
  1582     iStandardItutKp->SetTextLineLayout(
       
  1583         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
  1584         EPosRight3);
       
  1585     
       
  1586     RPointerArray<CVirtualKey>& keys = 
       
  1587         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
  1588     RArray<TRect>& cellRects = 
       
  1589         TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
  1590 
       
  1591     for (TInt i = 0 ; i < keys.Count(); i++)
       
  1592         {
       
  1593         keys[i]->SetRect(cellRects[i]);
       
  1594         TRect innerrect = cellRects[i];
       
  1595         innerrect.Shrink(TSize(4, 4));
       
  1596         keys[i]->SetInnerRect(innerrect);
       
  1597         }
       
  1598 	// set key background image size
       
  1599 	TSize curSize = cellRects[0].Size();
       
  1600 	if( iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal) )
       
  1601 		{
       
  1602 		TSize size = iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
  1603 		if( curSize != size )	
       
  1604 			{
       
  1605 	        for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
  1606 	            {
       
  1607 	            if( iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
  1608 	            	{
       
  1609 	                AknIconUtils::SetSize( 
       
  1610                                    iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
  1611                                    curSize, EAspectRatioNotPreserved );                    		
       
  1612 	            	}
       
  1613 	            }	
       
  1614 			}
       
  1615 		}
       
  1616    iMatchSelection->SetPageInfoTextLineLayout( iDataMgr->iSelectionPageTextLine );
       
  1617    iMatchSelection->SizeChanged( 
       
  1618         iDataMgr->iSelectionItemSize,
       
  1619         iDataMgr->iSelectionHorMargin,
       
  1620         iDataMgr->iSelectionVerMargin,
       
  1621         iDataMgr->iSelectionNaviSize,
       
  1622         iDataMgr->iSelectionNaviInnerSize);
       
  1623 
       
  1624     // should set textline when it is defined in laf
       
  1625     CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
  1626     TRgb textcolor = GetMatchListTextColor();
       
  1627     iMatchSelection->SetTextProperty(
       
  1628         TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)), GetMatchListTextColor());
       
  1629 
       
  1630 	iBackgroundCtrl->SizeChanged( 
       
  1631                          TItutDataConverter::AnyToRect(iDataMgr->RequestData( ELayoutRect ) ) );
       
  1632 	
       
  1633     TRAP_IGNORE(ApplyVariantLafDataL(ETrue); 
       
  1634                 iLayoutOwner->HandleCommand(EItutExtCmdSizeChanged, NULL));
       
  1635     
       
  1636     
       
  1637     if (iChnCtrlInited)
       
  1638         {
       
  1639         SetCtrlRect(iSpell, ESpellRect);
       
  1640         iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont)));
       
  1641 
       
  1642         ResizeCandidateList(iSpellCandsList, EDropdownListSpellLTPos, ETrue);
       
  1643         ResizeCandidateList(iCandsList, EDropdownListCandsLTPos, ETrue);
       
  1644         ResizeCandidateList(iPuncCandsList, EDropdownListPuncLTPos, EFalse);
       
  1645         }
       
  1646         
       
  1647     if (aIcfOverlap && !iMatchSelection->Hiden())
       
  1648         {
       
  1649         iICF->SetOverLapState(ETrue, iMatchSelection->Rect());
       
  1650         }
       
  1651 
       
  1652     return KErrNone;    
       
  1653     }
       
  1654 
       
  1655 TBool CGenericItutWindow::ControlSizeChanged(const TInt aControlId, 
       
  1656                                             const TInt aRect, 
       
  1657                                             const TInt aInnerRect, 
       
  1658                                             TBool aIsReloadImages)
       
  1659     {
       
  1660     CAknFepCtrlCommonButton* temp = CommonButtonControl(aControlId);
       
  1661     if( !temp )
       
  1662     	return EFalse;
       
  1663     
       
  1664 
       
  1665     TRect rect;
       
  1666     TRect innerRect;
       
  1667     
       
  1668     rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRect));
       
  1669 	innerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRect));
       
  1670     
       
  1671     TBool bSizedChanged = (rect.Size() != temp->Rect().Size()) && 
       
  1672     	    (innerRect.Size() != temp->ForgroundBmpRect().Size());
       
  1673     temp->SizeChanged(rect, innerRect, aIsReloadImages);   
       
  1674       
       
  1675     return bSizedChanged;
       
  1676     }
       
  1677 
       
  1678 void CGenericItutWindow::ApplyVariantLafDataL(TBool aResolutionChange)
       
  1679     {
       
  1680     if (aResolutionChange)
       
  1681         {
       
  1682         CAknFepCtrlCommonButton* indibutton = CommonButtonControl(ECtrlIdIndicator);
       
  1683 
       
  1684         SetIndicatorImageL(indibutton, 
       
  1685                            iDataMgr->IndicatorData().iIndicatorImgID,
       
  1686                            iDataMgr->IndicatorData().iIndicatorMaskID,
       
  1687                            iDataMgr->IndicatorData().iIndicatorTextImgID,
       
  1688                            iDataMgr->IndicatorData().iIndicatorTextMaskID);              
       
  1689         }
       
  1690 
       
  1691     CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
  1692     iICF->Hide(ETrue);
       
  1693     
       
  1694     if( iDataMgr->IsChinese() )
       
  1695     	{
       
  1696     	iICF->SetTextMargin ( iDataMgr->iIcfTextLeftMarginCn,
       
  1697     					  iDataMgr->iIcfTextRightMarginCn,
       
  1698     					  iDataMgr->iIcfTextTopMarginCn,
       
  1699     					  iDataMgr->iIcfTextBottomMarginCn );
       
  1700     					  
       
  1701 	    iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMarginCn );    					  
       
  1702 	 
       
  1703 	    iICF->SizeChangedL(TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)), 
       
  1704 	                      //icffont->HeightInPixels(),
       
  1705 	                      iDataMgr->iIcfTextHeightCn,
       
  1706 	                      icffont->FontMaxHeight(),
       
  1707 	                      icffont);	    		
       
  1708     	}
       
  1709     else
       
  1710     	{
       
  1711     	if ( iDataMgr->IsLandScape())
       
  1712     	    {
       
  1713     	    iICF->SetTextMargin ( iDataMgr->iIcfTextLeftMargin,
       
  1714     	                          iDataMgr->iIcfTextRightMargin,
       
  1715     	                          iDataMgr->iIcfTextTopMargin,
       
  1716     	                          iDataMgr->iIcfTextBottomMargin );
       
  1717     	                                  
       
  1718             iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin );                          
       
  1719          
       
  1720             iICF->SizeChangedL(TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)), 
       
  1721                               iDataMgr->iIcfTextHeight,
       
  1722                               icffont->FontMaxHeight(),
       
  1723                               icffont);
       
  1724     	    }
       
  1725     	else
       
  1726     	    {
       
  1727     	    iICF->SetTextMargin ( iDataMgr->iIcfTextLeftMarginForPrtWest,
       
  1728     	                          iDataMgr->iIcfTextRightMarginForPrtWest,
       
  1729     	                          iDataMgr->iIcfTextTopMarginForPrtWest,
       
  1730     	                          iDataMgr->iIcfTextBottomMarginForPrtWest );
       
  1731     	                                  
       
  1732             iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMarginForPrtWest );                          
       
  1733          
       
  1734             iICF->SizeChangedL(TItutDataConverter::AnyToRect(iDataMgr->RequestData(EIcfRect)),
       
  1735                               iDataMgr->iIcfTextHeightForPrtWest,
       
  1736                               icffont->FontMaxHeight(),
       
  1737                               icffont);
       
  1738     	    }
       
  1739     	}
       
  1740 
       
  1741     iICF->Hide(EFalse);    
       
  1742     
       
  1743     if ( iDataMgr->IsPortraitWest() && (!iDataMgr->IsChineseSpellMode()))
       
  1744         {
       
  1745         iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
       
  1746         iIndiWithText = EFalse;
       
  1747         IndiBubbleWithoutText();
       
  1748         }
       
  1749     if( iDataMgr->IsChinese() )
       
  1750         {
       
  1751         ControlSizeChanged(ECtrlIdArrowUp, EArrowUpRect, EUpInnerRect, ETrue);
       
  1752         ControlSizeChanged(ECtrlIdArrowDown, EArrowDownRect, EDownInnerRect, ETrue);
       
  1753         }
       
  1754     
       
  1755     TBool bSizeChanged = EFalse;       
       
  1756     ControlSizeChanged(ECtrlIdArrowLeft, EArrowLeftRect, ELeftInnerRect, ETrue);
       
  1757     ControlSizeChanged(ECtrlIdArrowRight, EArrowRightRect, ERightInnerRect, ETrue);
       
  1758     if( iDataMgr->IsChinese() || iDataMgr->IsKorean() )
       
  1759         {
       
  1760         ControlSizeChanged(ECtrlIdSwitch, ESwitchRect, ESwitchInnerRect, ETrue);
       
  1761         }
       
  1762     bSizeChanged = ControlSizeChanged(ECtrlIdBackspace, EBackspaceRect, EBackspaceInnerRect, ETrue);
       
  1763     ControlSizeChanged(ECtrlIdOptions, EOptionsRect, EOptionInnerRect, ETrue);
       
  1764     ControlSizeChanged(ECtrlIdClose, ECloseRect, ECloseInnerRect, ETrue);
       
  1765    						  	
       
  1766     // resize all controls
       
  1767     SetCtrlRect(iStandardItutKp, EKeypadRect); 
       
  1768     
       
  1769     iStandardItutKp->SetTextLineLayout(
       
  1770         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
  1771         EPosLeft);
       
  1772     iStandardItutKp->SetTextLineLayout(
       
  1773         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
  1774         EPosRight1);
       
  1775     iStandardItutKp->SetTextLineLayout(
       
  1776         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
  1777         EPosRight2);
       
  1778     iStandardItutKp->SetTextLineLayout(
       
  1779         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
  1780         EPosRight3);
       
  1781     
       
  1782     RPointerArray<CVirtualKey>& keys = 
       
  1783         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
  1784     RArray<TRect>& cellRects = 
       
  1785         TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
  1786 
       
  1787     for (TInt i = 0 ; i < keys.Count(); i++)
       
  1788         {
       
  1789         keys[i]->SetRect(cellRects[i]);
       
  1790         TRect innerrect = cellRects[i];
       
  1791         innerrect.Shrink(TSize(4, 4));
       
  1792         keys[i]->SetInnerRect(innerrect);
       
  1793         }
       
  1794 	// set key background image size
       
  1795 	TSize curSize = cellRects[0].Size();
       
  1796 	if( iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal) )
       
  1797 		{
       
  1798 		TSize size = iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
  1799 		if( curSize != size )	
       
  1800 			{
       
  1801 	        for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
  1802 	            {
       
  1803 	            if( iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
  1804 	            	{
       
  1805 	                AknIconUtils::SetSize( 
       
  1806                                    iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
  1807                                    curSize, EAspectRatioNotPreserved );                    		
       
  1808 	            	}
       
  1809 	            }	
       
  1810 			}
       
  1811 		}
       
  1812     // Handle control res when language direction changing here.
       
  1813     if( iDataMgr->IsLangDirectionSwitch() || 
       
  1814     	( bSizeChanged && iDataMgr->IsRtoLLanguage() ) )
       
  1815     	{
       
  1816     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );
       
  1817     	iDataMgr->SetLangDirectionSwitch( EFalse );	
       
  1818     	}   
       
  1819     }
       
  1820 
       
  1821 void CGenericItutWindow::ResizeCandidateList(CFepCtrlDropdownList* aList, 
       
  1822                                              TInt aLTPosIdx, TBool aExpandable)
       
  1823     {
       
  1824     if (!aList)
       
  1825         {
       
  1826         return;   
       
  1827         }
       
  1828     
       
  1829     TInt unitWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth));
       
  1830     TInt unitHeight = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitHeight));
       
  1831     TInt horizontalMargin = 
       
  1832         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin));
       
  1833     TInt verticalMargin = 
       
  1834         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin));
       
  1835     //TInt naviWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListNaviWidth));
       
  1836     TInt naviWidth = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth));
       
  1837     CFont* listfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EDropdownListFont));
       
  1838     TPoint listLTPos = TItutDataConverter::AnyToPoint(iDataMgr->RequestData(aLTPosIdx));
       
  1839     
       
  1840     aList->SizeChanged(unitWidth, 
       
  1841                        unitHeight,
       
  1842                        naviWidth,
       
  1843                        listLTPos);
       
  1844 
       
  1845     aList->SetCellMargin(horizontalMargin, verticalMargin);
       
  1846     
       
  1847     if (aExpandable)
       
  1848         {
       
  1849         TInt naviSpinBtnHeight = 
       
  1850             TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListSpinBtnHeight));
       
  1851         
       
  1852         aList->SetSpinBtnHeight(naviSpinBtnHeight);
       
  1853         }
       
  1854     }
       
  1855 
       
  1856 void CGenericItutWindow::OnSkinChange()
       
  1857     {
       
  1858     CFont* itemfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
  1859     TRgb textcolor = GetMatchListTextColor();
       
  1860     iMatchSelection->SetTextProperty(itemfont, textcolor); 
       
  1861     
       
  1862     // when skin change all control with skin image should be reload.
       
  1863     TRAP_IGNORE(ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP ));    
       
  1864     
       
  1865     // reconstruct shift icon when skin changed
       
  1866     TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ReConstructL());
       
  1867     if ( iDataMgr->IsPortraitWest())
       
  1868         {
       
  1869         TRAP_IGNORE(iStandardItutKp->StarIcon()->ReConstructL());
       
  1870         TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ResizeL(iDataMgr->iShiftIconRectForPrtWest.Size()));
       
  1871         TRAP_IGNORE(iStandardItutKp->StarIcon()->ResizeL(iDataMgr->iStarIconRectForPrtWest.Size()));
       
  1872         }
       
  1873     else
       
  1874         {
       
  1875         TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ResizeL(iDataMgr->iShiftIconRect.Size()));
       
  1876         }
       
  1877     
       
  1878     //Skin change will case the reconstuction of the button graphic.
       
  1879     //When language is RToL, it should be mirrored again.
       
  1880     if( iDataMgr->IsRtoLLanguage() )
       
  1881     	{
       
  1882     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );	
       
  1883     	}
       
  1884     }
       
  1885 
       
  1886 
       
  1887 void CGenericItutWindow::CalculateFrameRects(const TRect aRect,
       
  1888 											 TRect& aOuterRect, 
       
  1889 											 TRect& aInnerRect )
       
  1890     {
       
  1891     TRect windowRect = aRect;
       
  1892     
       
  1893     TAknLayoutRect topLeft;
       
  1894     topLeft.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_2());
       
  1895 
       
  1896     TAknLayoutRect bottomRight;
       
  1897     bottomRight.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_5());
       
  1898 
       
  1899     aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
  1900     aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
  1901     }
       
  1902     
       
  1903 void CGenericItutWindow::EnterMatchSelectionState(TBool aOn)
       
  1904     {
       
  1905     TBuf<4> buf;
       
  1906     buf.Append(reinterpret_cast<TText*>(&aOn), sizeof(TBool)/sizeof(TText));
       
  1907     iLayoutOwner->SignalOwner(ESignalEnterMatchSelection, buf);
       
  1908     }
       
  1909 
       
  1910 void CGenericItutWindow::ResetIndicatorL(CFepUiBaseCtrl* aIndicator)
       
  1911 	{
       
  1912 	if ( NULL == aIndicator )
       
  1913 	    {
       
  1914 	    return;
       
  1915 	    }
       
  1916     SetIndicatorImageL(aIndicator, 
       
  1917                        iDataMgr->IndicatorData().iIndicatorImgID,
       
  1918                        iDataMgr->IndicatorData().iIndicatorMaskID,
       
  1919                        iDataMgr->IndicatorData().iIndicatorTextImgID,
       
  1920                        iDataMgr->IndicatorData().iIndicatorTextMaskID);
       
  1921 	}
       
  1922 
       
  1923 CAknFepCtrlCommonButton* CGenericItutWindow::CommonButtonControl(const TInt aControlId)
       
  1924     {
       
  1925     CFepUiBaseCtrl* ctrl = NULL;
       
  1926     ctrl = Control(aControlId);
       
  1927     
       
  1928     if (!ctrl)
       
  1929         {
       
  1930         return NULL;   
       
  1931         }
       
  1932         
       
  1933     if (!ctrl->IsKindOfControl(ECtrlButton))
       
  1934     
       
  1935         {
       
  1936         return NULL;   
       
  1937         }
       
  1938         
       
  1939     return static_cast<CAknFepCtrlCommonButton*>(ctrl);
       
  1940     }
       
  1941 
       
  1942 void CGenericItutWindow::DisplayInputmodeSwitchL()
       
  1943     {
       
  1944     CFepUiBaseCtrl* btn = Control(ECtrlIdSwitch);
       
  1945     if ( NULL == btn )
       
  1946         {
       
  1947         return;
       
  1948         }
       
  1949     
       
  1950     TRect rect = btn->Rect();
       
  1951               
       
  1952     TRAP_IGNORE( iInputModeSwitch->PopUpSwitchListL(rect) );        
       
  1953     }
       
  1954 
       
  1955 CFepUiBaseCtrl* CGenericItutWindow::Control(const TInt aCtrlId)
       
  1956     {
       
  1957     CFepUiBaseCtrl* ctrl = NULL;
       
  1958     RPointerArray<CFepUiBaseCtrl> todo;
       
  1959     TInt current = 0;
       
  1960     TBool found = EFalse;
       
  1961     
       
  1962     todo.Append(iLayoutOwner->RootControl());
       
  1963     CControlGroup* temp;
       
  1964     
       
  1965     while (current < todo.Count() && !found)
       
  1966         {
       
  1967         ctrl = todo[current];
       
  1968         
       
  1969         if(ctrl->ControlId() == aCtrlId) //Find control
       
  1970             {
       
  1971             found = ETrue;     
       
  1972             }
       
  1973         else
       
  1974             {
       
  1975             if(ctrl->IsKindOfControl(ECtrlControlGroup))
       
  1976                 {
       
  1977                 temp = static_cast<CControlGroup*>(ctrl);
       
  1978                 for (int i = 0; i < temp->NumOfControls(); i++)
       
  1979                     {
       
  1980                     todo.Append(temp->At(i));
       
  1981                     }
       
  1982                 }
       
  1983                 
       
  1984             current++;
       
  1985             }
       
  1986         }
       
  1987         
       
  1988     todo.Close();
       
  1989     
       
  1990     return found ? ctrl : NULL;
       
  1991     }      
       
  1992 
       
  1993 TBool CGenericItutWindow::IsChineseMode()
       
  1994     {
       
  1995     TInt immode = iDataMgr->InputMode();
       
  1996     TBool chineseMode = EFalse;
       
  1997     
       
  1998     if (immode == EPinyin || immode == EStroke || immode == EZhuyin)
       
  1999         {
       
  2000         chineseMode = ETrue;
       
  2001         }
       
  2002     
       
  2003     return chineseMode;    
       
  2004     }
       
  2005 
       
  2006 void CGenericItutWindow::ConstructKeyImageFromResourceL( TInt aKeyImageResID )
       
  2007 	{
       
  2008     TResourceReader reader;    
       
  2009     CCoeEnv::Static()->CreateResourceReaderLC( reader, aKeyImageResID );      
       
  2010     
       
  2011     TPtrC bmpFileName = reader.ReadTPtrC();
       
  2012     TInt32 imgMajorSkinId = reader.ReadInt32();
       
  2013     TAknsItemID id;
       
  2014     
       
  2015     RArray<TRect>& cellRects = 
       
  2016                      TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
  2017     TSize keySize = cellRects[0].Size();
       
  2018     for (TInt index = 0; index <= EKeyBmpLastType ; index += 2)
       
  2019         { 
       
  2020         // Get the image ids and mask ids from resource
       
  2021         TInt bmpId = reader.ReadInt16(); 
       
  2022         TInt bmpMskId = reader.ReadInt16();
       
  2023         
       
  2024         // read skin item id
       
  2025         const TInt skinitemid = reader.ReadInt16();
       
  2026         id.Set(TInt(imgMajorSkinId), skinitemid);
       
  2027         
       
  2028         if (bmpId != KInvalidBmp)
       
  2029             {
       
  2030         	CFbsBitmap* bmp = NULL;
       
  2031         	CFbsBitmap* maskbmp = NULL;
       
  2032 
       
  2033         	if (bmpMskId != KInvalidBmp)
       
  2034         		{
       
  2035         		AknsUtils::CreateIconL(AknsUtils::SkinInstance(),
       
  2036         		                       id,
       
  2037         		                       bmp,
       
  2038         		                       maskbmp,
       
  2039         		                       bmpFileName,
       
  2040         		                       bmpId,
       
  2041         		                       bmpMskId);
       
  2042         		
       
  2043        		    // set maskbmp and size
       
  2044        		    AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved );
       
  2045                 iStandardItutKp->SetNonIrregularKeyBitmapL(
       
  2046                 TVirtualKeyBmpType(EKeyBmpNormal + index + 1), maskbmp );
       
  2047                 }
       
  2048             else
       
  2049                 {
       
  2050         	    AknsUtils::CreateIconL(AknsUtils::SkinInstance(),
       
  2051         	                           id,
       
  2052         	                           bmp,
       
  2053         	                           bmpFileName,
       
  2054         	                           bmpId);
       
  2055                 }
       
  2056             // set bmp and size
       
  2057             AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved );
       
  2058            	iStandardItutKp->SetNonIrregularKeyBitmapL( 
       
  2059                                                  TVirtualKeyBmpType(EKeyBmpNormal + index), bmp );
       
  2060             }       
       
  2061         }
       
  2062     // Pop and destroy reader
       
  2063     CleanupStack::PopAndDestroy( 1 );		
       
  2064 	}
       
  2065 	
       
  2066 void CGenericItutWindow::HandleButtonResOnLangDirChange( TInt aControlId )
       
  2067 	{
       
  2068     TRAP_IGNORE(HandleButtonResOnLangDirChangeL(aControlId));
       
  2069     }
       
  2070 void CGenericItutWindow::HandleButtonResOnLangDirChangeL( TInt aControlId )
       
  2071 	{
       
  2072 	CAknFepCtrlCommonButton* ctrl = CommonButtonControl(aControlId);
       
  2073 	if( ctrl && iBmpRotator)
       
  2074 		{
       
  2075 		TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis; 
       
  2076 		User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmp() ,
       
  2077 								  				 rotChoice ) );
       
  2078 		User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmpMask() ,
       
  2079 								  				 rotChoice ) );   								  
       
  2080 		}		
       
  2081 	}
       
  2082 
       
  2083 void CGenericItutWindow::SetHardKeyOneSymbol(TUint8* aData)
       
  2084     {
       
  2085     TRAP_IGNORE(SetHardKeyOneSymbolL(aData));
       
  2086     }
       
  2087 void CGenericItutWindow::SetHardKeyOneSymbolL(TUint8* aData)
       
  2088     {
       
  2089     //Read stream
       
  2090     RDesReadStream readStream;
       
  2091 
       
  2092     TPtr8 countPtr( aData, 3*sizeof(TInt), 3*sizeof(TInt) );            
       
  2093     readStream.Open(countPtr);
       
  2094     CleanupClosePushL(readStream);
       
  2095 
       
  2096     iSymbolData.iSymbol1 = readStream.ReadInt32L();
       
  2097     iSymbolData.iSymbol2 = readStream.ReadInt32L();
       
  2098     iSymbolData.iSymbol3 = readStream.ReadInt32L();
       
  2099     
       
  2100     CleanupStack::PopAndDestroy(&readStream);  
       
  2101     }
       
  2102 
       
  2103 void CGenericItutWindow::SetUnicodesForHardKey1(CVirtualKey* aKey, const TDesC& aMapData)
       
  2104     {
       
  2105     TRAP_IGNORE(SetUnicodesForHardKey1L(aKey, aMapData));
       
  2106     }
       
  2107 void CGenericItutWindow::SetUnicodesForHardKey1L(CVirtualKey* aKey, const TDesC& aMapData)
       
  2108     {
       
  2109     RPointerArray<HBufC> unicodesArr1;
       
  2110     RArray<TInt> unicodesInt;
       
  2111     
       
  2112     unicodesInt.Append(iSymbolData.iSymbol1);
       
  2113     unicodesInt.Append(iSymbolData.iSymbol2);
       
  2114     unicodesInt.Append(iSymbolData.iSymbol3);
       
  2115     
       
  2116     TInt curMode = TItutDataConverter::AnyToInt(
       
  2117             iLayoutOwner->DataMgr()->RequestData(EInputMode));
       
  2118     
       
  2119     TInt curLang = TItutDataConverter::AnyToInt(
       
  2120             iLayoutOwner->DataMgr()->RequestData(ELanguage));    
       
  2121     
       
  2122     TInt latinOnly = TItutDataConverter::AnyToInt(
       
  2123             iLayoutOwner->DataMgr()->RequestData(ELatinOnly));        
       
  2124     
       
  2125     HBufC* symbols = HBufC::NewL( 20 );
       
  2126     for (TInt i = 0; i <= 2; i++)
       
  2127         {
       
  2128         symbols->Des().Append( unicodesInt[i] );
       
  2129         if (EHindi == curMode ||
       
  2130                 (ELatin == curMode && curLang == ELangThai && !latinOnly))
       
  2131             {
       
  2132             continue;
       
  2133             }
       
  2134         else
       
  2135             {
       
  2136             symbols->Des().Append( KSpaceUnicode );
       
  2137             }
       
  2138         }
       
  2139     
       
  2140     HBufC* number = HBufC::NewL( 1 );
       
  2141     number->Des().Append( aMapData );
       
  2142     unicodesArr1.AppendL(number);
       
  2143     unicodesArr1.AppendL(symbols);
       
  2144     
       
  2145     aKey->SetUnicodesL(unicodesArr1);
       
  2146 
       
  2147     unicodesArr1.Close();
       
  2148     unicodesInt.Close();
       
  2149 
       
  2150     }
       
  2151 
       
  2152 void CGenericItutWindow::IndiBubbleWithText()
       
  2153     {
       
  2154     if ( iICF )
       
  2155         {
       
  2156         TAknTextLineLayout textLine = TItutDataConverter::AnyToTextLine( 
       
  2157                 iDataMgr->RequestData( EIndiTextLine ));
       
  2158         TRect bubbleRect = TItutDataConverter::AnyToRect( 
       
  2159                 iDataMgr->RequestData( EIndiPaneWithTextRect ));
       
  2160         TRect iconRect = TItutDataConverter::AnyToRect( 
       
  2161                 iDataMgr->RequestData( EIndiIconWithTextRect ));
       
  2162         TSize offset;
       
  2163         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  2164         offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
       
  2165         TSize size( iconRect.Width(), iconRect.Height());
       
  2166         
       
  2167         iICF->MsgBubbleCtrl()->SetRect( bubbleRect );
       
  2168         iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
       
  2169         iICF->MsgBubbleCtrl()->SetTextFormat( textLine );
       
  2170         iICF->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
  2171         }
       
  2172     }
       
  2173 
       
  2174 void CGenericItutWindow::IndiBubbleWithoutText()
       
  2175     {
       
  2176     if ( iICF )
       
  2177         {
       
  2178         TRect bubbleRect = TItutDataConverter::AnyToRect( 
       
  2179                 iDataMgr->RequestData( EIndiPaneWithoutTextRect ));
       
  2180         TRect iconRect = TItutDataConverter::AnyToRect( 
       
  2181                 iDataMgr->RequestData( EIndiIconWithoutTextRect ));
       
  2182         TSize offset;
       
  2183         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  2184         offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
       
  2185         TSize size( iconRect.Width(), iconRect.Height());
       
  2186         
       
  2187         iICF->MsgBubbleCtrl()->SetRect( bubbleRect );
       
  2188         iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
       
  2189         }
       
  2190     }
       
  2191 
       
  2192 void CGenericItutWindow::MsgBubbleForChinese()
       
  2193 	{
       
  2194 	if ( iICF )
       
  2195 		{
       
  2196 		iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
       
  2197 	    iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
       
  2198 		
       
  2199 	    iICF->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
  2200 	    iICF->MsgBubbleCtrl()->SetBitmapParam(NULL,
       
  2201 	    									  NULL,
       
  2202 	    									  KAknsIIDQsnFrInputPreviewSideL,
       
  2203 	    									  KAknsIIDQsnFrInputPreviewMiddle,
       
  2204 	    									  KAknsIIDQsnFrInputPreviewSideR);  
       
  2205 	    iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
  2206 	    TRAP_IGNORE(iICF->MsgBubbleCtrl()->SetTextL( KEmptyString ));
       
  2207 		}
       
  2208 	}
       
  2209 void CGenericItutWindow::SetIndiWithTextFlag( TBool aFlag )
       
  2210     {
       
  2211     iIndiWithText = aFlag;
       
  2212     }
       
  2213 void CGenericItutWindow::CreateKoreanSpecificCtrlsIfNeededL()
       
  2214     {
       
  2215 	if( !Control(ECtrlIdIndicator) )
       
  2216 		{
       
  2217 	    CreateButtonL(ECommonButton, ECtrlIdIndicator, KUnavailableID, 
       
  2218 					  KUnavailableID,KUnavailableID);
       
  2219         // create input case type menu
       
  2220 	    AddEditorMenuL();
       
  2221 		}
       
  2222 	
       
  2223 	if( !Control(ECtrlIdSwitch))
       
  2224 		{
       
  2225 		CreateButtonL(ECommonButton, ECtrlIdSwitch, ESwitchRect, 
       
  2226                     ESwitchInnerRect, R_FINGER_LAYOUT_SWITCH);
       
  2227 	
       
  2228 		}
       
  2229 	
       
  2230 	
       
  2231 	if( !iInputModeSwitch )
       
  2232 		{
       
  2233 		// create switch input mode menu
       
  2234 		iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL(
       
  2235 										 iLayoutOwner,
       
  2236 										 ECtrlIdInputSwitch,
       
  2237 										 EPluginInputModeItut );
       
  2238 		iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
       
  2239 		AddControlL( iInputModeSwitch );
       
  2240 		}
       
  2241     }
       
  2242 // End Of File