textinput/peninputsplititut/src/peninputsplititutwindow.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 <peninputsplititutnew.rsg>
       
    20 #include <peninputsplititutconfig_chinese.rsg>
       
    21 #include <skinlayout.cdl.h>
       
    22 #include <AknsDrawUtils.h>
       
    23 #include <AknsUtils.h>
       
    24 #include <AknUtils.h> 
       
    25 #include <peninputrawkeybutton.h>
       
    26 #include <peninputrepeatbutton.h>
       
    27 #include <peninputcommonbutton.h>
       
    28 #include <AknFepGlobalEnums.h>
       
    29 #include <aknfeppeninputenums.h>
       
    30 #include <peninputdropdownlist.h>
       
    31 #include <s32mem.h>
       
    32 #include <peninputlabel.h>
       
    33 #include <peninputlayoutbubblectrl.h>
       
    34 #include <aknlayoutscalable_apps.cdl.h>
       
    35 
       
    36 #include "peninputsplititutwindow.h"
       
    37 #include "peninputsplititutdatamgr.h"
       
    38 #include "peninputsplititutuimgrbase.h"
       
    39 #include "peninputsplititutuistatebase.h"
       
    40 #include "peninputsplititutchnuimgr.h"
       
    41 #include "peninputsplititutwesternuimgr.h"
       
    42 #include "peninputsplititutconverter.h"
       
    43 #include "peninputcommonbgctrl.h"
       
    44 
       
    45 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputsplititut.mbm");
       
    46 _LIT(KEmptyString, "");
       
    47 
       
    48 const TInt KImageMajorSkinId = EAknsMajorGeneric;
       
    49 const TUint KDefaultSpellTextColor = 0;
       
    50 
       
    51 const TInt KSpaceUnicode = 32;
       
    52 const TInt KButtonOneUnicode = 49;
       
    53 const TInt KInvalidBmp = -1;
       
    54 
       
    55 const TUint KDefaultIcfTextColor = 0x000000;
       
    56 const TUint KDefaultIcfFrameColor = 0x000000;
       
    57 const TInt KTextLength = 100;
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 
       
    63 // ============================ MEMBER FUNCTIONS =============================
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CSplitItutWindow::NewL
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CSplitItutWindow* CSplitItutWindow::NewL(CSplitItutWindowManager* aWindowMgr,
       
    70                                              CSplitItutUiLayout* aLayoutOwner,
       
    71                                              CSplitItutDataMgr* aDataMgr)
       
    72     {
       
    73     CSplitItutWindow* window = new (ELeave) CSplitItutWindow(aWindowMgr,aLayoutOwner,aDataMgr);
       
    74 
       
    75     CleanupStack::PushL(window);
       
    76     window->ConstructL();
       
    77     CleanupStack::Pop(window);
       
    78 
       
    79     return window;
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CSplitItutWindow::CSplitItutWindow
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CSplitItutWindow::CSplitItutWindow(CSplitItutWindowManager* aWindowMgr, 
       
    87                                        CSplitItutUiLayout* aLayoutOwner,
       
    88                                        CSplitItutDataMgr* aDataMgr)
       
    89     : iDataMgr(aDataMgr),
       
    90       iLayoutOwner(aLayoutOwner),
       
    91       iWindowMgr(aWindowMgr)
       
    92     {
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CSplitItutWindow::~CSplitItutWindow
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 CSplitItutWindow::~CSplitItutWindow()
       
   100     {
       
   101     delete iBmpRotator;
       
   102     }
       
   103 
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // CSplitItutWindow::SetPropertyL
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CSplitItutWindow::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, 
       
   110                                         const TDesC& aPropertyValue)
       
   111     {
       
   112     switch (aPropertyName)
       
   113         {
       
   114         case MItutPropertySubscriber::EItutPropertyKeypadResourceId:
       
   115         case MItutPropertySubscriber::EItutPropertyCandidateListResourceId:
       
   116             {
       
   117             TInt resId = TItutDataConverter::AnyToInt(const_cast<TUint16*>(aPropertyValue.Ptr()));
       
   118             
       
   119             if (resId == KInvalidResId)
       
   120                 {
       
   121                 return;
       
   122                 }
       
   123 
       
   124             if (aPropertyName == MItutPropertySubscriber::EItutPropertyKeypadResourceId)
       
   125                 {
       
   126                 ConstructItutKeypadFromResourceL(resId);
       
   127                 }
       
   128             else if (iCandsList)
       
   129                 {
       
   130                 iCandsList->ResetAndClear(CFepCtrlDropdownList::EListExpandable);
       
   131                 iCandsList->SetResourceId(resId);
       
   132                 iCandsList->ConstructFromResourceL();                  
       
   133                 }
       
   134             }
       
   135             break;
       
   136         case MItutPropertySubscriber::EItutPropertyLandscape:
       
   137             {
       
   138             TBool landscape = *((TInt*)(aPropertyValue.Ptr()));
       
   139 
       
   140             if (iDataMgr->IsChinese())
       
   141                 {
       
   142                 if (landscape)
       
   143                     {
       
   144                     // expand upward
       
   145                     iSpellCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   146                     iCandsList->SetCandExpandType(CFepCtrlDropdownList::ECandExpandUpward);
       
   147                     }
       
   148                 else
       
   149                     {
       
   150                     // portrait, expand downward
       
   151                     iSpellCandsList->SetCandExpandType();
       
   152                     iCandsList->SetCandExpandType();
       
   153                     }
       
   154                 }
       
   155             }
       
   156             break;
       
   157         default:
       
   158             break;    
       
   159         }
       
   160     }
       
   161 
       
   162 // ---------------------------------------------------------------------------
       
   163 // CSplitItutWindow::CreateItutKeypadL
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 void CSplitItutWindow::CreateItutKeypadL()
       
   167     {
       
   168     TRect keypadRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EKeypadRect));
       
   169 
       
   170     TFontSpec spec;
       
   171 
       
   172     iStandardItutKp = CVirtualKeyboard::NewL(keypadRect,
       
   173                                              iLayoutOwner,
       
   174                                              ECtrlIdStdItut,
       
   175                                              spec);
       
   176     AddControlL(iStandardItutKp);
       
   177 
       
   178     iStandardItutKp->SetResourceId(KInvalidResId);
       
   179 	
       
   180 	// read keypad image info
       
   181 	ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP );
       
   182 	
       
   183     iStandardItutKp->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG65 );
       
   184     iStandardItutKp->SetDrawOpaqueBackground(EFalse);
       
   185     
       
   186     // read key shift icon res
       
   187     CPenInputColorIcon* shiftIcon = CPenInputColorIcon::NewL( R_ITUT_KEYPAD_SHIFT_ICON );
       
   188     shiftIcon->ResizeL( iDataMgr->iShiftIconRect.Size() );
       
   189     iStandardItutKp->SetShiftIcon( shiftIcon );
       
   190     
       
   191     // read key star icon res
       
   192     CPenInputColorIcon* starIcon = CPenInputColorIcon::NewL( R_ITUT_KEYPAD_STAR_ICON );
       
   193     starIcon->ResizeL( iDataMgr->iStarIconRect.Size() );
       
   194     iStandardItutKp->SetStarIcon( starIcon );    
       
   195     
       
   196     //set key to be 9 piece graphics
       
   197     iStandardItutKp->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
       
   198     iStandardItutKp->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
       
   199     iStandardItutKp->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CSplitItutWindow::CreateLayoutIconL
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 void CSplitItutWindow::CreateLayoutIconL(TInt aMajorSkinId,
       
   207                                              TInt aMinorSkinId,
       
   208                                              const TDesC& aBmpFileName,
       
   209                                              TInt aBmpId,
       
   210                                              TInt aMaskBmpId,
       
   211                                              CFbsBitmap*& aBmp,
       
   212                                              CFbsBitmap*& aMaskBmp,
       
   213                                              TSize aSize)
       
   214     {
       
   215     TAknsItemID id;
       
   216     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   217     id.Set(TInt(aMajorSkinId), aMinorSkinId);
       
   218 
       
   219     if (aBmpId != KInvalidBmp)
       
   220         {
       
   221         if (aMaskBmpId != KInvalidBmp)
       
   222             {
       
   223             AknsUtils::CreateIconL(skininstance,
       
   224                                    id,
       
   225                                    aBmp,
       
   226                                    aMaskBmp,
       
   227                                    aBmpFileName,
       
   228                                    aBmpId,
       
   229                                    aMaskBmpId);
       
   230             AknIconUtils::SetSize(aMaskBmp, aSize, EAspectRatioNotPreserved);
       
   231             }
       
   232         else
       
   233             {
       
   234             AknsUtils::CreateIconL(skininstance,
       
   235                                    id,
       
   236                                    aBmp,
       
   237                                    aBmpFileName,
       
   238                                    aBmpId);
       
   239             }
       
   240 
       
   241         AknIconUtils::SetSize(aBmp, aSize, EAspectRatioNotPreserved);
       
   242         }
       
   243     }
       
   244 
       
   245 // ---------------------------------------------------------------------------
       
   246 // CSplitItutWindow::ConstructItutKeypadFromResourceL
       
   247 // ---------------------------------------------------------------------------
       
   248 //
       
   249 void CSplitItutWindow::ConstructItutKeypadFromResourceL(TInt aResId)
       
   250     {
       
   251     iStandardItutKp->SetResourceId(aResId);
       
   252 
       
   253     iStandardItutKp->SetTextLineLayout(
       
   254         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
   255         EPosLeft);
       
   256     iStandardItutKp->SetTextLineLayout(
       
   257         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
   258         EPosRight1);
       
   259     iStandardItutKp->SetTextLineLayout(
       
   260         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
   261         EPosRight2);
       
   262     iStandardItutKp->SetTextLineLayout(
       
   263         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
   264         EPosRight3);
       
   265 
       
   266     TResourceReader reader;
       
   267     CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId);
       
   268 
       
   269     // construct keys
       
   270     TInt countkeys = reader.ReadInt16();
       
   271 
       
   272     RPointerArray<CVirtualKey>& keys = 
       
   273         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
   274 
       
   275     if (keys.Count() == 0)
       
   276         {
       
   277         for (TInt i = 0; i < countkeys; i++)
       
   278             {
       
   279             RArray<TRect>& cellrects = 
       
   280                        TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
   281 
       
   282             CVirtualKey* vk = CreateKeyL(reader,
       
   283                                          cellrects[i]);
       
   284             CleanupStack::PushL(vk);
       
   285             iStandardItutKp->AddRawKeyL(vk);
       
   286             CleanupStack::Pop(vk);
       
   287             }
       
   288         }
       
   289     else
       
   290         {
       
   291         countkeys = keys.Count();
       
   292         for (TInt i = 0; i < countkeys; i++)
       
   293             {
       
   294             ChangeVirtualKeyInfoL(reader, keys[i]);
       
   295             }
       
   296         }
       
   297 
       
   298     CleanupStack::PopAndDestroy(1); // reader
       
   299 	
       
   300 	iStandardItutKp->Draw();
       
   301     iStandardItutKp->UpdateArea( iStandardItutKp->Rect() );
       
   302     }
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 // CSplitItutWindow::ChangeVirtualKeyInfoL
       
   306 // ---------------------------------------------------------------------------
       
   307 //
       
   308 void CSplitItutWindow::ChangeVirtualKeyInfoL( TResourceReader& aReader, 
       
   309                                               CVirtualKey* aKey)
       
   310     {
       
   311 
       
   312     TBuf<5> mapData;
       
   313     //Init Data
       
   314     for (TInt i = 0; i < 5; i++)
       
   315         {
       
   316         mapData.Append(0);
       
   317         }
       
   318     
       
   319     RPointerArray<HBufC> unicodesArr;
       
   320     for (TInt i = 0; i <= EPosLast; i++)
       
   321         {
       
   322         HBufC* unicode = aReader.ReadHBufCL();
       
   323         if (i == 0 && unicode != NULL)
       
   324             {
       
   325             mapData = unicode->Des();
       
   326             }
       
   327         unicodesArr.AppendL(unicode);
       
   328         }
       
   329 
       
   330     TInt keyscancode = aReader.ReadInt16();
       
   331     if (keyscancode != aKey->ScanCode())
       
   332         {
       
   333         return;
       
   334         }
       
   335     
       
   336     TInt curMode = TItutDataConverter::AnyToInt(
       
   337             iLayoutOwner->DataMgr()->RequestData(EInputMode));
       
   338     TBool isChinese = iLayoutOwner->DataMgr()->IsChinese();
       
   339     TBool isThai = iLayoutOwner->DataMgr()->IsThai();
       
   340     
       
   341     TInt latinOnly = TItutDataConverter::AnyToInt(
       
   342             iLayoutOwner->DataMgr()->RequestData(ELatinOnly));     
       
   343             
       
   344     //No symbol in Number range. Symbols under chinese are read from res 
       
   345     if ( curMode != ENumber && curMode != ENativeNumber 
       
   346          && iSymbolData.iSymbol1 != 0 && keyscancode == KButtonOneUnicode 
       
   347          && ( !isChinese || latinOnly )
       
   348          && ( !isThai ) )
       
   349         {
       
   350         //So we should delete it
       
   351         for (TInt i = 0; i <= EPosLast; i++)
       
   352             {
       
   353             delete unicodesArr[i];
       
   354             }
       
   355         SetUnicodesForHardKey1(aKey, mapData);
       
   356         }
       
   357     else
       
   358         {
       
   359         aKey->SetUnicodesL(unicodesArr);
       
   360         }
       
   361 
       
   362     unicodesArr.Close();
       
   363     }
       
   364 
       
   365 // ---------------------------------------------------------------------------
       
   366 // CSplitItutWindow::CreateKeyL
       
   367 // ---------------------------------------------------------------------------
       
   368 //
       
   369 CVirtualKey* CSplitItutWindow::CreateKeyL(TResourceReader& aReader,
       
   370                                               TRect aKeyRect)
       
   371     {
       
   372     RPointerArray<HBufC> unicodesArr;
       
   373     for (TInt i = 0; i <= EPosLast; i++)
       
   374         {
       
   375         HBufC* unicode = aReader.ReadHBufCL();
       
   376         unicodesArr.AppendL(unicode);
       
   377         }
       
   378 
       
   379     TInt keyscancode = aReader.ReadInt16();
       
   380 
       
   381     CVirtualKey* vk = CVirtualKey::NewL(unicodesArr,
       
   382                                         keyscancode, 
       
   383                                         aKeyRect);
       
   384     unicodesArr.Close();
       
   385     CleanupStack::PushL(vk);
       
   386     
       
   387     TRect innerrect = aKeyRect;
       
   388     innerrect.Shrink(TSize(7, 7));
       
   389     vk->SetInnerRect(innerrect);
       
   390 
       
   391     CleanupStack::Pop(vk);
       
   392 
       
   393     return vk;
       
   394     }
       
   395 
       
   396 // ---------------------------------------------------------------------------
       
   397 // CSplitItutWindow::CreateBackGroundControlL
       
   398 // ---------------------------------------------------------------------------
       
   399 //
       
   400 void CSplitItutWindow::CreateBackGroundControlL()
       
   401 	{
       
   402     iBackgroundCtrl = CAknFepCtrlCommonBgCtrl::NewL(
       
   403                                           iLayoutOwner,
       
   404                                           ECtrlIdBackground,
       
   405                                           KAknsIIDQsnFrPopup,
       
   406                                           KAknsIIDQsnFrPopupCenter);
       
   407 
       
   408 
       
   409 	iBackgroundCtrl->SetRect(TItutDataConverter::AnyToRect(
       
   410 					iLayoutOwner->DataMgr()->RequestData(EBackgroundRect)));
       
   411 					    							
       
   412 	AddControlL(iBackgroundCtrl);
       
   413 	}
       
   414 
       
   415 
       
   416 // ---------------------------------------------------------------------------
       
   417 // CSplitItutWindow::CreateRawKeyButtonL
       
   418 // ---------------------------------------------------------------------------
       
   419 //
       
   420 CAknFepCtrlCommonButton* CSplitItutWindow::CreateRawKeyButtonL(const TInt aControlId,
       
   421                                                         const TInt aCommand)
       
   422     {
       
   423     CAknFepCtrlCommonButton* temp = NULL;
       
   424     
       
   425     if (aCommand == KUnavailableID)
       
   426         {
       
   427         temp =  CAknFepCtrlRawKeyButton::NewL(iLayoutOwner,
       
   428                                              aControlId,
       
   429                                              KAknsIIDQsnFrFunctionButtonNormal,
       
   430 											 KAknsIIDQsnFrFunctionButtonPressed,
       
   431 											 KAknsIIDQsnFrFunctionButtonInactive,  
       
   432                                              EEventRawKeyDownEvent,
       
   433                                              EEventRawKeyUpEvent); 
       
   434         }
       
   435     else
       
   436         {
       
   437         temp =  CAknFepCtrlRawKeyButton::NewL(iLayoutOwner,
       
   438                                              aControlId,
       
   439                                              KAknsIIDQsnFrFunctionButtonNormal,
       
   440 											 KAknsIIDQsnFrFunctionButtonPressed,
       
   441 											 KAknsIIDQsnFrFunctionButtonInactive,  
       
   442                                              EEventRawKeyDownEvent,
       
   443                                              EEventRawKeyUpEvent,
       
   444                                              aCommand); 
       
   445         }
       
   446                                          
       
   447     return temp;       
       
   448     }
       
   449     
       
   450 // ---------------------------------------------------------------------------
       
   451 // CSplitItutWindow::CreateCommonButtonL
       
   452 // ---------------------------------------------------------------------------
       
   453 //
       
   454 CAknFepCtrlCommonButton* CSplitItutWindow::CreateCommonButtonL(const TInt aControlId)
       
   455     {
       
   456     return CAknFepCtrlCommonButton::NewL(iLayoutOwner, 
       
   457     									 aControlId,
       
   458     									 KAknsIIDQsnFrFunctionButtonNormal,
       
   459 										 KAknsIIDQsnFrFunctionButtonPressed,
       
   460 										 KAknsIIDQsnFrFunctionButtonInactive );
       
   461      
       
   462     }    
       
   463   
       
   464 // ---------------------------------------------------------------------------
       
   465 // CSplitItutWindow::CreateRepeatButtonL
       
   466 // ---------------------------------------------------------------------------
       
   467 //
       
   468 CAknFepCtrlCommonButton* CSplitItutWindow::CreateRepeatButtonL(const TInt /*aControlId*/,
       
   469                                                                const TInt /*aCommand*/)
       
   470     {
       
   471     return NULL;
       
   472      
       
   473     }     
       
   474 
       
   475     
       
   476 // ---------------------------------------------------------------------------
       
   477 // CSplitItutWindow::CreateButtonL
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 CFepUiBaseCtrl* CSplitItutWindow::CreateButtonL(TButtonType aType,
       
   481                                                   const TInt aControlId,
       
   482                                                   const TInt aRectId,
       
   483                                                   const TInt aInnerRectId,
       
   484                                                   const TInt aResourceId,
       
   485                                                   const TInt aCommand)
       
   486     {
       
   487     CAknFepCtrlCommonButton* temp = NULL;
       
   488     
       
   489     switch(aType)
       
   490         {
       
   491         case ERawKeyButton:
       
   492             {
       
   493             temp = CreateRawKeyButtonL(aControlId, aCommand);    
       
   494             }
       
   495         break;
       
   496         case ECommonButton:
       
   497             {
       
   498             temp = CreateCommonButtonL(aControlId);    
       
   499             }
       
   500         break;
       
   501         default:
       
   502             {
       
   503             User::Leave(KErrArgument);    
       
   504             }                
       
   505         }
       
   506 
       
   507     TRect btnrect;
       
   508     TRect btnInnerRect;
       
   509     
       
   510     if (aRectId != KUnavailableID &&
       
   511         aInnerRectId != KUnavailableID)
       
   512         {
       
   513         btnrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectId));
       
   514         btnInnerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRectId));
       
   515            
       
   516         temp->SetRect(btnrect);
       
   517         temp->SetForgroundBmpRect(btnInnerRect);
       
   518         }
       
   519         
       
   520     if (aResourceId != KUnavailableID)
       
   521         {
       
   522         temp->SetResourceId(aResourceId);
       
   523         temp->ConstructFromResourceL();            
       
   524         }
       
   525       
       
   526     if (aRectId != KUnavailableID &&
       
   527         aInnerRectId != KUnavailableID)
       
   528         {
       
   529         temp->SizeChanged(temp->Rect(), btnInnerRect, ETrue);
       
   530         }        
       
   531 
       
   532     AddControlL(temp);
       
   533     
       
   534     return temp;
       
   535     }
       
   536 
       
   537 // ---------------------------------------------------------------------------
       
   538 // CSplitItutWindow::CreateAllButtonL
       
   539 // ---------------------------------------------------------------------------
       
   540 //
       
   541 void CSplitItutWindow::CreateAllButtonL()
       
   542     {
       
   543     //create backgrand 
       
   544     CreateBackGroundControlL();
       
   545     
       
   546     //create backspace
       
   547     CreateButtonL(ERawKeyButton, ECtrlIdBackspace, EBackspaceRect, 
       
   548                   EBackspaceInnerRect,R_FINGER_RAWKEY_BACKSPACE);
       
   549 
       
   550     // create navi 
       
   551     CreateButtonL(ERawKeyButton, ECtrlIdArrowLeft, EArrowLeftRect, 
       
   552                   ELeftInnerRect,R_FINGER_RAWKEY_LEFTARROW);    
       
   553     
       
   554     CreateButtonL(ERawKeyButton, ECtrlIdArrowRight, EArrowRightRect, 
       
   555                   ERightInnerRect,R_FINGER_RAWKEY_RIGHTARROW); 
       
   556 
       
   557     /*
       
   558     CreateButtonL(ERepeatButtonEx, ECtrlIdArrowUp, EArrowUpRect, 
       
   559                   EUpInnerRect,R_PENINPUT_FINGER_CURSOR_UP); 
       
   560 
       
   561     CreateButtonL(ERepeatButtonEx, ECtrlIdArrowDown, EArrowDownRect, 
       
   562                   EDownInnerRect,R_PENINPUT_FINGER_CURSOR_DOWN);
       
   563     */
       
   564     //create option 
       
   565     CreateButtonL(ECommonButton, ECtrlIdOptions, EOptionsRect, 
       
   566                   EOptionInnerRect, R_PENINPUT_FINGER_OPTIONS);    
       
   567     
       
   568     //Crease close
       
   569     CreateButtonL(ECommonButton, ECtrlIdClose, ECloseRect, 
       
   570                   ECloseInnerRect, R_PENINPUT_FINGER_CLOSE);                   
       
   571 
       
   572     }
       
   573 
       
   574 // ---------------------------------------------------------------------------
       
   575 // CSplitItutWindow::CreateDropdownListL
       
   576 // ---------------------------------------------------------------------------
       
   577 //
       
   578 void CSplitItutWindow::CreateDropdownListL()
       
   579     {
       
   580 	TRect outrect,innerrect;
       
   581 	outrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleRect));  
       
   582 	innerrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleInnerRect));
       
   583     TAknTextLineLayout bubbleTextLayout = 
       
   584         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EPreviewBubbleTextlayout));
       
   585     CFont* bubbleFont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EPreviewBubbleFont));
       
   586     
       
   587     TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, 
       
   588     									KAknsIIDQsnFrFunctionButtonNormal,
       
   589     								    KAknsIIDQsnFrFunctionButtonPressed,
       
   590     						            KAknsIIDQsnFrItutButtonCandiSideL,
       
   591     						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
   592     						            KAknsIIDQsnFrItutButtonCandiSideR,
       
   593     						            KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
   594     						            KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
   595     						            KAknsIIDQsnFrItutButtonCandiPressedSideR,
       
   596     						            TRgb(194, 221, 242),
       
   597     						            ETrue);
       
   598     						            
       
   599     TDropdownListDrawInfo compositionDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, 
       
   600     									KAknsIIDQsnFrFunctionButtonNormal,
       
   601     								    KAknsIIDQsnFrFunctionButtonPressed,
       
   602     						            KAknsIIDQsnFrItutButtonComposeSideL,
       
   603     						            KAknsIIDQsnFrItutButtonComposeMiddle,
       
   604     						            KAknsIIDQsnFrItutButtonComposeSideR,
       
   605     						            KAknsIIDQsnFrItutButtonComposePressedSideL,
       
   606     						            KAknsIIDQsnFrItutButtonComposePressedSideR,
       
   607     						            KAknsIIDQsnFrItutButtonComposePressedMiddle,
       
   608     						            TRgb(194, 221, 242),
       
   609     						            ETrue);    						            
       
   610     TInt unitWidth =  TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitWidth));
       
   611     TInt unitHeight = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistUnitHeight));
       
   612     TInt horizontalMargin =  
       
   613         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin));
       
   614     TInt verticalMargin =  
       
   615         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin));
       
   616 
       
   617     CFont* listfont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EDropdownListFont));
       
   618     TInt textmargin = TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListTextMargin));
       
   619     TRgb textcolor = TItutDataConverter::AnyToRgb(iDataMgr->RequestData(EDropdownListTextColor));
       
   620 
       
   621     TPoint spellListLTPos = 
       
   622         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListSpellLTPos));
       
   623     // create spelling drop list
       
   624     iSpellCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   625                                                  ECtrlIdSpellCandsList,
       
   626                                                  R_AKN_FEP_PINYIN_SPELLING_DROP_DOWN_LIST,
       
   627                                                  spellListLTPos,
       
   628                                                  TSize(unitWidth, unitHeight),
       
   629                                                  5,
       
   630                                                  3);
       
   631 
       
   632 
       
   633     iSpellCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   634     iSpellCandsList->SetFont(listfont);
       
   635     AddControlL(iSpellCandsList);
       
   636     iSpellCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   637     iSpellCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateFromBeginning);
       
   638     iSpellCandsList->SetFuzzyBoundry(10);
       
   639     iSpellCandsList->Hide(ETrue);
       
   640 	iSpellCandsList->SetDropdownListImgID(compositionDrawInfo);
       
   641 
       
   642     TPoint candListLTPos = 
       
   643         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListCandsLTPos));
       
   644     // create candidate drop list
       
   645     iCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   646                                             ECtrlIdStdCandsList,
       
   647                                             R_AKN_FEP_NORMAL_CAND_DROP_DOWN_LIST,
       
   648                                             candListLTPos,
       
   649                                             TSize(unitWidth, unitHeight),
       
   650                                             5,
       
   651                                             3);
       
   652 
       
   653 
       
   654     iCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   655     iCandsList->SetFont(listfont);
       
   656     AddControlL(iCandsList);
       
   657     iCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   658     iCandsList->SetEventIdForNextPageCandidate(EItutCmdGetNextCandidatePage);
       
   659     iCandsList->SetEventIdForCandidateExisted(EItutCmdCandidateExisted);
       
   660     iCandsList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateAsEllipsis);        
       
   661     iCandsList->SetFuzzyBoundry(10);
       
   662     iCandsList->Hide(ETrue);
       
   663 	iCandsList->SetDropdownListImgID(candiDrawInfo);
       
   664 
       
   665     TPoint puncListLTPos = 
       
   666         TItutDataConverter::AnyToPoint(iDataMgr->RequestData(EDropdownListPuncLTPos));
       
   667     // create punctuation drop list
       
   668     iPuncCandsList = CFepCtrlDropdownList::NewL(iLayoutOwner,
       
   669                                                 ECtrlIdPuncCandsList,
       
   670                                                 R_AKN_FEP_PUNC_DROP_DOWN_LIST,
       
   671                                                 puncListLTPos,
       
   672                                                 TSize(unitWidth, unitHeight),
       
   673                                                 5,
       
   674                                                 1);
       
   675     iPuncCandsList->SetCellMargin(horizontalMargin, verticalMargin);
       
   676     iPuncCandsList->SetFont(listfont);
       
   677     AddControlL(iPuncCandsList);
       
   678     iPuncCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected);
       
   679 	iPuncCandsList->SetDropdownListImgID(candiDrawInfo);
       
   680     iPuncCandsList->Hide(ETrue);
       
   681     }
       
   682 
       
   683 // ---------------------------------------------------------------------------
       
   684 // CSplitItutWindow::ConstructIcfFromResourceL
       
   685 // ---------------------------------------------------------------------------
       
   686 //
       
   687 void CSplitItutWindow::ConstructIcfFromResourceL()
       
   688     {
       
   689     if (!iICF->ResourceId())
       
   690         {
       
   691         return;
       
   692         }
       
   693     
       
   694     TResourceReader icfreader;
       
   695     CCoeEnv::Static()->CreateResourceReaderLC(icfreader, iICF->ResourceId());
       
   696     TInt32 colorMajorSkinId = icfreader.ReadInt32();
       
   697     TInt skinitemid = icfreader.ReadInt16();
       
   698     TInt coloridx = icfreader.ReadInt16();
       
   699 
       
   700     TAknsItemID colorid;
       
   701     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   702 
       
   703     TRgb icftextcolor;
       
   704     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   705     TInt error = AknsUtils::GetCachedColor( skininstance, 
       
   706                                             icftextcolor, 
       
   707                                             colorid, 
       
   708                                             coloridx );
       
   709 
       
   710     if ( error != KErrNone )
       
   711         {
       
   712         icftextcolor = TRgb( KDefaultIcfTextColor );
       
   713         }
       
   714 
       
   715     iICF->SetTextColorL( icftextcolor );    
       
   716     
       
   717     // Set highlight color
       
   718     TRgb icfhightlightcolor;
       
   719     error = AknsUtils::GetCachedColor( skininstance, 
       
   720                                        icfhightlightcolor, 
       
   721                                        KAknsIIDQsnHighlightColors,
       
   722                                        EAknsCIQsnHighlightColorsCG2 ); 
       
   723     if ( error == KErrNone ) 
       
   724         {
       
   725         iICF->SetTextSelColorL( icfhightlightcolor );
       
   726         }
       
   727 
       
   728     skinitemid = icfreader.ReadInt16();
       
   729     coloridx = icfreader.ReadInt16();
       
   730     
       
   731     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   732     
       
   733     TRgb icfframecolor;
       
   734     error = AknsUtils::GetCachedColor(skininstance, 
       
   735                                       icfframecolor, 
       
   736                                       colorid, 
       
   737                                       coloridx);
       
   738 
       
   739     if ( error != KErrNone )
       
   740         {
       
   741     	icfframecolor = TRgb(KDefaultIcfFrameColor);
       
   742         }
       
   743 
       
   744     iICF->SetBorderColor( icfframecolor );
       
   745     CleanupStack::PopAndDestroy( 1 ); // icfreader
       
   746     }
       
   747  
       
   748  
       
   749 // ---------------------------------------------------------------------------
       
   750 // CSplitItutWindow::CreateICFL
       
   751 // ---------------------------------------------------------------------------
       
   752 //
       
   753 void CSplitItutWindow::CreateICFL()
       
   754     {
       
   755     CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont));
       
   756     TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESpellICFRect));
       
   757     
       
   758     // Create ICF
       
   759     iICF = CFepLayoutMultiLineIcf::NewL( rect, 
       
   760                                          iLayoutOwner, 
       
   761                                          ECtrlIdICF, 
       
   762                                          iDataMgr->iIcfTextHeight,
       
   763                                          icffont->FontMaxHeight(),
       
   764                                          icffont );
       
   765 
       
   766     iICF->SetFocus(ETrue);
       
   767     iICF->SetResourceId( R_SPLIT_ITUT_ICF );
       
   768     ConstructIcfFromResourceL();
       
   769     iICF->SetBgImgSkinId( KAknsIIDQgnGrafFepInputBg);
       
   770     
       
   771     AddControlL( iICF );
       
   772     
       
   773     // Set indicator parameters
       
   774     TAknWindowLineLayout iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
       
   775     TAknTextLineLayout iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
       
   776     
       
   777     iICF->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
   778     iICF->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   779     
       
   780     //Change the ID when ID into release
       
   781     iICF->MsgBubbleCtrl()->SetBitmapParam( NULL,
       
   782     									   NULL,
       
   783     									   KAknsIIDQsnFrInputPreviewSideL,
       
   784     									   KAknsIIDQsnFrInputPreviewMiddle,
       
   785     									   KAknsIIDQsnFrInputPreviewSideR );  
       
   786     iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   787     
       
   788     iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
       
   789     
       
   790     iICF->SetTextMargin( iDataMgr->iIcfTextLeftMargin,
       
   791             			 iDataMgr->iIcfTextRightMargin,
       
   792             			 iDataMgr->iIcfTextTopMargin,
       
   793             			 iDataMgr->iIcfTextBottomMargin );
       
   794             					  
       
   795     iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin );    					  
       
   796         	 
       
   797     SetIndiBubble();
       
   798     iICF->Hide( ETrue );
       
   799     }
       
   800  
       
   801     
       
   802 // ---------------------------------------------------------------------------
       
   803 // CSplitItutWindow::ConstructL
       
   804 // ---------------------------------------------------------------------------
       
   805 //
       
   806 void CSplitItutWindow::ConstructL()
       
   807     {
       
   808     iBmpRotator = CPeninputSyncBitmapRotator::NewL();
       
   809     CreateAllButtonL();
       
   810     CreateItutKeypadL();
       
   811     CreateICFL();
       
   812     }
       
   813 
       
   814 // ---------------------------------------------------------------------------
       
   815 // CSplitItutWindow::AddControlL
       
   816 // ---------------------------------------------------------------------------
       
   817 //
       
   818 void CSplitItutWindow::AddControlL(CFepUiBaseCtrl* aControl)
       
   819     {
       
   820     iLayoutOwner->AddControlL(aControl);   
       
   821     }
       
   822 
       
   823 // ---------------------------------------------------------------------------
       
   824 // CSplitItutWindow::CreateChineseSpecificCtrlsIfNeededL
       
   825 // ---------------------------------------------------------------------------
       
   826 //
       
   827 void CSplitItutWindow::CreateChineseSpecificCtrlsIfNeededL()
       
   828     {
       
   829     if (iChnCtrlInited)
       
   830         {
       
   831         return;
       
   832         }
       
   833 
       
   834     CreateDropdownListL();
       
   835     // create spell control for stroke/zhuyin
       
   836     TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESpellRect));
       
   837     iSpell = CFepInputContextField::NewL(rect, iLayoutOwner, ECtrlIdSpellICF);
       
   838 
       
   839     iSpell->SetResourceId(R_FINGER_SPELL);
       
   840     ConstructSpellCtrlFromResourceL();
       
   841 
       
   842     iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont)));
       
   843     AddControlL(iSpell); 
       
   844 
       
   845     iSpell->Hide(ETrue);
       
   846     
       
   847   
       
   848     iChnCtrlInited = ETrue;
       
   849     }
       
   850 
       
   851 // ---------------------------------------------------------------------------
       
   852 // CSplitItutWindow::ConstructSpellCtrlFromResourceL
       
   853 // ---------------------------------------------------------------------------
       
   854 //
       
   855 void CSplitItutWindow::ConstructSpellCtrlFromResourceL()
       
   856     {
       
   857     if (!iSpell || !iSpell->ResourceId())
       
   858         {
       
   859         return;
       
   860         }
       
   861 
       
   862     TResourceReader spellreader;
       
   863     CCoeEnv::Static()->CreateResourceReaderLC(spellreader, iSpell->ResourceId());
       
   864 
       
   865     TInt bgimgResId = spellreader.ReadInt32();
       
   866     TResourceReader bgreader;
       
   867     CCoeEnv::Static()->CreateResourceReaderLC(bgreader, bgimgResId);
       
   868 
       
   869     TInt bmpid = bgreader.ReadInt16();
       
   870     TInt maskbmpid = bgreader.ReadInt16();
       
   871     TInt bmpskinid = bgreader.ReadInt16();
       
   872 
       
   873     CFbsBitmap* bmp = NULL;
       
   874     CFbsBitmap* maskbmp = NULL;
       
   875     
       
   876     CreateLayoutIconL(KImageMajorSkinId,
       
   877                       bmpskinid,
       
   878                       KBmpFileName,
       
   879                       bmpid,
       
   880                       maskbmpid,
       
   881                       bmp,
       
   882                       maskbmp,
       
   883                       iSpell->Rect().Size());
       
   884 
       
   885     if (bmp)
       
   886         {
       
   887         iSpell->SetBackgroundBitmapL(bmp);
       
   888         }
       
   889         
       
   890     delete maskbmp;
       
   891 
       
   892     CleanupStack::PopAndDestroy( 1 ); // bgreader
       
   893 
       
   894     TInt colorMajorSkinId = spellreader.ReadInt32();
       
   895     TInt skinitemid= spellreader.ReadInt16();
       
   896     TInt coloridx = spellreader.ReadInt16();
       
   897 
       
   898     TAknsItemID colorid;
       
   899     colorid.Set(TInt(colorMajorSkinId), skinitemid);
       
   900 
       
   901     TRgb spelltextcolor;
       
   902     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
   903     TInt error = AknsUtils::GetCachedColor(skininstance, 
       
   904                                            spelltextcolor, 
       
   905                                            colorid, 
       
   906                                            coloridx);
       
   907 
       
   908     if (error != KErrNone)
       
   909         {
       
   910         spelltextcolor = TRgb(KDefaultSpellTextColor);
       
   911         }
       
   912 
       
   913     iSpell->SetTextColor(spelltextcolor);
       
   914 
       
   915     CleanupStack::PopAndDestroy( 1 ); // spellreader
       
   916     }
       
   917 
       
   918 
       
   919 // ---------------------------------------------------------------------------
       
   920 // CSplitItutWindow::PenInputType
       
   921 // ---------------------------------------------------------------------------
       
   922 //
       
   923 TInt CSplitItutWindow::PenInputType()
       
   924     {
       
   925     return EPluginInputModeItut;
       
   926     }
       
   927 
       
   928 // ---------------------------------------------------------------------------
       
   929 // CSplitItutWindow::SetCtrlRect
       
   930 // ---------------------------------------------------------------------------
       
   931 //
       
   932 void CSplitItutWindow::SetCtrlRect(CFepUiBaseCtrl* aCtrl, TInt aRectIdx, const TBool aOffset )
       
   933     {
       
   934     TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRectIdx));
       
   935     if(aOffset)
       
   936         {
       
   937         TPoint offset = TItutDataConverter::AnyToPoint(iDataMgr->RequestData(ELayoutOffset));
       
   938         rect.Move(offset);
       
   939         }
       
   940     aCtrl->SetRect(rect);
       
   941     }
       
   942 
       
   943 // ---------------------------------------------------------------------------
       
   944 // CSplitItutWindow::SizeChanged
       
   945 // ---------------------------------------------------------------------------
       
   946 //
       
   947 TInt CSplitItutWindow::SizeChanged()
       
   948     {
       
   949     // resize all controls
       
   950     SetCtrlRect(iStandardItutKp, EKeypadRect);
       
   951 
       
   952     iStandardItutKp->SetTextLineLayout(
       
   953         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
   954         EPosLeft);
       
   955     iStandardItutKp->SetTextLineLayout(
       
   956         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
   957         EPosRight1);
       
   958     iStandardItutKp->SetTextLineLayout(
       
   959         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
   960         EPosRight2);
       
   961     iStandardItutKp->SetTextLineLayout(
       
   962         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
   963         EPosRight3);
       
   964     
       
   965     RPointerArray<CVirtualKey>& keys = 
       
   966         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
   967     RArray<TRect>& cellRects = 
       
   968         TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
   969 
       
   970     for (TInt i = 0 ; i < keys.Count(); i++)
       
   971         {
       
   972         keys[i]->SetRect(cellRects[i]);
       
   973         TRect innerrect = cellRects[i];
       
   974         innerrect.Shrink(TSize(4, 4));
       
   975         keys[i]->SetInnerRect(innerrect);
       
   976         }
       
   977 	// set key background image size
       
   978 	TSize curSize = cellRects[0].Size();
       
   979 	if( iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal) )
       
   980 		{
       
   981 		TSize size = iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
   982 		if( curSize != size )	
       
   983 			{
       
   984 	        for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
   985 	            {
       
   986 	            if( iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
   987 	            	{
       
   988 	                AknIconUtils::SetSize( 
       
   989                                    iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
   990                                    curSize, EAspectRatioNotPreserved );                    		
       
   991 	            	}
       
   992 	            }	
       
   993 			}
       
   994 		}
       
   995 
       
   996     // should set textline when it is defined in laf
       
   997 	iBackgroundCtrl->SizeChanged( 
       
   998                          TItutDataConverter::AnyToRect(iDataMgr->RequestData( EBackgroundRect ) ) );								
       
   999 	
       
  1000     TRAP_IGNORE(ApplyVariantLafDataL(ETrue); 
       
  1001                 /*iLayoutOwner->HandleCommand(EItutExtCmdSizeChanged, NULL)*/);
       
  1002     
       
  1003     
       
  1004     if (iChnCtrlInited)
       
  1005         {
       
  1006         SetCtrlRect(iSpell, ESpellRect);
       
  1007         iSpell->SetFont(TItutDataConverter::AnyToFont(iDataMgr->RequestData(ESpellFont)));
       
  1008 
       
  1009         ResizeCandidateList(iSpellCandsList, EDropdownListSpellLTPos, ETrue);
       
  1010         ResizeCandidateList(iCandsList, EDropdownListCandsLTPos, ETrue);
       
  1011         ResizeCandidateList(iPuncCandsList, EDropdownListPuncLTPos, EFalse);
       
  1012         }
       
  1013 
       
  1014     return KErrNone;    
       
  1015     }
       
  1016 
       
  1017 // ---------------------------------------------------------------------------
       
  1018 // CSplitItutWindow::ControlSizeChanged
       
  1019 // ---------------------------------------------------------------------------
       
  1020 //
       
  1021 TBool CSplitItutWindow::ControlSizeChanged(const TInt aControlId, 
       
  1022                                             const TInt aRect, 
       
  1023                                             const TInt aInnerRect, 
       
  1024                                             TBool aIsReloadImages)
       
  1025     {
       
  1026     CAknFepCtrlCommonButton* temp = CommonButtonControl(aControlId);
       
  1027     if( !temp )
       
  1028     	return EFalse;
       
  1029     
       
  1030 
       
  1031     TRect rect;
       
  1032     TRect innerRect;
       
  1033     
       
  1034     rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aRect));
       
  1035 	innerRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(aInnerRect));
       
  1036     
       
  1037     TBool bSizedChanged = (rect.Size() != temp->Rect().Size()) && 
       
  1038     	    (innerRect.Size() != temp->ForgroundBmpRect().Size());
       
  1039     temp->SizeChanged(rect, innerRect, aIsReloadImages);   
       
  1040       
       
  1041     return bSizedChanged;
       
  1042     }
       
  1043 
       
  1044 // ---------------------------------------------------------------------------
       
  1045 // CSplitItutWindow::ApplyVariantLafDataL
       
  1046 // ---------------------------------------------------------------------------
       
  1047 //
       
  1048 void CSplitItutWindow::ApplyVariantLafDataL(TBool /*aResolutionChange*/)
       
  1049     {
       
  1050     if( iDataMgr->IsChinese() )
       
  1051         {
       
  1052  //       ControlSizeChanged(ECtrlIdArrowUp, EArrowUpRect, EUpInnerRect, ETrue);
       
  1053  //       ControlSizeChanged(ECtrlIdArrowDown, EArrowDownRect, EDownInnerRect, ETrue);
       
  1054         }
       
  1055     
       
  1056     TBool bSizeChanged = EFalse;       
       
  1057     ControlSizeChanged(ECtrlIdArrowLeft, EArrowLeftRect, ELeftInnerRect, ETrue);
       
  1058     ControlSizeChanged(ECtrlIdArrowRight, EArrowRightRect, ERightInnerRect, ETrue);
       
  1059     bSizeChanged = ControlSizeChanged(ECtrlIdBackspace, EBackspaceRect, EBackspaceInnerRect, ETrue);
       
  1060     ControlSizeChanged(ECtrlIdOptions, EOptionsRect, EOptionInnerRect, ETrue);
       
  1061     ControlSizeChanged(ECtrlIdClose, ECloseRect, ECloseInnerRect, ETrue);
       
  1062    						  	
       
  1063     // resize all controls
       
  1064     SetCtrlRect(iStandardItutKp, EKeypadRect); 
       
  1065     
       
  1066     // Handle control res when language direction changing here.
       
  1067     if( iDataMgr->IsLangDirectionSwitch() || 
       
  1068     	( bSizeChanged && iDataMgr->IsRtoLLanguage() ) )
       
  1069     	{
       
  1070     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );
       
  1071     	iDataMgr->SetLangDirectionSwitch( EFalse );	
       
  1072     	}   
       
  1073     }
       
  1074  
       
  1075 // ---------------------------------------------------------------------------
       
  1076 // CSplitItutWindow::ApplyVariantLafDataForSpellL
       
  1077 // ---------------------------------------------------------------------------
       
  1078 //
       
  1079 void CSplitItutWindow::ApplyVariantLafDataForSpellL()
       
  1080     {
       
  1081     TBool bSizeChanged = EFalse;       
       
  1082     ControlSizeChanged( ECtrlIdArrowLeft, EArrowLeftRect, ELeftInnerRect, ETrue );
       
  1083     ControlSizeChanged( ECtrlIdArrowRight, EArrowRightRect, ERightInnerRect, ETrue );
       
  1084     
       
  1085     bSizeChanged = ControlSizeChanged( ECtrlIdBackspace, ESpellBackSpcae, 
       
  1086     		                           ESpellBackSpcaeInner, ETrue );
       
  1087    						  	
       
  1088     // resize all controls
       
  1089     SetCtrlRect( iBackgroundCtrl, EBackgroundRect );
       
  1090     SetCtrlRect( iStandardItutKp, EKeypadRect, ETrue ); 
       
  1091     
       
  1092     // Handle control res when language direction changing here.
       
  1093     if ( iDataMgr->IsLangDirectionSwitch() || 
       
  1094     	( bSizeChanged && iDataMgr->IsRtoLLanguage()))
       
  1095     	{
       
  1096     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );
       
  1097     	iDataMgr->SetLangDirectionSwitch( EFalse );	
       
  1098     	}
       
  1099     
       
  1100     CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData( EIcfFont ));
       
  1101     iICF->Hide( ETrue ); 
       
  1102     iICF->SizeChangedL( TItutDataConverter::AnyToRect( iDataMgr->RequestData( ESpellICFRect )), 
       
  1103        	                iDataMgr->iIcfTextHeight,
       
  1104     	                icffont->FontMaxHeight(),
       
  1105     	                icffont );
       
  1106     iICF->Hide( EFalse );
       
  1107     }
       
  1108     
       
  1109 
       
  1110 // ---------------------------------------------------------------------------
       
  1111 // CSplitItutWindow::ResizeCandidateList
       
  1112 // ---------------------------------------------------------------------------
       
  1113 //
       
  1114 void CSplitItutWindow::ResizeCandidateList(CFepCtrlDropdownList* aList, 
       
  1115                                              TInt aLTPosIdx, TBool aExpandable)
       
  1116     {
       
  1117     if (!aList)
       
  1118         {
       
  1119         return;   
       
  1120         }
       
  1121     
       
  1122     TInt unitWidth = TItutDataConverter::AnyToInt(
       
  1123                         iDataMgr->RequestData(EDropdownlistUnitWidth));
       
  1124     TInt unitHeight = TItutDataConverter::AnyToInt(
       
  1125                         iDataMgr->RequestData(EDropdownlistUnitHeight));
       
  1126     TInt horizontalMargin = 
       
  1127         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistHorizontalMargin));
       
  1128     TInt verticalMargin = 
       
  1129         TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownlistVerticalMargin));
       
  1130     TInt naviWidth = TItutDataConverter::AnyToInt(
       
  1131                         iDataMgr->RequestData(EDropdownlistUnitWidth));
       
  1132     CFont* listfont = TItutDataConverter::AnyToFont(
       
  1133                         iDataMgr->RequestData(EDropdownListFont));
       
  1134     TPoint listLTPos = TItutDataConverter::AnyToPoint(iDataMgr->RequestData(aLTPosIdx));
       
  1135     
       
  1136     aList->SizeChanged(unitWidth, 
       
  1137                        unitHeight,
       
  1138                        naviWidth,
       
  1139                        listLTPos);
       
  1140 
       
  1141     aList->SetCellMargin(horizontalMargin, verticalMargin);
       
  1142     
       
  1143     if (aExpandable)
       
  1144         {
       
  1145         TInt naviSpinBtnHeight = 
       
  1146             TItutDataConverter::AnyToInt(iDataMgr->RequestData(EDropdownListSpinBtnHeight));
       
  1147         
       
  1148         aList->SetSpinBtnHeight(naviSpinBtnHeight);
       
  1149         }
       
  1150     }
       
  1151 
       
  1152 // ---------------------------------------------------------------------------
       
  1153 // CSplitItutWindow::OnSkinChange
       
  1154 // ---------------------------------------------------------------------------
       
  1155 //
       
  1156 void CSplitItutWindow::OnSkinChange()
       
  1157     {
       
  1158     // when skin change all control with skin image should be reload.
       
  1159     TRAP_IGNORE(ConstructKeyImageFromResourceL( R_ITUT_KEYPAD_BITMAP ));    
       
  1160     
       
  1161     // reconstruct shift icon when skin changed
       
  1162     TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ReConstructL());
       
  1163     TRAP_IGNORE(iStandardItutKp->ShiftIcon()->ResizeL(iDataMgr->iShiftIconRect.Size()));
       
  1164     
       
  1165     // reconstruct star icon when skin changed
       
  1166     TRAP_IGNORE(iStandardItutKp->StarIcon()->ReConstructL());
       
  1167     TRAP_IGNORE(iStandardItutKp->StarIcon()->ResizeL(iDataMgr->iStarIconRect.Size()));
       
  1168     
       
  1169     //Skin change will case the reconstuction of the button graphic.
       
  1170     //When language is RToL, it should be mirrored again.
       
  1171     if( iDataMgr->IsRtoLLanguage() )
       
  1172     	{
       
  1173     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );	
       
  1174     	}
       
  1175     }
       
  1176 
       
  1177 
       
  1178 // ---------------------------------------------------------------------------
       
  1179 // CSplitItutWindow::CalculateFrameRects
       
  1180 // ---------------------------------------------------------------------------
       
  1181 //
       
  1182 void CSplitItutWindow::CalculateFrameRects(const TRect aRect,
       
  1183 											 TRect& aOuterRect, 
       
  1184 											 TRect& aInnerRect )
       
  1185     {
       
  1186     TRect windowRect = aRect;
       
  1187     
       
  1188     TAknLayoutRect topLeft;
       
  1189     topLeft.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_2());
       
  1190 
       
  1191     TAknLayoutRect bottomRight;
       
  1192     bottomRight.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_5());
       
  1193 
       
  1194     aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
  1195     aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
  1196     }
       
  1197     
       
  1198 
       
  1199 // ---------------------------------------------------------------------------
       
  1200 // CSplitItutWindow::CommonButtonControl
       
  1201 // ---------------------------------------------------------------------------
       
  1202 //
       
  1203 CAknFepCtrlCommonButton* CSplitItutWindow::CommonButtonControl(const TInt aControlId)
       
  1204     {
       
  1205     CFepUiBaseCtrl* ctrl = NULL;
       
  1206     ctrl = Control(aControlId);
       
  1207     
       
  1208     if (!ctrl)
       
  1209         {
       
  1210         return NULL;   
       
  1211         }
       
  1212         
       
  1213     if (!ctrl->IsKindOfControl(ECtrlButton))
       
  1214     
       
  1215         {
       
  1216         return NULL;   
       
  1217         }
       
  1218         
       
  1219     return static_cast<CAknFepCtrlCommonButton*>(ctrl);
       
  1220     }
       
  1221 
       
  1222 
       
  1223 // ---------------------------------------------------------------------------
       
  1224 // CSplitItutWindow::Control
       
  1225 // ---------------------------------------------------------------------------
       
  1226 //
       
  1227 CFepUiBaseCtrl* CSplitItutWindow::Control(const TInt aCtrlId)
       
  1228     {
       
  1229     CFepUiBaseCtrl* ctrl = NULL;
       
  1230     RPointerArray<CFepUiBaseCtrl> todo;
       
  1231     TInt current = 0;
       
  1232     TBool found = EFalse;
       
  1233     
       
  1234     todo.Append(iLayoutOwner->RootControl());
       
  1235     CControlGroup* temp;
       
  1236     
       
  1237     while (current < todo.Count() && !found)
       
  1238         {
       
  1239         ctrl = todo[current];
       
  1240         
       
  1241         if(ctrl->ControlId() == aCtrlId) //Find control
       
  1242             {
       
  1243             found = ETrue;     
       
  1244             }
       
  1245         else
       
  1246             {
       
  1247             if(ctrl->IsKindOfControl(ECtrlControlGroup))
       
  1248                 {
       
  1249                 temp = static_cast<CControlGroup*>(ctrl);
       
  1250                 for (int i = 0; i < temp->NumOfControls(); i++)
       
  1251                     {
       
  1252                     todo.Append(temp->At(i));
       
  1253                     }
       
  1254                 }
       
  1255                 
       
  1256             current++;
       
  1257             }
       
  1258         }
       
  1259         
       
  1260     todo.Close();
       
  1261     
       
  1262     return found ? ctrl : NULL;
       
  1263     }      
       
  1264 
       
  1265 // ---------------------------------------------------------------------------
       
  1266 // CSplitItutWindow::IsChineseMode
       
  1267 // ---------------------------------------------------------------------------
       
  1268 //
       
  1269 TBool CSplitItutWindow::IsChineseMode()
       
  1270     {
       
  1271     TInt immode = iDataMgr->InputMode();
       
  1272     TBool chineseMode = EFalse;
       
  1273     
       
  1274     if (immode == EPinyin || immode == EStroke || immode == EZhuyin)
       
  1275         {
       
  1276         chineseMode = ETrue;
       
  1277         }
       
  1278     
       
  1279     return chineseMode;    
       
  1280     }
       
  1281 
       
  1282 // ---------------------------------------------------------------------------
       
  1283 // CSplitItutWindow::ConstructKeyImageFromResourceL
       
  1284 // ---------------------------------------------------------------------------
       
  1285 //
       
  1286 void CSplitItutWindow::ConstructKeyImageFromResourceL( TInt aKeyImageResID )
       
  1287 	{
       
  1288     TResourceReader reader;    
       
  1289     CCoeEnv::Static()->CreateResourceReaderLC( reader, aKeyImageResID );      
       
  1290     
       
  1291     TPtrC bmpFileName = reader.ReadTPtrC();
       
  1292     TInt32 imgMajorSkinId = reader.ReadInt32();
       
  1293     TAknsItemID id;
       
  1294     
       
  1295     RArray<TRect>& cellRects = 
       
  1296                      TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
  1297     TSize keySize = cellRects[0].Size();
       
  1298     for (TInt index = 0; index <= EKeyBmpLastType ; index += 2)
       
  1299         { 
       
  1300         // Get the image ids and mask ids from resource
       
  1301         TInt bmpId = reader.ReadInt16(); 
       
  1302         TInt bmpMskId = reader.ReadInt16();
       
  1303         
       
  1304         // read skin item id
       
  1305         const TInt skinitemid = reader.ReadInt16();
       
  1306         id.Set(TInt(imgMajorSkinId), skinitemid);
       
  1307         
       
  1308         if (bmpId != KInvalidBmp)
       
  1309             {
       
  1310         	CFbsBitmap* bmp = NULL;
       
  1311         	CFbsBitmap* maskbmp = NULL;
       
  1312 
       
  1313         	if (bmpMskId != KInvalidBmp)
       
  1314         		{
       
  1315         		AknsUtils::CreateIconL(AknsUtils::SkinInstance(),
       
  1316         		                       id,
       
  1317         		                       bmp,
       
  1318         		                       maskbmp,
       
  1319         		                       bmpFileName,
       
  1320         		                       bmpId,
       
  1321         		                       bmpMskId);
       
  1322         		
       
  1323        		    // set maskbmp and size
       
  1324        		    AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved );
       
  1325                 iStandardItutKp->SetNonIrregularKeyBitmapL(
       
  1326                 TVirtualKeyBmpType(EKeyBmpNormal + index + 1), maskbmp );
       
  1327                 }
       
  1328             else
       
  1329                 {
       
  1330         	    AknsUtils::CreateIconL(AknsUtils::SkinInstance(),
       
  1331         	                           id,
       
  1332         	                           bmp,
       
  1333         	                           bmpFileName,
       
  1334         	                           bmpId);
       
  1335                 }
       
  1336             // set bmp and size
       
  1337             AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved );
       
  1338            	iStandardItutKp->SetNonIrregularKeyBitmapL( 
       
  1339                                                  TVirtualKeyBmpType(EKeyBmpNormal + index), bmp );
       
  1340             }       
       
  1341         }
       
  1342     // Pop and destroy reader
       
  1343     CleanupStack::PopAndDestroy( 1 );		
       
  1344 	}
       
  1345 	
       
  1346 // ---------------------------------------------------------------------------
       
  1347 // CSplitItutWindow::HandleButtonResOnLangDirChange
       
  1348 // ---------------------------------------------------------------------------
       
  1349 //
       
  1350 void CSplitItutWindow::HandleButtonResOnLangDirChange( TInt aControlId )
       
  1351 	{
       
  1352     TRAP_IGNORE(HandleButtonResOnLangDirChangeL(aControlId));
       
  1353     }
       
  1354     
       
  1355 // ---------------------------------------------------------------------------
       
  1356 // CSplitItutWindow::HandleButtonResOnLangDirChangeL
       
  1357 // ---------------------------------------------------------------------------
       
  1358 //
       
  1359 void CSplitItutWindow::HandleButtonResOnLangDirChangeL( TInt aControlId )
       
  1360 	{
       
  1361 	CAknFepCtrlCommonButton* ctrl = CommonButtonControl(aControlId);
       
  1362 	if( ctrl && iBmpRotator)
       
  1363 		{
       
  1364 		TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis; 
       
  1365 		User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmp() ,
       
  1366 								  				 rotChoice ) );
       
  1367 		User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmpMask() ,
       
  1368 								  				 rotChoice ) );   								  
       
  1369 		}		
       
  1370 	}
       
  1371 
       
  1372 // ---------------------------------------------------------------------------
       
  1373 // CSplitItutWindow::SetHardKeyOneSymbol
       
  1374 // ---------------------------------------------------------------------------
       
  1375 //
       
  1376 void CSplitItutWindow::SetHardKeyOneSymbol(TUint8* aData)
       
  1377     {
       
  1378     TRAP_IGNORE(SetHardKeyOneSymbolL(aData));
       
  1379     }
       
  1380     
       
  1381 // ---------------------------------------------------------------------------
       
  1382 // CSplitItutWindow::SetHardKeyOneSymbolL
       
  1383 // ---------------------------------------------------------------------------
       
  1384 //
       
  1385 void CSplitItutWindow::SetHardKeyOneSymbolL(TUint8* aData)
       
  1386     {
       
  1387     //Read stream
       
  1388     RDesReadStream readStream;
       
  1389 
       
  1390     TPtr8 countPtr( aData, 3*sizeof(TInt), 3*sizeof(TInt) );            
       
  1391     readStream.Open(countPtr);
       
  1392     CleanupClosePushL(readStream);
       
  1393 
       
  1394     iSymbolData.iSymbol1 = readStream.ReadInt32L();
       
  1395     iSymbolData.iSymbol2 = readStream.ReadInt32L();
       
  1396     iSymbolData.iSymbol3 = readStream.ReadInt32L();
       
  1397     
       
  1398     CleanupStack::PopAndDestroy(&readStream);  
       
  1399     }
       
  1400 
       
  1401 // ---------------------------------------------------------------------------
       
  1402 // CSplitItutWindow::SetUnicodesForHardKey1
       
  1403 // ---------------------------------------------------------------------------
       
  1404 //
       
  1405 void CSplitItutWindow::SetUnicodesForHardKey1(CVirtualKey* aKey, const TDesC& aMapData)
       
  1406     {
       
  1407     TRAP_IGNORE(SetUnicodesForHardKey1L(aKey, aMapData));
       
  1408     }
       
  1409     
       
  1410 // ---------------------------------------------------------------------------
       
  1411 // CSplitItutWindow::SetUnicodesForHardKey1L
       
  1412 // ---------------------------------------------------------------------------
       
  1413 //
       
  1414 void CSplitItutWindow::SetUnicodesForHardKey1L(CVirtualKey* aKey, const TDesC& aMapData)
       
  1415     {
       
  1416     RPointerArray<HBufC> unicodesArr1;
       
  1417     RArray<TInt> unicodesInt;
       
  1418     
       
  1419     unicodesInt.Append(iSymbolData.iSymbol1);
       
  1420     unicodesInt.Append(iSymbolData.iSymbol2);
       
  1421     unicodesInt.Append(iSymbolData.iSymbol3);
       
  1422     
       
  1423     TInt curMode = TItutDataConverter::AnyToInt(
       
  1424             iLayoutOwner->DataMgr()->RequestData(EInputMode));
       
  1425     
       
  1426     TInt curLang = TItutDataConverter::AnyToInt(
       
  1427             iLayoutOwner->DataMgr()->RequestData(ELanguage));    
       
  1428     
       
  1429     TInt latinOnly = TItutDataConverter::AnyToInt(
       
  1430             iLayoutOwner->DataMgr()->RequestData(ELatinOnly));        
       
  1431     
       
  1432     HBufC* symbols = HBufC::NewL( 20 );
       
  1433     for (TInt i = 0; i <= 2; i++)
       
  1434         {
       
  1435         symbols->Des().Append( unicodesInt[i] );
       
  1436         if (EHindi == curMode ||
       
  1437                 (ELatin == curMode && curLang == ELangThai && !latinOnly))
       
  1438             {
       
  1439             continue;
       
  1440             }
       
  1441         else
       
  1442             {
       
  1443             symbols->Des().Append( KSpaceUnicode );
       
  1444             }
       
  1445         }
       
  1446     
       
  1447     HBufC* number = HBufC::NewL( 1 );
       
  1448     number->Des().Append( aMapData );
       
  1449     unicodesArr1.AppendL(number);
       
  1450     unicodesArr1.AppendL(symbols);
       
  1451     
       
  1452     aKey->SetUnicodesL(unicodesArr1);
       
  1453 
       
  1454     unicodesArr1.Close();
       
  1455     unicodesInt.Close();
       
  1456 
       
  1457     }
       
  1458 
       
  1459 void CSplitItutWindow::UpdateIndiBubbleL( TUint8* aData )
       
  1460     {  
       
  1461 	// if icf is hidden, not call updateindibubblel
       
  1462     if( iICF->Hiden() )     
       
  1463     	{
       
  1464         return;
       
  1465     	}
       
  1466     RDesReadStream readStream;
       
  1467     TFepIndicatorInfo indicatorData;
       
  1468 
       
  1469     TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) );            
       
  1470     readStream.Open(countPtr);
       
  1471     CleanupClosePushL(readStream);
       
  1472 
       
  1473     indicatorData.iIndicatorImgID = readStream.ReadInt32L();
       
  1474     indicatorData.iIndicatorMaskID = readStream.ReadInt32L();
       
  1475     indicatorData.iIndicatorTextImgID = readStream.ReadInt32L();
       
  1476     indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L();
       
  1477 
       
  1478     CleanupStack::PopAndDestroy(&readStream);
       
  1479 
       
  1480     if ( indicatorData.iIndicatorImgID != 0 && 
       
  1481          indicatorData.iIndicatorMaskID != 0 && 
       
  1482          indicatorData.iIndicatorTextImgID != 0 &&
       
  1483          indicatorData.iIndicatorTextMaskID != 0)
       
  1484         {
       
  1485         iDataMgr->SetIndicatorData( indicatorData );
       
  1486         iImDimensionSet = ETrue;
       
  1487 
       
  1488         SetIndiBubbleImageL( indicatorData.iIndicatorImgID,
       
  1489                              indicatorData.iIndicatorMaskID,
       
  1490                              indicatorData.iIndicatorTextImgID,
       
  1491                              indicatorData.iIndicatorTextMaskID );
       
  1492             
       
  1493 		TBuf<KTextLength> text;	
       
  1494         iICF->MsgBubbleCtrl()->GetText( text );
       
  1495         iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect());
       
  1496         }
       
  1497     }
       
  1498 
       
  1499 // ---------------------------------------------------------------------------
       
  1500 // CSplitItutWindow::CalIndicatorRect
       
  1501 // ---------------------------------------------------------------------------
       
  1502 //
       
  1503 void CSplitItutWindow::CalIndicatorRect(const TRect& aBoundRect,
       
  1504                                           TRect& aRealRect1,
       
  1505                                           TRect& aRealRect2,
       
  1506                                           TIndicatorAlign aAlign) 
       
  1507 	{
       
  1508 	if (!iImDimensionSet)
       
  1509 		{
       
  1510 		return;
       
  1511 		}
       
  1512 	
       
  1513 	TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight;
       
  1514 	TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight;
       
  1515     TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, 
       
  1516     			  	   aBoundRect.Size().iHeight );
       
  1517 	TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, 
       
  1518     			   			   aBoundRect.Size().iHeight );
       
  1519 	// check if the length of img > bound rect width
       
  1520 	TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth;
       
  1521 	if( nTotalWidth > aBoundRect.Size().iWidth )
       
  1522 		{
       
  1523 		TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth;
       
  1524 		imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect;
       
  1525 		imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth;
       
  1526 		imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText;
       
  1527 		// make sure the height of two rect is equal
       
  1528 		imgSizeIndi.iHeight = imgSizeText.iHeight;
       
  1529 		}
       
  1530 	if( aAlign == EIndiAlignRight )
       
  1531 		{
       
  1532     	aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY),
       
  1533     			   	   imgSizeText);
       
  1534 		aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
       
  1535 				       imgSizeIndi);
       
  1536 		}
       
  1537 	else if( aAlign == EIndiAlignCenter )
       
  1538 		{
       
  1539 		TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2;
       
  1540 		TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2;
       
  1541     	aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, 
       
  1542     							   aBoundRect.iTl.iY + offsetY),
       
  1543     			   	   	    imgSizeText );
       
  1544 		aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
       
  1545 				       imgSizeIndi );
       
  1546 		}
       
  1547 	else if( aAlign == EIndiAlignLeft )
       
  1548 		{
       
  1549 		aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi );
       
  1550 		aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText );
       
  1551 		}
       
  1552 	}
       
  1553 
       
  1554 // ---------------------------------------------------------------------------
       
  1555 // CSplitItutWindow::SetPromptTextL
       
  1556 // ---------------------------------------------------------------------------
       
  1557 //
       
  1558 void CSplitItutWindow::SetPromptTextL( TUint8* aData )
       
  1559     {
       
  1560     RDesReadStream readStream;
       
  1561 
       
  1562     TPtr8 countPtr( aData, 2*sizeof(TInt), 2*sizeof(TInt));
       
  1563 	readStream.Open(countPtr);
       
  1564 	CleanupClosePushL(readStream);
       
  1565     const TInt dataCount = readStream.ReadInt32L();
       
  1566 	const TInt textCount = readStream.ReadInt32L();
       
  1567     CleanupStack::PopAndDestroy(&readStream);
       
  1568     
       
  1569     TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount );            
       
  1570 	readStream.Open(ptr);
       
  1571 	CleanupClosePushL(readStream);
       
  1572 	
       
  1573 	HBufC8* dataBuf = HBufC8::NewLC(dataCount);
       
  1574 	TPtr8 dataBufPtr = dataBuf->Des();
       
  1575 	readStream.ReadL(dataBufPtr, dataCount);
       
  1576 
       
  1577     TFepPromptText* pIcfData = 
       
  1578     		reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1579 
       
  1580     HBufC* textBuf;
       
  1581     if ( textCount > 0 )
       
  1582         {
       
  1583         textBuf = HBufC::NewLC( textCount/2 );
       
  1584     	TPtr textBufPtr = textBuf->Des();
       
  1585     	readStream.ReadL( textBufPtr, textCount/2 );
       
  1586          
       
  1587         const HBufC* icfPromptText = iICF->PromptText();
       
  1588         
       
  1589         if (!icfPromptText || icfPromptText->Compare( textBuf->Des()) != 0 )
       
  1590         	{
       
  1591         	iICF->SetPromptTextL( textBuf->Des(), pIcfData->iCleanContent );	
       
  1592         	}
       
  1593         CleanupStack::PopAndDestroy( textBuf );
       
  1594         }
       
  1595     else
       
  1596         {
       
  1597         iICF->SetPromptTextL( KNullDesC, pIcfData->iCleanContent );
       
  1598         }
       
  1599 
       
  1600       CleanupStack::PopAndDestroy( dataBuf );
       
  1601 	  CleanupStack::PopAndDestroy( &readStream );
       
  1602     }
       
  1603 
       
  1604 // ---------------------------------------------------------------------------
       
  1605 // CSplitItutWindow::SetIndiBubbleImageL
       
  1606 // ---------------------------------------------------------------------------
       
  1607 //
       
  1608 void CSplitItutWindow::SetIndiBubbleImageL( const TInt aImgID1,
       
  1609                                             const TInt aMaskID1,
       
  1610                                             const TInt aImgID2,
       
  1611                                             const TInt aMaskID2 )
       
  1612     {
       
  1613     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
  1614 
       
  1615     CFbsBitmap* bmp1 = NULL;
       
  1616     CFbsBitmap* mask1 = NULL;
       
  1617     
       
  1618     TInt colorIndex = EAknsCIQsnIconColorsCG30;
       
  1619 
       
  1620     AknsUtils::CreateColorIconL( skininstance,
       
  1621                                  KAknsIIDQsnIconColors,
       
  1622                                  KAknsIIDQsnIconColors,
       
  1623                                  colorIndex,
       
  1624                                  bmp1,
       
  1625                                  mask1,
       
  1626                                  AknIconUtils::AvkonIconFileName(),
       
  1627                                  aImgID1,
       
  1628                                  aMaskID1,
       
  1629                                  KRgbGray );
       
  1630     CleanupStack::PushL( bmp1 );
       
  1631     CleanupStack::PushL( mask1 );
       
  1632                                 
       
  1633     AknIconUtils::GetContentDimensions( bmp1, iIndicatorSize );
       
  1634 
       
  1635     CFbsBitmap* bmp2 = NULL;
       
  1636     CFbsBitmap* mask2 = NULL;
       
  1637     AknsUtils::CreateColorIconL( skininstance,
       
  1638                                  KAknsIIDQsnIconColors,
       
  1639                                  KAknsIIDQsnIconColors,
       
  1640                                  colorIndex,
       
  1641                                  bmp2,
       
  1642                                  mask2,
       
  1643                                  AknIconUtils::AvkonIconFileName(),
       
  1644                                  aImgID2,
       
  1645                                  aMaskID2,
       
  1646                                  KRgbGray );
       
  1647  
       
  1648     CleanupStack::PushL( bmp2 );
       
  1649     CleanupStack::PushL( mask2 );
       
  1650     
       
  1651     AknIconUtils::GetContentDimensions( bmp2, iIndicatorTextSize );
       
  1652     
       
  1653     TRect boundRect;
       
  1654     boundRect = TItutDataConverter::AnyToRect(
       
  1655                 iDataMgr->RequestData( EIndiIconWithoutTextRect ));
       
  1656     
       
  1657     TRect imgrect, textrect;
       
  1658     
       
  1659     CalIndicatorRect( boundRect, imgrect, textrect, EIndiAlignCenter );
       
  1660     AknIconUtils::SetSize( bmp1, imgrect.Size(), EAspectRatioNotPreserved );
       
  1661     AknIconUtils::SetSize( mask1, imgrect.Size(), EAspectRatioNotPreserved );
       
  1662     AknIconUtils::SetSize( bmp2, textrect.Size(), EAspectRatioNotPreserved) ;
       
  1663     AknIconUtils::SetSize( mask2, textrect.Size(), EAspectRatioNotPreserved );
       
  1664 
       
  1665     CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256);
       
  1666     CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
       
  1667     
       
  1668     iICF->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, 
       
  1669                     KAknsIIDQsnFrInputPreviewSideL,
       
  1670                     KAknsIIDQsnFrInputPreviewMiddle,
       
  1671                     KAknsIIDQsnFrInputPreviewSideR );
       
  1672     
       
  1673     CleanupStack::PopAndDestroy( mask2 );
       
  1674     CleanupStack::PopAndDestroy( bmp2 );
       
  1675     CleanupStack::PopAndDestroy( mask1 );
       
  1676     CleanupStack::PopAndDestroy( bmp1 );
       
  1677     }
       
  1678 
       
  1679 // ---------------------------------------------------------------------------
       
  1680 // CSplitItutWindow::SetIndiBubble
       
  1681 // ---------------------------------------------------------------------------
       
  1682 //
       
  1683 void CSplitItutWindow::SetIndiBubble()
       
  1684     {
       
  1685     if ( iICF )
       
  1686         {
       
  1687         TRect bubbleRect = TItutDataConverter::AnyToRect( 
       
  1688                 iDataMgr->RequestData( EIndiPaneWithoutTextRect ));
       
  1689         TRect iconRect = TItutDataConverter::AnyToRect( 
       
  1690                 iDataMgr->RequestData( EIndiIconWithoutTextRect ));
       
  1691         
       
  1692         TSize offset;
       
  1693         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  1694         offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
       
  1695         TSize size( iconRect.Width(), iconRect.Height());
       
  1696         
       
  1697         iICF->MsgBubbleCtrl()->SetRect( bubbleRect );
       
  1698         iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
       
  1699         }
       
  1700     }
       
  1701 
       
  1702 // End Of File