textinput/peninputvkbkr/src/PeninputVkbKrWindow.cpp
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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:  peninput VKB data manager
       
    15 *
       
    16 */
       
    17 
       
    18 #include <PeninputVkbKrWindowConfigInfo_65.rsg>
       
    19 #include <PeninputVkbKrWindowKr.rsg>
       
    20 
       
    21 #include <aknlayoutscalable_apps.cdl.h>
       
    22 #include <AknLayoutScalable_Avkon.cdl.h>
       
    23 
       
    24 #include <e32keys.h>
       
    25 #include <S32MEM.h>
       
    26 #include <AknFepGlobalEnums.h>
       
    27 #include <AknFepPeninputEnums.h>
       
    28 #include <AknLayoutDef.h>
       
    29 #include <AknIconUtils.h>
       
    30 #include <AknUtils.h>
       
    31 #include <AknFontAccess.h> 
       
    32 
       
    33 #include <PeninputCommonLayoutGlobalEnum.h>
       
    34 #include <PeninputLayoutMultilineIcf.h>
       
    35 #include <PeninputLayoutContext.h>
       
    36 #include <PeninputInputContextField.h>
       
    37 #include <PeninputLayoutBubbleCtrl.h>
       
    38 #include <PeninputRangebar.h>
       
    39 #include <PeninputRangebarInfo.h>
       
    40 #include <PeninputClientLayoutInfo.h>
       
    41 #include <PeninputLayoutChoiceList.h>
       
    42 #include <PeninputLayoutInputmodeChoice.h>
       
    43 #include <PeninputLayoutBubbleCtrl.h>
       
    44 #include <PeninputLabel.h>
       
    45 
       
    46 #include <PeninputMultimodeButton.h>
       
    47 #include <PeninputEventButton.h>
       
    48 #include <PeninputDragButton.h>
       
    49 #include <PeninputRepeatButton.h>
       
    50 
       
    51 #include <PeninputDataConverter.h>
       
    52 #include <PeninputUiStatemgrInterface.h>
       
    53 
       
    54 #include "PeninputVkbKrDbg.h"
       
    55 #include "PeninputVkbKr.pan"
       
    56 #include "PeninputVkbKr.hrh"
       
    57 #include "PeninputVkbKrEnum.h"
       
    58 #include "PeninputVkbKrUiStateType.h"
       
    59 #include "PeninputVkbKrWindow.h"
       
    60 #include "peninputgenericvkblafdatamgr.h"
       
    61 
       
    62 _LIT( KWindowConfigurationResourceFile,
       
    63       "z:\\resource\\plugins\\PeninputVkbKrWindowConfigInfo_65.rsc" );
       
    64 _LIT( KWindowResourceFile,
       
    65       "z:\\resource\\plugins\\PeninputVkbKrWindowKr.rsc" );
       
    66 const TInt KInvalidImg = -1 ;
       
    67 const TInt KPeninputVkbWndInvalidIndex = -1;
       
    68 //const TUint32 KDefaultTextColor = 0x000000;
       
    69 //const TUint32 KDefaultShadowTextColor = 0x000000;
       
    70 
       
    71 struct TDummyRangeInfo // from CPeninputRangeInfo
       
    72     {
       
    73     
       
    74     void* vertual1;
       
    75 
       
    76     /**
       
    77      * Range id
       
    78      */
       
    79     TInt iRangeId;
       
    80     
       
    81     /**
       
    82      * Response style
       
    83      */
       
    84     TPeninputRangeResponseStyle iResponseStyle;
       
    85 
       
    86     /**
       
    87      * Client layout id
       
    88      */
       
    89     TInt iClientLayoutId;
       
    90 
       
    91     /**
       
    92      * Vkb layout id
       
    93      */
       
    94     TInt iVkbLayoutId;
       
    95 
       
    96     };
       
    97 
       
    98 struct TSymbolTableInfo
       
    99     {
       
   100     TInt iVkbLayoutId;
       
   101     TInt iClientLayoutId;
       
   102     };
       
   103 
       
   104 const TSymbolTableInfo sSymbolTableInfo[] = 
       
   105     {
       
   106         {EPeninputVkbLayoutSymbol1,EPeninputClientLayout11x4},
       
   107         {EPeninputVkbLayoutSymbol2,EPeninputClientLayout11x4},
       
   108         {EPeninputVkbLayoutSymbol3,EPeninputClientLayout11x4},
       
   109         {EPeninputVkbLayoutSymbol4,EPeninputClientLayoutMacroChars},
       
   110         {EPeninputVkbLayoutSymbol5,EPeninputClientLayoutMacroChars},
       
   111     };
       
   112 
       
   113 const TInt KMaxSymbolTable = sizeof(sSymbolTableInfo)/sizeof(TSymbolTableInfo);
       
   114 
       
   115 namespace SymbolTableUtil
       
   116     {
       
   117     
       
   118     LOCAL_C TInt FindIndex(TInt aVkbLayoutId)
       
   119         {
       
   120         TInt ret(KErrNotFound);
       
   121         for (TInt i=0;i<KMaxSymbolTable;i++)
       
   122             {
       
   123             if (aVkbLayoutId==sSymbolTableInfo[i].iVkbLayoutId)
       
   124                 {
       
   125                 ret=i;
       
   126                 break;
       
   127                 }
       
   128             }
       
   129         return ret;
       
   130         }
       
   131 
       
   132     LOCAL_C TInt GetClientLaytoutFor(TInt aVkbLayoutId)
       
   133         {
       
   134         TInt ret(0);
       
   135         TInt index(FindIndex(aVkbLayoutId));
       
   136         if (index!=KErrNotFound)
       
   137             {
       
   138             ret=sSymbolTableInfo[index].iClientLayoutId;
       
   139             }
       
   140         return ret;
       
   141         }
       
   142     
       
   143     LOCAL_C TInt GetNextVkbLayout(TInt aVkbLayoutId)
       
   144         {
       
   145         TInt ret(aVkbLayoutId);
       
   146         TInt index=FindIndex(aVkbLayoutId);
       
   147         if (index!=KErrNotFound)
       
   148             {
       
   149             index=(index+1)%KMaxSymbolTable;
       
   150             ret=sSymbolTableInfo[index].iVkbLayoutId;
       
   151             }
       
   152         return ret;
       
   153         }
       
   154     
       
   155     LOCAL_C TInt GetPrevVkbLayout(TInt aVkbLayoutId)
       
   156         {
       
   157         TInt ret(aVkbLayoutId);
       
   158         TInt index=FindIndex(aVkbLayoutId);
       
   159         if (index!=KErrNotFound)
       
   160             {
       
   161             index=(index+KMaxSymbolTable-1)%KMaxSymbolTable;
       
   162             ret=sSymbolTableInfo[index].iVkbLayoutId;
       
   163             }
       
   164         return ret;
       
   165         }
       
   166     }
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // Constructor & Destructor
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 
       
   173 CPeninputVkbKrWindow* CPeninputVkbKrWindow::NewLC(
       
   174         CFepUiLayout* aUiLayout, 
       
   175         MPeninputLayoutContext* aLayoutContext,
       
   176         MPeninputUiStateMgr* aUiStateMgr)
       
   177     {
       
   178     CPeninputVkbKrWindow* self = 
       
   179         new (ELeave) CPeninputVkbKrWindow(aUiLayout,aLayoutContext,aUiStateMgr);
       
   180     CleanupStack::PushL(self);
       
   181     self->ConstructL();
       
   182     return self;
       
   183     }
       
   184 
       
   185 CPeninputVkbKrWindow* CPeninputVkbKrWindow::NewL(
       
   186         CFepUiLayout* aUiLayout, 
       
   187         MPeninputLayoutContext* aLayoutContext,
       
   188         MPeninputUiStateMgr* aUiStateMgr)
       
   189     {
       
   190     CPeninputVkbKrWindow* self = 
       
   191         CPeninputVkbKrWindow::NewLC(aUiLayout,aLayoutContext,aUiStateMgr);
       
   192     CleanupStack::Pop(); // self;
       
   193     return self;
       
   194     }
       
   195 
       
   196 CPeninputVkbKrWindow::CPeninputVkbKrWindow(
       
   197         CFepUiLayout* aUiLayout, 
       
   198         MPeninputLayoutContext* aLayoutContext,
       
   199         MPeninputUiStateMgr* aUiStateMgr)
       
   200     : CPeninputLayoutWindowExt(aUiLayout,aLayoutContext),
       
   201       iUiStateMgr(aUiStateMgr),
       
   202       iTableUpButton(NULL),
       
   203       iTableDownButton(NULL),
       
   204       iTablePageLabel(NULL),
       
   205       iFirstConstruct(ETrue),
       
   206       iPopupSet(EFalse),
       
   207       iPopupInited(EFalse)
       
   208     {
       
   209     // No implementation required
       
   210     }
       
   211 
       
   212 void CPeninputVkbKrWindow::ConstructL()
       
   213     {
       
   214     CPeninputLayoutWindowExt::ConstructL();
       
   215     iLafMgr = CPeninputGenericVkbLafMgr::NewL();
       
   216     iLafMgr->SetInputModeL(TPluginInputMode(iLayoutContext->LayoutType()));
       
   217     TInt option(iLafMgr->OptionType());
       
   218     option|=EOption3CellRange;
       
   219     iLafMgr->SetLafOption((TPeninputVkbLafOption)option);  
       
   220     }
       
   221 
       
   222 CPeninputVkbKrWindow::~CPeninputVkbKrWindow()
       
   223     {
       
   224     delete iLafMgr;
       
   225     delete iIdle;
       
   226     }
       
   227 
       
   228 // ---------------------------------------------------------------------------
       
   229 // from CPeninputLayoutWindow
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 
       
   233 void CPeninputVkbKrWindow::HandleControlEvent(
       
   234         TInt aEventType,
       
   235         CFepUiBaseCtrl* aCtrl, 
       
   236         const TDesC& aEventData )
       
   237     {
       
   238     TInt* data = ( TInt* ) aEventData.Ptr(); 
       
   239     // Call this function in base class
       
   240     
       
   241     if (aEventType==EPeninputLayoutEventRange)
       
   242         {
       
   243         PreProcessRange(*data);
       
   244         }
       
   245     
       
   246     CPeninputLayoutWindowExt::HandleControlEvent(
       
   247         aEventType, 
       
   248         aCtrl, 
       
   249         aEventData );
       
   250     
       
   251     switch ( aEventType )
       
   252         {   
       
   253         case EPeninputLayoutVkbEventResetShift: 
       
   254             {
       
   255             HandleShiftBtnClicked();
       
   256             }
       
   257             break;  
       
   258         case EPenInputLayoutEventClosePopup:
       
   259             {
       
   260             if ( iPopupWnd && !iPopupWnd->Hiden() )
       
   261                 {
       
   262                 iPopupWnd->CloseWindow();
       
   263                 ResetAccentButton();
       
   264                 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
       
   265                 }
       
   266             }
       
   267             break;
       
   268         case EPeninputLayoutEventOpen:
       
   269         case EPeninputLayoutEventRange:
       
   270             {
       
   271             UpdateArea( Rect(), ETrue );
       
   272             }
       
   273             break;
       
   274         case EEventChoiceSelected:
       
   275             {
       
   276             CFepLayoutChoiceList::SEvent* event = 
       
   277                 ( CFepLayoutChoiceList::SEvent* ) aEventData.Ptr();
       
   278 
       
   279             if ( event->iIndex != KPeninputVkbWndInvalidIndex )
       
   280                 {
       
   281                 if (aCtrl->ControlId() == EPeninutWindowCtrlIdAccentPopupWindow)
       
   282                     {
       
   283                     TInt currentRange = CPeninputDataConverter::AnyToInt(
       
   284                                       iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
       
   285                     TInt currentAccent = CPeninputDataConverter::AnyToInt(
       
   286                                       iLayoutContext->RequestData(EPeninputDataTypeCurrentAccent));
       
   287                 
       
   288                     if ((currentRange == ERangeAccent) && (currentAccent == event->iIndex))
       
   289                         {
       
   290                         iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
       
   291                         return;
       
   292                         }
       
   293 
       
   294                     iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &(event->iIndex));
       
   295                                          
       
   296                     // Active range, update rangebar and vkb layout
       
   297                     //ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * event->iIndex);
       
   298                     /*
       
   299                     (currentRange == ERangeAccent) ? ChangeRange(ERangeAccent, 
       
   300                                        EPeninputVkbLayoutAccented1 + 2 * event->iIndex, EFalse) :
       
   301                                                      ChangeRange(ERangeAccent, 
       
   302                                        EPeninputVkbLayoutAccented1 + 2 * event->iIndex, ETrue);
       
   303                     */
       
   304                     }
       
   305                 else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow)
       
   306                     {
       
   307                     if (iLayoutContext->LayoutType() != event->iCommand)
       
   308                         {
       
   309                         TBool switchByMode = ETrue;
       
   310                         TInt  mode = event->iCommand;
       
   311 
       
   312                         TBuf<8> buf;
       
   313                         buf.Append(reinterpret_cast<TText*>(&switchByMode), 
       
   314                                                             sizeof(TBool)/sizeof(TText));
       
   315                         buf.Append(reinterpret_cast<TText*>(&mode), sizeof(TInt)/sizeof(TText));
       
   316                         UiLayout()->SignalOwner(ESignalLayoutUIChanged,buf);
       
   317                         }
       
   318                     }
       
   319                 }
       
   320             else
       
   321                 {
       
   322                 ResetAccentButton();   
       
   323                 }
       
   324             iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
       
   325             }
       
   326             break;
       
   327         case EPeninputLayoutEventToHwr:
       
   328             {
       
   329             TRAP_IGNORE(UpdateICFTextL());
       
   330             TRAP_IGNORE(PopupSwitchWindowL());
       
   331             }
       
   332             break;
       
   333         case EPeninputLayoutVkbEventTableUp:
       
   334             if (IsSymbolRange())
       
   335                 {
       
   336                 TInt curVkbLayout = CPeninputDataConverter::AnyToInt(
       
   337                     iLayoutContext->RequestData(EPeninputDataTypeVkbLayout));
       
   338                 TInt prevVkbLayout=SymbolTableUtil::GetPrevVkbLayout(curVkbLayout);
       
   339                 TRAP_IGNORE( FakeClientLayoutUpdateL(prevVkbLayout));
       
   340                 ChangeRange(ERangeSymbol,prevVkbLayout);
       
   341                 }
       
   342             break;
       
   343         case EPeninputLayoutVkbEventTableDown:
       
   344             if (IsSymbolRange())
       
   345                 {
       
   346                 TInt curVkbLayout = CPeninputDataConverter::AnyToInt(
       
   347                     iLayoutContext->RequestData(EPeninputDataTypeVkbLayout));
       
   348                 TInt nextVkbLayout=SymbolTableUtil::GetNextVkbLayout(curVkbLayout);
       
   349                 TRAP_IGNORE( FakeClientLayoutUpdateL(nextVkbLayout));
       
   350                 ChangeRange(ERangeSymbol,nextVkbLayout);
       
   351                 }
       
   352             break;
       
   353         default:
       
   354             break;
       
   355         }
       
   356     }
       
   357 
       
   358 
       
   359 TInt CPeninputVkbKrWindow::GetWindowConfigResId()
       
   360     {
       
   361     return R_PENINPUT_LAYOUT_CONFIG_INFO;
       
   362     }
       
   363 
       
   364 TInt CPeninputVkbKrWindow::GetWindowResId()
       
   365     {
       
   366     if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
   367         {
       
   368         return R_PENINPUT_LAYOUT_FSQ_WINDOW_INFO;
       
   369         }
       
   370     return R_PENINPUT_LAYOUT_VKB_WINDOW_INFO;        
       
   371     }
       
   372 
       
   373 TInt CPeninputVkbKrWindow::GetNumKeymappingResId()
       
   374     {
       
   375     return R_PENINPUT_LAYOUT_KEY_MAPPING_STRING_LIST;
       
   376     }
       
   377 
       
   378 const TDesC& CPeninputVkbKrWindow::GetWindowConfigResFileName( TInt /*aLangID*/ )
       
   379     {
       
   380     return KWindowConfigurationResourceFile();
       
   381     }
       
   382 
       
   383 const TDesC& CPeninputVkbKrWindow::GetWindowResFileName()
       
   384     {
       
   385     return KWindowResourceFile();
       
   386     }
       
   387 
       
   388 const TRect CPeninputVkbKrWindow::ChangeUnitSize()
       
   389     {
       
   390     return TRect();
       
   391     }
       
   392 
       
   393 void CPeninputVkbKrWindow::ChangeClientSize()
       
   394     {
       
   395     LOG("Vkb.Window.ChangeClientSize");
       
   396     if ( !iPopupWnd->Hiden() )
       
   397         {
       
   398         iPopupWnd->CloseWindow();
       
   399         ResetAccentButton();
       
   400         iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
       
   401         }
       
   402         
       
   403     PopupWindowSizeChange();
       
   404 
       
   405     TInt clientLayoutId = CPeninputDataConverter::AnyToInt
       
   406         ( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) );
       
   407     CPeninputClientLayoutInfo* clientLayout = 
       
   408         ConfigInfo()->FindClientLayoutInfo( clientLayoutId );
       
   409 
       
   410     if ( clientLayout )
       
   411         {
       
   412         ReorganizeControls( clientLayout->LayoutID(), EFalse );
       
   413         } 
       
   414 
       
   415     TRect rect=iVkbCtrl->Rect();
       
   416     LOG2("Vkb.Window.ChangeClientSize %d %d",rect.Width(),rect.Height());
       
   417     UpdateArea( iVkbCtrl->Rect(), EFalse );
       
   418     }
       
   419 
       
   420 void CPeninputVkbKrWindow::CreateAllControlsL()
       
   421     {
       
   422     //LOG("Vkb.Window.CreateAllControlsL");
       
   423     CFepLayoutMultiLineIcf* icf = 
       
   424         static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF));
       
   425     
       
   426     iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
       
   427     iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
       
   428     
       
   429     icf->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
   430     icf->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   431     //Change the ID when ID into release
       
   432     icf->MsgBubbleCtrl()->SetBitmapParam(
       
   433         NULL,
       
   434         NULL,
       
   435         KAknsIIDQsnFrInputPreviewSideL,
       
   436         KAknsIIDQsnFrInputPreviewMiddle,
       
   437         KAknsIIDQsnFrInputPreviewSideR);  
       
   438     
       
   439     /* Teleca change begin, 20.05.2008 ssal */									  
       
   440     icf->InfoBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
   441     icf->InfoBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   442     //Change the ID when ID into release
       
   443     icf->InfoBubbleCtrl()->SetBitmapParam(NULL,
       
   444     									  NULL,
       
   445     									  KAknsIIDQsnFrInputPreviewSideL,
       
   446     									  KAknsIIDQsnFrInputPreviewMiddle,
       
   447     									  KAknsIIDQsnFrInputPreviewSideR);
       
   448     /* Teleca change end, 20.05.2008 ssal */
       
   449     
       
   450     if (iLayoutContext->LayoutType() == EPluginInputModeFSQ)
       
   451         {
       
   452         icf->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   453          /* Teleca change begin, 20.05.2008 ssal */
       
   454         icf->SetInfoBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   455         /* Teleca change end, 20.05.2008 ssal */
       
   456         }
       
   457         
       
   458     // Range bar
       
   459     iRangeBar = CAknFepCtrlRangeBar::NewL(
       
   460         UiLayout(),
       
   461         EPeninutWindowCtrlIdRangeBar, 
       
   462         //CAknFepCtrlRangeBar::EBtnGroupHorizontal );
       
   463         CAknFepCtrlRangeBar::EBtnGroupVertical );
       
   464 
       
   465     // Set event id    
       
   466     iRangeBar->SetEventIdForRange( EPeninputLayoutEventRange );
       
   467     iRangeBar->SetEventIdForCase( EPeninputLayoutEventRangeLoop );
       
   468 
       
   469     AddControlL( iRangeBar );
       
   470     iRangeBar->AddEventObserver((MEventObserver*)UiLayout());    
       
   471 
       
   472     // Vkb control
       
   473     iVkbCtrl = CPeninputVkbCtrlExt::NewL( 
       
   474         TRect(), 
       
   475         UiLayout(), 
       
   476         EPeninutWindowCtrlIdVkbCtrl, 
       
   477         NULL  );
       
   478     iVkbCtrl->SetResourceId( 
       
   479         R_PENINPUT_LAYOUT_VKB_KEYBOARD );
       
   480     iVkbCtrl->ConstructFromResourceL();
       
   481     iVkbCtrl->SetKeyTextColorGroup( 
       
   482         EAknsCIQsnTextColorsCG68 );
       
   483     iVkbLayout->SetVkbKeyboard( iVkbCtrl );
       
   484     if (iLayoutContext->LayoutType() != EPluginInputModeFSQ)
       
   485         {
       
   486         iVkbCtrl->SetIrregularKeyBoard(ETrue);
       
   487         iVkbLayout->SetIrregularResourceId(R_AKN_FEP_VKB_IRREGULAR_BITMAP);
       
   488         iVkbLayout->ConstructFromIrregularResourceL();
       
   489         }
       
   490     else
       
   491         {
       
   492         iVkbCtrl->SetIrregularKeyBoard(EFalse);
       
   493         iVkbLayout->SetNonIrregularResourceId(R_AKN_FEP_VKB_NONIRREGULAR_BITMAP);
       
   494         iVkbLayout->ConstructFromNonIrregularResourceL();        
       
   495         }
       
   496 
       
   497     // Add bubble support
       
   498     iVkbCtrl->ShowBubble(ETrue);    
       
   499     iVkbCtrl->SetGowithPointerDown(ETrue);
       
   500     iVkbCtrl->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview);  //Change the ID when ID into release
       
   501     
       
   502                                         
       
   503     AddControlL( iVkbCtrl );
       
   504     iVkbCtrl->AddEventObserver( UiLayout() );
       
   505     
       
   506     AddButtonL( EPeninutWindowCtrlIdEnterBtn, 
       
   507                 EPeninputLayoutEventEnter, 
       
   508                 R_PENINPUT_LAYOUT_VKB_ENTER, 
       
   509                 EKeyEnter );
       
   510 
       
   511     // Shift and capslock merged button
       
   512 
       
   513     CAknFepCtrlMultiModeButton* button = 
       
   514         CAknFepCtrlMultiModeButton::NewLC( UiLayout(), 
       
   515                                            EPeninutWindowCtrlIdShiftBtn );
       
   516     if ( button )
       
   517         {
       
   518         // Read resource
       
   519         TResourceReader reader;
       
   520         
       
   521         CCoeEnv::Static()->CreateResourceReaderLC( reader,
       
   522                            R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK );  
       
   523         button->SetResourceId( R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK );      
       
   524         button->ConstructFromResourceL();  
       
   525         
       
   526         // Pop and destroy reader
       
   527         CleanupStack::PopAndDestroy( 1 );
       
   528         
       
   529         // Add into the control pool                                                   
       
   530         AddControlL( button );
       
   531         
       
   532         button->AddEventObserver( UiLayout() );
       
   533         }
       
   534     CleanupStack::Pop( button );  
       
   535     // Space button          
       
   536     CAknFepCtrlEventButton* spaceButton = static_cast<CAknFepCtrlEventButton*>
       
   537                                                    (Control(EPeninutWindowCtrlIdSpaceBtn));
       
   538     // Create 3-pieces color icon for space button
       
   539     CPenInput3PiecesColorIcons* colorIcons = 
       
   540                 CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
       
   541                                                   R_AKN_FEP_VKB_SPACE_ICON2,
       
   542                                                   R_AKN_FEP_VKB_SPACE_ICON3 );
       
   543     spaceButton->Set3PiecesColorIcons( colorIcons );
       
   544     
       
   545     // Switch to hwr button  
       
   546     AddButtonL( EPeninutWindowCtrlIdSwitchToHwrBtn, 
       
   547                 EPeninputLayoutEventToHwr, 
       
   548                 R_PENINPUT_LAYOUT_VKB_HWR );
       
   549                   
       
   550     // Add popup window
       
   551     //AddPopupWindowL();
       
   552     iPopupWnd = CPeninputCommonChoiceList::NewL( UiLayout(), 
       
   553                     EPeninutWindowCtrlIdAccentPopupWindow,
       
   554                     KAknsIIDQsnFrList,
       
   555                     KAknsIIDQsnFrPopupSub );
       
   556     
       
   557         
       
   558    
       
   559     iPopupWnd->AddEventObserver( UiLayout() );
       
   560     
       
   561     AddControlL( iPopupWnd );
       
   562     iIdle = CIdle::NewL(CActive::EPriorityIdle );
       
   563     iIdle ->Start(TCallBack(BackgroundTaskL,this));
       
   564     }
       
   565 
       
   566 void CPeninputVkbKrWindow::SetControlsFont()
       
   567     {
       
   568     //LOG("Vkb.Window.SetControlsFont");
       
   569     }
       
   570 
       
   571 void CPeninputVkbKrWindow::PopupChoiceList()
       
   572     {
       
   573     LOG("Vkb.Window.PopupChoiceList");
       
   574     }
       
   575 
       
   576 void CPeninputVkbKrWindow::ReorganizeControls( 
       
   577         TInt aClientLayoutId,
       
   578         TBool aNeedReset )
       
   579     {
       
   580     LOG("Vkb.Window.ReorganizeControls");
       
   581     CPeninputClientLayoutInfo* clientLayout = 
       
   582         ConfigInfo()->FindClientLayoutInfo( aClientLayoutId ); 
       
   583     RPointerArray<CPeninputControlInfo>& controlList = 
       
   584         clientLayout->ControlInfoList();
       
   585   
       
   586     const TInt keyColumns = clientLayout->Columns();
       
   587     const TInt keyRows = clientLayout->Rows();
       
   588     
       
   589     if( iLastUsedTotalColumns == keyColumns &&
       
   590         iLastUsedTotalRows == keyRows )
       
   591         {
       
   592         return;
       
   593         }    
       
   594 
       
   595     iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(keyRows,keyColumns));
       
   596     
       
   597     iLastUsedTotalColumns = keyColumns;
       
   598     iLastUsedTotalRows = keyRows;
       
   599     
       
   600     TRect winRect( Rect().iTl, iLafMgr->EntirePaneRect().Size());
       
   601         
       
   602     SetWindowRect(winRect);  
       
   603     ReorgnizeTitleBar();
       
   604     ReorgnizeTableUpDown();
       
   605     
       
   606     const TInt count = controlList.Count();
       
   607     TInt controlID = 0;
       
   608     CFepUiBaseCtrl* ctrl = NULL;
       
   609     TRect rect;
       
   610     TRect inRect;
       
   611     TRect exRect;
       
   612 
       
   613     TPoint winPoint = Rect().iTl;
       
   614     TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
       
   615     
       
   616     TInt x = winPoint.iX - LafPoint.iX;
       
   617     TInt y = winPoint.iY - LafPoint.iY;
       
   618 
       
   619     if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
   620         {
       
   621         x = 0;
       
   622         y = 0;
       
   623         }
       
   624         
       
   625         
       
   626     for ( TInt i = 0; i < count; i++ )
       
   627         {
       
   628         controlID = controlList[i]->ControlID();
       
   629         ctrl = Control( controlID );
       
   630 
       
   631         if ( ctrl )
       
   632             { 
       
   633             AddNotOwnedControl( ctrl );
       
   634             if ( ( ctrl->ControlType() | ECtrlButton ) == ECtrlButton )
       
   635                 {
       
   636                 
       
   637                 iLafMgr->GetButtonRect(TPeninputCommonCtrlID(ctrl->ControlId()),exRect ,inRect);
       
   638                 
       
   639                 exRect.Move(x, y);
       
   640                 inRect.Move(x, y);
       
   641                 if( controlID ==  EPeninutWindowCtrlIdShiftBtn)
       
   642                     {
       
   643                     ( static_cast<CAknFepCtrlMultiModeButton*> (ctrl) )->
       
   644                         SizeChanged( exRect, inRect, ETrue );                                           
       
   645                     }
       
   646                 else
       
   647                     {
       
   648                     if (TPeninputCommonCtrlID(ctrl->ControlId()) == EPeninutWindowCtrlIdSpaceBtn)
       
   649                         {
       
   650                         // config 3 pieces icon info       
       
   651                         TRect iconsFrameRect, middleIconRect;
       
   652                         iLafMgr->GetSpaceButtonExLayoutInfo( iconsFrameRect, middleIconRect );
       
   653                         iconsFrameRect.Move( x, y );
       
   654                         middleIconRect.Move( x, y );
       
   655                         inRect = iconsFrameRect;
       
   656                         
       
   657                         ( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SetDraw3PieceFrameInfo(
       
   658                                                           TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
       
   659                                                           KAknsIIDQgnIndiInputSpaceMiddle,
       
   660                                                           KAknsIIDQgnIndiInputSpaceR,
       
   661                                                           middleIconRect));                     
       
   662                         }
       
   663                     ( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SizeChanged( exRect, 
       
   664                                                                                  inRect, 
       
   665                                                                                  ETrue );
       
   666                     }
       
   667                 }
       
   668             else if ( ctrl->ControlId() == EPeninutWindowCtrlIdVkbCtrl )
       
   669                 {
       
   670                 iVkbCtrl->SetFont( iLafMgr->KeyTextFont() );
       
   671                 iVkbCtrl->SetTextLineLayout( iLafMgr->KeyTextLayout() );
       
   672                 iVkbCtrl->SetTextFormat( iLafMgr->KeyTextLayout() );  //Read laf 
       
   673                 if (aNeedReset)
       
   674                     {
       
   675                     iVkbCtrl->Reset();
       
   676                     }
       
   677     
       
   678                 rect = iLafMgr->KeypadRect();
       
   679                 
       
   680                 rect.Move(x, y);
       
   681 
       
   682                 ( static_cast<CPeninputVkbCtrlExt*> (ctrl) )->SizeChanged(rect);
       
   683                 }
       
   684                 
       
   685             else if ( ctrl->ControlId() == EPeninutWindowCtrlIdRangeBar )
       
   686                 {
       
   687                 TRAP_IGNORE(SetRangeBarSizeL(x, y));
       
   688                 }
       
   689             }
       
   690         }    
       
   691     }
       
   692 
       
   693 void CPeninputVkbKrWindow::DoCaseChange( TInt aNewCase )
       
   694     {
       
   695     LOG1("Vkb.Window.DoCaseChange %d",aNewCase);
       
   696     TInt curCase = CPeninputDataConverter::AnyToInt
       
   697         ( iLayoutContext->RequestData( EPeninputDataTypeCase ) );            
       
   698     
       
   699     if ( aNewCase == curCase )
       
   700         {
       
   701         return;
       
   702         }
       
   703         
       
   704     TInt curRange = CPeninputDataConverter::AnyToInt
       
   705         ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); 
       
   706         
       
   707     TInt latchFlag = CPeninputDataConverter::AnyToInt
       
   708                      (iLayoutContext->RequestData(EAkninputDataTypeLatchedSet));
       
   709                             
       
   710     if ( latchFlag == 0 && (( curRange == ERangeAccent ) || ( ( curRange == ERangeEnglish ) 
       
   711             || ( ( curRange == ERangeNative ) && ( ConfigInfo()->CaseSensitive()) ) ) ) )
       
   712         {
       
   713         // Set shift and caplock button
       
   714         TInt shift;  
       
   715         TInt capslock;  
       
   716         
       
   717         CPeninputDataConverter::ShiftCapslockByCase( aNewCase, 
       
   718             shift, capslock );
       
   719         
       
   720         iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shift );
       
   721         //ChangeButtonStatus( shfit, EPeninutWindowCtrlIdShiftBtn );          
       
   722         iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock );        
       
   723         //ChangeButtonStatus( capslock, EPeninutWindowCtrlIdCapslockBtn );
       
   724         iLayoutContext->SetData( EPeninputDataTypeCase, &aNewCase ); 
       
   725         ChangeMergedButtonStatus( shift, capslock );
       
   726         
       
   727         TRAP_IGNORE( iRangeBar->SetCaseL( curRange, aNewCase ) );
       
   728         
       
   729         TInt vkblayout = ConfigInfo()->ShiftCapsSingleVkbLayoutByCase
       
   730             ( curRange, aNewCase );
       
   731 
       
   732         if ( curRange == ERangeAccent ) 
       
   733            {
       
   734            TInt curAccentIndex = CPeninputDataConverter::AnyToInt
       
   735                ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
       
   736                  vkblayout = vkblayout + curAccentIndex * 2;
       
   737            }
       
   738         
       
   739         ChangeVkbLayout( vkblayout );
       
   740         }
       
   741     }
       
   742 
       
   743 TBool CPeninputVkbKrWindow::CreateCustomControlL( TInt16 aControlId, TInt32 aImageId )
       
   744     {
       
   745     //LOG2("Vkb.Window.CreateCustomControlL %d %d",aControlId,aImageId);
       
   746     TBool create = ETrue;
       
   747     switch ( aControlId )
       
   748         {
       
   749         case EPeninutWindowCtrlIdMoveBtn:
       
   750             {
       
   751             if ( !iMoveButton )
       
   752                 {
       
   753                 iMoveButton = CAknFepCtrlDragButton::NewL(UiLayout(), EPeninutWindowCtrlIdMoveBtn);
       
   754                 AddControlL(iMoveButton);
       
   755                 iMoveButton->AddPositionObserver(this);
       
   756                 iMoveButton->AddEventObserver( UiLayout() );
       
   757                 iMoveButton->SetResourceId( aImageId );
       
   758                 iMoveButton->SetImageFrameId(KAknsIIDQsnFrFunctionButtonNormal,
       
   759                                               KAknsIIDQsnFrFunctionButtonPressed,
       
   760                                               KAknsIIDQsnFrFunctionButtonInactive);
       
   761                 UiLayout()->EnableLayoutMoving( static_cast<CDragBar*>( iMoveButton ) );
       
   762                 }
       
   763             iMoveButton->ConstructFromResourceL();
       
   764             }
       
   765             break;
       
   766         case EPeninupWindowCtrlIdArrowLeftBtn:
       
   767             {
       
   768             if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
       
   769                 {
       
   770                 break;
       
   771                 }
       
   772 
       
   773             if (!iArrowLeftButton)
       
   774                 {
       
   775                 
       
   776                 iArrowLeftButton = CAknFepCtrlRepeatButton::NewL( 
       
   777                     UiLayout(), aControlId, EPeninputLayoutEventLeftArrow, EKeyLeftArrow, 
       
   778                                                   KAknsIIDQsnFrFunctionButtonNormal,
       
   779                                                   KAknsIIDQsnFrFunctionButtonPressed,
       
   780                                                   KAknsIIDQsnFrFunctionButtonInactive );
       
   781 
       
   782                 AddControlL(iArrowLeftButton);
       
   783                 iArrowLeftButton->AddEventObserver(UiLayout());
       
   784                 iArrowLeftButton->SetResourceId( aImageId );
       
   785                 }
       
   786 
       
   787             iArrowLeftButton->ConstructFromResourceL();
       
   788             }
       
   789             break;
       
   790         case EPeninupWindowCtrlIdArrowRightBtn:
       
   791             {
       
   792             if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
       
   793                 {
       
   794                 break;
       
   795                 }
       
   796 
       
   797             if (!iArrowRightButton)
       
   798                 {
       
   799                 iArrowRightButton = CAknFepCtrlRepeatButton::NewL( 
       
   800                     UiLayout(), aControlId, EPeninputLayoutEventRightArrow, EKeyRightArrow, 
       
   801                                                   KAknsIIDQsnFrFunctionButtonNormal,
       
   802                                                   KAknsIIDQsnFrFunctionButtonPressed,
       
   803                                                   KAknsIIDQsnFrFunctionButtonInactive );
       
   804 
       
   805                 AddControlL(iArrowRightButton);
       
   806                 iArrowRightButton->AddEventObserver(UiLayout());
       
   807                 iArrowRightButton->SetResourceId( aImageId );
       
   808 
       
   809                 }
       
   810             iArrowRightButton->ConstructFromResourceL();
       
   811             }
       
   812             break;
       
   813             
       
   814         case EPeninutVkbCtrlIdSymbolTableUp:
       
   815             {
       
   816             if (!iTableUpButton)
       
   817                 {
       
   818                 
       
   819                 iTableUpButton = CAknFepCtrlRepeatButton::NewL( 
       
   820                     UiLayout(), aControlId, EPeninputLayoutVkbEventTableUp, EKeyPageUp, 
       
   821                                                   KAknsIIDQsnFrFunctionButtonNormal,
       
   822                                                   KAknsIIDQsnFrFunctionButtonPressed,
       
   823                                                   KAknsIIDQsnFrFunctionButtonInactive );
       
   824 
       
   825                 AddControlL(iTableUpButton);
       
   826                 iTableUpButton->AddEventObserver(UiLayout());
       
   827                 iTableUpButton->SetResourceId( aImageId );
       
   828                 }
       
   829 
       
   830             iTableUpButton->ConstructFromResourceL();
       
   831             }
       
   832             break;
       
   833         case EPeninutVkbCtrlIdSymbolTableDown:
       
   834             {
       
   835             if (!iTableDownButton)
       
   836                 {
       
   837                 iTableDownButton = CAknFepCtrlRepeatButton::NewL( 
       
   838                     UiLayout(), aControlId, EPeninputLayoutVkbEventTableDown, EKeyPageDown, 
       
   839                                                   KAknsIIDQsnFrFunctionButtonNormal,
       
   840                                                   KAknsIIDQsnFrFunctionButtonPressed,
       
   841                                                   KAknsIIDQsnFrFunctionButtonInactive );
       
   842 
       
   843                 AddControlL(iTableDownButton);
       
   844                 iTableDownButton->AddEventObserver(UiLayout());
       
   845                 iTableDownButton->SetResourceId( aImageId );
       
   846 
       
   847                 }
       
   848             iTableDownButton->ConstructFromResourceL();
       
   849             }
       
   850             break;
       
   851         case EPeninutVkbCtrlIdSymbolTablePageLabel:
       
   852             {
       
   853             if (!iTablePageLabel)
       
   854                 {
       
   855                 /*
       
   856                 iTablePageLabel=CAknFepCtrlCommonButton::NewL(
       
   857                     UiLayout(),
       
   858                     aControlId,
       
   859                     KAknsIIDQsnFrFunctionButtonNormal,
       
   860                     KAknsIIDQsnFrFunctionButtonPressed,
       
   861                     KAknsIIDQsnFrFunctionButtonInactive);
       
   862                 */
       
   863                 iTablePageLabel=CAknFepCtrlEventButton::NewL(
       
   864                     UiLayout(),
       
   865                     aControlId,
       
   866                     0xFFFF,
       
   867                     0,
       
   868                     KAknsIIDQsnFrFunctionButtonInactive,
       
   869                     KAknsIIDQsnFrFunctionButtonInactive,
       
   870                     KAknsIIDQsnFrFunctionButtonInactive);
       
   871                 AddControlL(iTablePageLabel);
       
   872                 iTablePageLabel->AddEventObserver(UiLayout());
       
   873                 iTablePageLabel->Hide(EFalse);
       
   874                 }
       
   875             }
       
   876             break;
       
   877         default:
       
   878             {
       
   879             create = EFalse;
       
   880             }
       
   881         }
       
   882     return create;
       
   883     }
       
   884 
       
   885 void CPeninputVkbKrWindow::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl)
       
   886     {
       
   887     //LOG("Vkb.Window.AddCustomControlGroupL");
       
   888     AddControlL(aCtrl);
       
   889     }
       
   890 
       
   891 void CPeninputVkbKrWindow::SetVkbLayoutSize()
       
   892     {
       
   893     TInt vkbLayoutid = CPeninputDataConverter::AnyToInt
       
   894         ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
       
   895     CPeninputVkbLayoutInfo* vkbLayout = 
       
   896         ConfigInfo()->FindVkbLayoutInfo( vkbLayoutid );
       
   897 
       
   898     TRect outrect,innerrect;   
       
   899     iLafMgr->GetPreviewWndRect(outrect,innerrect);
       
   900     
       
   901     if (SymbolTableUtil::GetClientLaytoutFor(vkbLayoutid)==EPeninputClientLayoutMacroChars)
       
   902         {
       
   903         TInt widthOutrect=outrect.Width();
       
   904         TInt widthInnerrect=innerrect.Width();
       
   905         outrect.SetWidth(widthOutrect*3);
       
   906         innerrect.SetWidth(widthInnerrect*3);
       
   907         }
       
   908     
       
   909     iVkbCtrl->SetTextFormat(iLafMgr->PreviewWndText());  //Read laf 
       
   910     iVkbCtrl->SetBubbleSize(TSize(outrect.Width(),outrect.Height()));  // Read laf
       
   911     iVkbCtrl->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX,
       
   912                            innerrect.iTl.iY - outrect.iTl.iY,
       
   913                            outrect.iBr.iX - innerrect.iBr.iX,
       
   914                            outrect.iBr.iY - innerrect.iBr.iY);
       
   915     
       
   916     // Calculate current vkblayout according current layout
       
   917     if ( vkbLayout )
       
   918         {
       
   919         const TInt columns = vkbLayout->Columns();
       
   920         const TInt rows = vkbLayout->Rows();
       
   921         TRect keyRect;
       
   922         TRect charRect;
       
   923         
       
   924         //iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(rows,columns));
       
   925         
       
   926  
       
   927         for (TInt exter = 0; exter < rows; exter ++)
       
   928             {
       
   929             for (TInt inter = 0; inter < columns; inter ++ )
       
   930                 {
       
   931                 iLafMgr->GetKeyRect(inter,exter, keyRect, charRect);
       
   932                 vkbLayout->SetKeyInfo(exter,inter,keyRect,charRect,iLafMgr->KeyTextFont());
       
   933                 }
       
   934             }
       
   935      
       
   936         if ( iVkbCtrl->IsIrregularKeyBoard() )
       
   937             {
       
   938             TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
       
   939             TSize size = iVkbCtrl->IrregularKeyBitmap(EKeyLeftDown,
       
   940                                                       EKeyStateNormal)->SizeInPixels();
       
   941             if ( curSize != size )
       
   942                 {
       
   943                 for ( TInt i = 0; i <= EKeyRightUp; i++ )
       
   944                     {
       
   945                     for ( TInt j = 0; j <= EKeyStateDimmedMask; j++ )
       
   946                         {
       
   947                         AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
       
   948                             (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), 
       
   949                              curSize, EAspectRatioNotPreserved ); 
       
   950                             
       
   951                         AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
       
   952                             (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), 
       
   953                              curSize, EAspectRatioNotPreserved );
       
   954                         }
       
   955                     }
       
   956                 }
       
   957             }
       
   958         else
       
   959             {
       
   960             TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
       
   961             TSize size = iVkbCtrl->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
   962             if( curSize != size )   
       
   963                 {
       
   964                 for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
   965                     {
       
   966                     if( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
   967                         {
       
   968                         AknIconUtils::SetSize( 
       
   969                                            iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
   970                                            curSize, EAspectRatioNotPreserved );
       
   971                         }
       
   972                     }
       
   973                 }
       
   974             }
       
   975         }
       
   976     }
       
   977 
       
   978 void CPeninputVkbKrWindow::ConstructFromResourceL()
       
   979     {               
       
   980     CPeninputLayoutWindowExt::ConstructFromResourceL();
       
   981     if( iVkbLayout && !iFirstConstruct )
       
   982         {
       
   983         if( iVkbCtrl->IsIrregularKeyBoard() )       
       
   984             iVkbLayout->ConstructFromIrregularResourceL();
       
   985         else
       
   986             iVkbLayout->ConstructFromNonIrregularResourceL();
       
   987         SetVkbLayoutSize();
       
   988         }
       
   989     iFirstConstruct = EFalse;
       
   990     }
       
   991 
       
   992 // ---------------------------------------------------------------------------
       
   993 // Internal Functions
       
   994 // ---------------------------------------------------------------------------
       
   995 //
       
   996 
       
   997 void CPeninputVkbKrWindow::SetRangeBarSizeL(TInt x, TInt y)
       
   998     {
       
   999     TRect exRect; 
       
  1000     exRect = iLafMgr->RangbarRect();
       
  1001     exRect.Move(x, y);
       
  1002     // Get range bar display cell rects
       
  1003     TRect rect, innerRect;
       
  1004     RArray<TRect> displayCellRects, dispalyCellInnerRects;
       
  1005     CleanupClosePushL( displayCellRects );
       
  1006     CleanupClosePushL( dispalyCellInnerRects );
       
  1007     for( TInt i = 0; i < iLafMgr->RangbarCellCount(); i++ )
       
  1008         {
       
  1009         iLafMgr->RangbarCellAt( i, rect, innerRect );
       
  1010         rect.Move(x, y);
       
  1011         displayCellRects.AppendL( rect );
       
  1012         innerRect.Move(x, y);
       
  1013         dispalyCellInnerRects.AppendL( innerRect );                 
       
  1014         }
       
  1015     iRangeBar->SetDispalyCellRectsL( displayCellRects, dispalyCellInnerRects );
       
  1016     CleanupStack::PopAndDestroy(2);
       
  1017     iRangeBar->SizeChanged( exRect );
       
  1018     }
       
  1019 
       
  1020 CAknFepCtrlEventButton* CPeninputVkbKrWindow::AddButtonL( 
       
  1021     const TInt aControlId, const TInt aEventId, const TInt aResId, 
       
  1022     const TInt aUnicode, const TBool aIsRepeat )
       
  1023     {
       
  1024     CAknFepCtrlEventButton* button = NULL;
       
  1025     
       
  1026     if ( aIsRepeat )
       
  1027         {
       
  1028         button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId, 
       
  1029             aEventId, aUnicode );
       
  1030         }
       
  1031     else
       
  1032         {
       
  1033         button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId, 
       
  1034             aEventId, aUnicode,
       
  1035               KAknsIIDQsnFrFunctionButtonNormal,
       
  1036               KAknsIIDQsnFrFunctionButtonPressed,
       
  1037               KAknsIIDQsnFrFunctionButtonInactive );
       
  1038         }
       
  1039         
       
  1040     CleanupStack::PushL( button );  
       
  1041     if ( button )
       
  1042         {
       
  1043         // Read resource
       
  1044         TResourceReader reader;
       
  1045         
       
  1046         CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );  
       
  1047         button->SetResourceId( aResId );      
       
  1048         button->ConstructFromResourceL();  
       
  1049         // Pop and destroy reader
       
  1050         CleanupStack::PopAndDestroy( 1 );
       
  1051         
       
  1052         // Add into the control pool                                                   
       
  1053         AddControlL( button );
       
  1054         button->AddEventObserver(UiLayout());
       
  1055         
       
  1056         }
       
  1057     CleanupStack::Pop( button );  
       
  1058           
       
  1059     return button;
       
  1060     }
       
  1061 
       
  1062 void CPeninputVkbKrWindow::ReorgnizeTitleBar()
       
  1063     {
       
  1064     TRect rect;
       
  1065     
       
  1066     TPoint winPoint = Rect().iTl;
       
  1067     TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
       
  1068     
       
  1069     TInt x = winPoint.iX - LafPoint.iX;
       
  1070     TInt y = winPoint.iY - LafPoint.iY;    
       
  1071     if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
  1072         {
       
  1073         x = 0;
       
  1074         y = 0;
       
  1075         }
       
  1076         
       
  1077     TRect inRect;
       
  1078     TRect exRect;
       
  1079     
       
  1080    
       
  1081     rect = iLafMgr->ICFRect();
       
  1082     rect.Move(x, y);
       
  1083     
       
  1084     CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
       
  1085                                   (Control(EPeninputWindowCtrlIdMultiLineICF));
       
  1086 
       
  1087     const CFont* icfFont = iLafMgr->ICFTextFont();
       
  1088     
       
  1089     // set icf margin
       
  1090     TPeninputICFConfig icfConfig;
       
  1091     iLafMgr->GetICFConfig( icfConfig );
       
  1092     icf->SetTextMargin( icfConfig.iLeftMargin,
       
  1093                         icfConfig.iRightMargin,
       
  1094                         icfConfig.iTopMargin,
       
  1095                         0 );                
       
  1096     icf->SetLineSpace( icfConfig.iLineSpaceMargin );
       
  1097     TRAP_IGNORE(icf->SizeChangedL( 
       
  1098                 rect, 
       
  1099                 icfConfig.iTextLineHeight,
       
  1100                 icfFont->FontMaxHeight(),
       
  1101                 icfFont));
       
  1102 
       
  1103     
       
  1104     iLafMgr->GetButtonRect(EPeninutWindowCtrlIdOptionBtn,exRect ,inRect);
       
  1105     exRect.Move(x, y); 
       
  1106     inRect.Move(x, y);
       
  1107     static_cast<CAknFepCtrlEventButton*>
       
  1108         ( Control( EPeninutWindowCtrlIdOptionBtn ) )->SizeChanged( exRect, inRect, ETrue );
       
  1109 
       
  1110     iLafMgr->GetButtonRect(EPeninutWindowCtrlIdCloseBtn,exRect ,inRect);
       
  1111     exRect.Move(x, y); 
       
  1112     inRect.Move(x, y);
       
  1113     static_cast<CAknFepCtrlCommonButton*>
       
  1114         ( Control( EPeninutWindowCtrlIdCloseBtn ) )->SizeChanged( exRect, inRect, ETrue );
       
  1115 
       
  1116     iLafMgr->GetButtonRect(EPeninutWindowCtrlIdBackspaceBtn,exRect ,inRect);
       
  1117     exRect.Move(x, y); 
       
  1118     inRect.Move(x, y);
       
  1119     
       
  1120     // Check size change of bk button, need for mirroring when arabic
       
  1121     CAknFepCtrlCommonButton* bkBtn = static_cast<CAknFepCtrlCommonButton*>
       
  1122         ( Control( EPeninutWindowCtrlIdBackspaceBtn ) );
       
  1123     TBool bBKSizeChanged = EFalse;
       
  1124     if( exRect.Size() != bkBtn->Rect().Size() &&
       
  1125         inRect.Size() != bkBtn->ForgroundBmpRect().Size() )
       
  1126         {
       
  1127         bBKSizeChanged = ETrue;
       
  1128         }
       
  1129     bkBtn->SizeChanged( exRect, inRect, bBKSizeChanged );
       
  1130 
       
  1131 
       
  1132     iLafMgr->GetButtonRect(EPeninutWindowCtrlIdSpaceBtn,exRect ,inRect);
       
  1133     inRect = exRect;
       
  1134     inRect.Shrink(10, 0);
       
  1135     
       
  1136     exRect.Move(x, y); 
       
  1137     inRect.Move(x, y);
       
  1138     static_cast<CAknFepCtrlCommonButton*>
       
  1139         ( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SizeChanged( exRect, inRect, ETrue );
       
  1140         
       
  1141     TRect spaceIconRect = inRect;
       
  1142     spaceIconRect.Shrink(10, 0);
       
  1143     static_cast<CAknFepCtrlCommonButton*>
       
  1144         ( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SetDraw3PieceFrameInfo(
       
  1145                       TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
       
  1146                                                                   KAknsIIDQgnIndiInputSpaceMiddle,
       
  1147                                                                   KAknsIIDQgnIndiInputSpaceR,
       
  1148                                                                   spaceIconRect));
       
  1149 
       
  1150     if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
  1151         {
       
  1152         iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowLeftBtn,exRect ,inRect);
       
  1153         exRect.Move(x, y); 
       
  1154         inRect.Move(x, y);
       
  1155         iArrowLeftButton->SizeChanged( exRect, inRect, ETrue );
       
  1156         
       
  1157         iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowRightBtn,exRect ,inRect);
       
  1158         exRect.Move(x, y);
       
  1159         inRect.Move(x, y); 
       
  1160         iArrowRightButton->SizeChanged( exRect, inRect, ETrue );
       
  1161         }
       
  1162     else
       
  1163         {
       
  1164         iLafMgr->GetButtonRect(EPeninutWindowCtrlIdMoveBtn,exRect ,inRect);
       
  1165         exRect.Move(x, y); 
       
  1166         inRect.Move(x, y);
       
  1167         static_cast<CAknFepCtrlDragButton*>
       
  1168             ( Control( EPeninutWindowCtrlIdMoveBtn ) )->SizeChanged( exRect, inRect, ETrue );
       
  1169         }    
       
  1170 
       
  1171     }
       
  1172 
       
  1173 void CPeninputVkbKrWindow::ReorgnizeTableUpDown()
       
  1174     {
       
  1175     TPoint winPoint = Rect().iTl;
       
  1176     TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
       
  1177     
       
  1178     TRect inRect;
       
  1179     TRect exRect;
       
  1180     
       
  1181     TInt x = winPoint.iX - LafPoint.iX;
       
  1182     TInt y = winPoint.iY - LafPoint.iY;    
       
  1183     
       
  1184     iLafMgr->GetButtonRect(
       
  1185         (TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTableUp,
       
  1186         exRect ,
       
  1187         inRect);
       
  1188     exRect.Move(x, y); 
       
  1189     inRect.Move(x, y);
       
  1190     if (exRect.IsEmpty())
       
  1191         {
       
  1192         iTableUpButton->Hide(ETrue);
       
  1193         }
       
  1194     else
       
  1195         {
       
  1196         iTableUpButton->Hide(EFalse);
       
  1197         iTableUpButton->SizeChanged( exRect, inRect, ETrue );
       
  1198         iTableUpButton->Draw();        
       
  1199         }
       
  1200 
       
  1201     iLafMgr->GetButtonRect(
       
  1202         (TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTablePageLabel,
       
  1203         exRect ,
       
  1204         inRect);
       
  1205     exRect.Move(x, y);
       
  1206     inRect.Move(x, y); 
       
  1207     
       
  1208     /* for CButtonBase
       
  1209     TRgb color( KRgbBlack );  // sane default for nonskinned case
       
  1210     AknsUtils::GetCachedColor( 
       
  1211         AknsUtils::SkinInstance(),
       
  1212         color,
       
  1213         KAknsIIDQsnTextColors,
       
  1214         EAknsCIQsnTextColorsCG59);
       
  1215     iTablePageLabel->SetCaptionColor(color);
       
  1216     TFontStyle style;
       
  1217     CFbsFont* font=AknFontAccess::GetClosestFont(
       
  1218         *BitmapDevice(),
       
  1219         style,
       
  1220         BitmapDevice()->VerticalPixelsToTwips(exRect.Height()/3),
       
  1221         AknFontAccess::EAknFontFamilyNotSpecified);
       
  1222     iTablePageLabel->SetFont(font);
       
  1223     */
       
  1224     /* for Common
       
  1225     TAknTextLineLayout layout=iLafMgr->KeyTextLayout();
       
  1226     layout.iFont=ELatinPlain12;
       
  1227     iTablePageLabel->SetTextFormat(layout);
       
  1228     iTablePageLabel->SetTextColorIndex(EAknsCIQsnTextColorsCG59);
       
  1229     */
       
  1230     /*
       
  1231     TAknTextLineLayout langSwitch;
       
  1232     TAknTextLineLayout langSwitchShadow;
       
  1233     langSwitch = 
       
  1234         AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine();
       
  1235     langSwitchShadow = 
       
  1236         AknLayoutScalable_Avkon::cell_vkb_side_pane_t1_copy1().LayoutLine();
       
  1237     iTablePageLabel->SetFont(AknLayoutUtils::FontFromId(langSwitch.iFont, NULL));
       
  1238     iTablePageLabel->SetShadowFont(AknLayoutUtils::FontFromId(langSwitchShadow.iFont, NULL));
       
  1239     */
       
  1240     TAknTextLineLayout langSwitch;
       
  1241     TAknTextLineLayout langSwitchShadow;
       
  1242     langSwitch = 
       
  1243         AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine();
       
  1244     TAknTextLineLayout layout=iLafMgr->KeyTextLayout();
       
  1245     
       
  1246     if (iLayoutContext->LayoutType()==EPluginInputModeVkb)
       
  1247         {
       
  1248         layout.iFont=langSwitch.iFont;        
       
  1249         }
       
  1250     iTablePageLabel->SetTextFormat(layout);
       
  1251     iTablePageLabel->SetTextColorIndex(EAknsCIQsnTextColorsCG59);
       
  1252     
       
  1253     if (exRect.IsEmpty())
       
  1254         {
       
  1255         iTablePageLabel->Hide(ETrue);
       
  1256         }
       
  1257     else
       
  1258         {
       
  1259         iTablePageLabel->Hide(EFalse);
       
  1260         iTablePageLabel->SizeChanged( exRect, inRect, ETrue );
       
  1261         iTablePageLabel->Draw();
       
  1262         }
       
  1263 
       
  1264     iLafMgr->GetButtonRect(
       
  1265         (TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTableDown,
       
  1266         exRect ,
       
  1267         inRect);
       
  1268     exRect.Move(x, y);
       
  1269     inRect.Move(x, y); 
       
  1270     if (exRect.IsEmpty())
       
  1271         {
       
  1272         iTableDownButton->Hide(ETrue);
       
  1273         }
       
  1274     else
       
  1275         {
       
  1276         iTableDownButton->Hide(EFalse);
       
  1277         iTableDownButton->SizeChanged( exRect, inRect, ETrue );
       
  1278         iTableDownButton->Draw();
       
  1279         }
       
  1280     
       
  1281     TRect updateArea;
       
  1282     updateArea.iTl=iTableUpButton->Rect().iTl;
       
  1283     updateArea.iBr=iTableDownButton->Rect().iBr;
       
  1284     UpdateArea( updateArea, ETrue );
       
  1285     }
       
  1286 
       
  1287 void CPeninputVkbKrWindow::ResetAccentButton()
       
  1288     {
       
  1289     TInt curRange = CPeninputDataConverter::AnyToInt
       
  1290         ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
       
  1291         
       
  1292     if ( iRangeBar )
       
  1293         {
       
  1294         iRangeBar->ActiveRange( curRange );
       
  1295         }        
       
  1296     }
       
  1297 
       
  1298 void CPeninputVkbKrWindow::UpdateICFTextL()
       
  1299     {
       
  1300     CFepLayoutMultiLineIcf* icf = 
       
  1301         static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF));
       
  1302     if( icf )
       
  1303         {
       
  1304         icf->UpdateSecretTextL();    
       
  1305         }
       
  1306     }
       
  1307 
       
  1308 
       
  1309 TInt CPeninputVkbKrWindow::BackgroundTaskL(TAny* aPtr)
       
  1310     {
       
  1311     CPeninputVkbKrWindow* self = static_cast<CPeninputVkbKrWindow*>(aPtr);
       
  1312     self->DoIdleConstructL();
       
  1313     return EFalse; // only run once
       
  1314     }
       
  1315 
       
  1316 void CPeninputVkbKrWindow::PopupWindowSizeChange()
       
  1317     {
       
  1318     TAknTextLineLayout choiceTextLayout;
       
  1319     if (CPeninputDataConverter::AnyToInt(
       
  1320         iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) || (!iPopupSet))
       
  1321         {
       
  1322         // if size changing, or popup window's property has not been set yet
       
  1323         TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
       
  1324         iAppWndRect = appWnd.Rect();
       
  1325         
       
  1326         TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
       
  1327         TAknLayoutRect mainPaneRect;
       
  1328         mainPaneRect.LayoutRect(iAppWndRect, mainPane);
       
  1329         
       
  1330         TAknWindowLineLayout choiceWnd = 
       
  1331                          AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine();
       
  1332         TAknLayoutRect choiceRect;
       
  1333         choiceRect.LayoutRect(mainPaneRect.Rect(), choiceWnd);
       
  1334         
       
  1335         iPopupItemRect = TRect(0, 0, choiceRect.Rect().Width(), 
       
  1336                          AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH);
       
  1337         
       
  1338         choiceTextLayout = 
       
  1339                          AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine();
       
  1340         }
       
  1341         
       
  1342     const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL);
       
  1343     iPopupWnd->SetFont(font);
       
  1344     iPopupWnd->SetItemRect(iPopupItemRect, iPopupItemRect);
       
  1345 
       
  1346     TInt leftMargin = choiceTextLayout.il;
       
  1347     
       
  1348     iPopupWnd->SetMarginAndBaseline(leftMargin, font->HeightInPixels());
       
  1349     
       
  1350     iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC));
       
  1351 
       
  1352     AknIconUtils::SetSize(iPopupWndBgImg, TSize(iPopupItemRect.Width(), 
       
  1353                           iPopupItemRect.Height()*3), EAspectRatioNotPreserved);
       
  1354     AknIconUtils::SetSize(iPopupWndFocusImg, TSize(iPopupItemRect.Width(), 
       
  1355                           iPopupItemRect.Height()* 3), EAspectRatioNotPreserved);
       
  1356     
       
  1357     iPopupSet = ETrue;
       
  1358     }
       
  1359 
       
  1360 void CPeninputVkbKrWindow::DoIdleConstructL()
       
  1361     {   
       
  1362     if(iPopupInited)
       
  1363         return;
       
  1364     
       
  1365     // Read resource
       
  1366     TResourceReader reader;
       
  1367     
       
  1368     CCoeEnv::Static()->CreateResourceReaderLC( reader, 
       
  1369         R_PENINPUT_LAYOUT_VKB_POPUP_WINDOW ); 
       
  1370         
       
  1371     GetPopupWndInfoFromResL(reader, iPopupItemRect);    
       
  1372        
       
  1373     // Pop and destroy reader
       
  1374     CleanupStack::PopAndDestroy( 1 );
       
  1375 
       
  1376     }
       
  1377 
       
  1378 void CPeninputVkbKrWindow::GetPopupWndInfoFromResL( 
       
  1379         TResourceReader aRes,
       
  1380         const TRect& aRect )
       
  1381     {
       
  1382     TPtrC bmpFileName = aRes.ReadTPtrC();        
       
  1383     TInt32 imgMajorSkinId = aRes.ReadInt32();
       
  1384 
       
  1385     TAknsItemID id;
       
  1386     
       
  1387     MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
       
  1388 
       
  1389     TInt popWinBmpId = aRes.ReadInt16();
       
  1390     TInt popWinBmpMaskId = aRes.ReadInt16();
       
  1391     TInt popWinBmpSkinId = aRes.ReadInt16();
       
  1392     
       
  1393     id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId );
       
  1394     
       
  1395     if ( popWinBmpId != KInvalidImg )
       
  1396         {
       
  1397         AknsUtils::CreateIconL( skininstance,
       
  1398                                 id,
       
  1399                                 iPopupWndBgImg,
       
  1400                                 bmpFileName,
       
  1401                                 popWinBmpId );
       
  1402             
       
  1403         AknIconUtils::SetSize( iPopupWndBgImg, TSize( aRect.Width(), 
       
  1404             aRect.Height() * 3 ), EAspectRatioNotPreserved );
       
  1405         iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg );
       
  1406         }
       
  1407         
       
  1408     TInt focusBmpId = aRes.ReadInt16();
       
  1409     TInt focusBmpMaskId = aRes.ReadInt16();
       
  1410     TInt focusBmpSkinId = aRes.ReadInt16();
       
  1411 
       
  1412     id.Set( TInt( imgMajorSkinId ), focusBmpSkinId );
       
  1413     
       
  1414     if ( focusBmpId != KInvalidImg )
       
  1415         {
       
  1416         AknsUtils::CreateIconL( skininstance,
       
  1417                                 id,
       
  1418                                 iPopupWndFocusImg,
       
  1419                                 bmpFileName,
       
  1420                                 focusBmpId );
       
  1421 
       
  1422         AknIconUtils::SetSize( iPopupWndFocusImg, TSize( aRect.Width(), 
       
  1423             aRect.Height() * 3 ), EAspectRatioNotPreserved );
       
  1424         iPopupWnd->SetFocusBmp( iPopupWndFocusImg );
       
  1425         }
       
  1426     }
       
  1427 
       
  1428 void CPeninputVkbKrWindow::PopupSwitchWindowL()
       
  1429     {
       
  1430     CFepUiBaseCtrl* switchBtn = Control(EPeninutWindowCtrlIdSwitchToHwrBtn);
       
  1431 
       
  1432     if ( switchBtn )
       
  1433         {
       
  1434         /*
       
  1435         if (!iPopupInited)
       
  1436             {
       
  1437             DoIdleConstructL();
       
  1438             }
       
  1439         TRect rect = switchBtn->Rect();   
       
  1440         */
       
  1441         static_cast<CPeninputLayoutInputmodelChoice*>
       
  1442                 (Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->PopUpSwitchListL( switchBtn->Rect() );
       
  1443         }         
       
  1444     }
       
  1445 
       
  1446 TBool CPeninputVkbKrWindow::IsSymbolRange()
       
  1447     {
       
  1448     TInt currentRange = CPeninputDataConverter::AnyToInt(
       
  1449         iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
       
  1450     return currentRange==ERangeSymbol;
       
  1451     }
       
  1452 
       
  1453 void CPeninputVkbKrWindow::FakeClientLayoutUpdateL(const TInt& aVkbLayoutId)
       
  1454     {
       
  1455     TInt vkbLayoutToUpdate=aVkbLayoutId;
       
  1456     CPeninputRangeBarInfo* rangeBarInfo = iConfigInfo->RangeBarInfo();
       
  1457     CPeninputRangeInfo* rangeInfo = rangeBarInfo->FindRange(ERangeSymbol);
       
  1458     if (vkbLayoutToUpdate==0)
       
  1459         {
       
  1460         vkbLayoutToUpdate = rangeInfo->VkbLayoutId();
       
  1461         }
       
  1462     
       
  1463     // TODO: find better way to handle changing client layout.
       
  1464     TDummyRangeInfo* dummyRangeInfo=(TDummyRangeInfo*)rangeInfo;
       
  1465     dummyRangeInfo->iClientLayoutId=
       
  1466         SymbolTableUtil::GetClientLaytoutFor(vkbLayoutToUpdate);
       
  1467 
       
  1468     if (iTablePageLabel)
       
  1469         {
       
  1470         TBuf<50> buf;
       
  1471         buf.Format(_L("%d/%d"),SymbolTableUtil::FindIndex(vkbLayoutToUpdate)+1,KMaxSymbolTable);
       
  1472         //iTablePageLabel->SetCaptionL(buf);
       
  1473         iTablePageLabel->SetTextL(buf);
       
  1474         iTablePageLabel->Draw();
       
  1475         }
       
  1476     }
       
  1477 
       
  1478 // ---------------------------------------------------------------------------
       
  1479 // External Functions
       
  1480 // ---------------------------------------------------------------------------
       
  1481 //
       
  1482 
       
  1483 void CPeninputVkbKrWindow::SetPromptTextL(TUint8* aData)
       
  1484     {
       
  1485     RDesReadStream readStream;
       
  1486 
       
  1487     TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt));
       
  1488       readStream.Open(countPtr);
       
  1489       CleanupClosePushL(readStream);
       
  1490     const TInt dataCount = readStream.ReadInt32L();
       
  1491       const TInt textCount = readStream.ReadInt32L();
       
  1492     CleanupStack::PopAndDestroy(&readStream);
       
  1493     
       
  1494     TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount );            
       
  1495       readStream.Open(ptr);
       
  1496       CleanupClosePushL(readStream);
       
  1497     
       
  1498       HBufC8* dataBuf = HBufC8::NewLC(dataCount);
       
  1499       TPtr8 dataBufPtr = dataBuf->Des();
       
  1500       readStream.ReadL(dataBufPtr, dataCount);
       
  1501 
       
  1502     TFepPromptText* pIcfData = 
       
  1503         reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1504 
       
  1505     HBufC* textBuf;
       
  1506     if (textCount > 0)
       
  1507         {
       
  1508         textBuf = HBufC::NewLC(textCount/2);
       
  1509           TPtr textBufPtr = textBuf->Des();
       
  1510           readStream.ReadL(textBufPtr, textCount/2);
       
  1511         static_cast<CFepLayoutMultiLineIcf*>
       
  1512                     (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL(textBuf->Des());
       
  1513         CleanupStack::PopAndDestroy(textBuf);
       
  1514         }
       
  1515     else
       
  1516         {
       
  1517         static_cast<CFepLayoutMultiLineIcf*>
       
  1518                     (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL(KNullDesC);
       
  1519         }
       
  1520 
       
  1521     CleanupStack::PopAndDestroy(dataBuf);
       
  1522       CleanupStack::PopAndDestroy(&readStream);
       
  1523     }    
       
  1524 
       
  1525 void CPeninputVkbKrWindow::SetSwitchlistSecretFlag(TBool aSecret)
       
  1526     {
       
  1527     static_cast<CPeninputLayoutInputmodelChoice*>
       
  1528             (Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->SetSecretEditor(aSecret);    
       
  1529     //disable or enable arrow keys of FSQ in secret editor.     
       
  1530     }
       
  1531 
       
  1532 void CPeninputVkbKrWindow::DimArrowKeys( TBool aDimArrow )
       
  1533     {
       
  1534     if(iLayoutContext->LayoutType() == EPluginInputModeFSQ 
       
  1535        && iArrowLeftButton && iArrowRightButton)
       
  1536         {
       
  1537         iArrowLeftButton->SetDimmed( aDimArrow );
       
  1538         iArrowRightButton->SetDimmed( aDimArrow );
       
  1539         }           
       
  1540     }
       
  1541 
       
  1542 void CPeninputVkbKrWindow::ShowBubble(TInt aShow)
       
  1543     {
       
  1544     if (aShow > 0)
       
  1545         {
       
  1546         iVkbCtrl->ShowBubble(ETrue);    
       
  1547         }
       
  1548     else
       
  1549         {
       
  1550         iVkbCtrl->ShowBubble(EFalse);     
       
  1551         }
       
  1552     }
       
  1553 
       
  1554 void CPeninputVkbKrWindow::PreProcessRange(const TInt& aRange)
       
  1555     {
       
  1556     CAknFepCtrlMultiModeButton* ctrlShift=
       
  1557         (CAknFepCtrlMultiModeButton*)ControlById(EPeninutWindowCtrlIdShiftBtn);
       
  1558     if (aRange==ERangeSymbol)
       
  1559         {
       
  1560         TRAP_IGNORE( FakeClientLayoutUpdateL());
       
  1561         ctrlShift->SetDimmed(ETrue);
       
  1562         }
       
  1563     else
       
  1564         {
       
  1565         ctrlShift->SetDimmed(EFalse);
       
  1566         }
       
  1567     }
       
  1568 
       
  1569 void CPeninputVkbKrWindow::UpdateLafData()
       
  1570     {
       
  1571     TRAP_IGNORE( iLafMgr->UpdateLafDataL() );
       
  1572     }