textinput/peninputvkbcn/ctrlsrc/peninputvkbwindow.cpp
branchRCL_3
changeset 21 ecbabf52600f
equal deleted inserted replaced
20:ebd48d2de13c 21: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:  vkb main window area implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // system includes
       
    20 #include <peninputcmdparam.h>            // use global signal
       
    21 #include <peninputvkbcn.rsg>
       
    22 #include <peninputlayoutmultilineicf.h>
       
    23 #include <peninputeventbutton.h>
       
    24 #include <peninputdragbutton.h>
       
    25 #include <peninputrepeatbutton.h>
       
    26 #include <AknLayoutDef.h>
       
    27 #include <peninputcommonchoicelist.h>
       
    28 #include <peninputlayout.h>
       
    29 #include <AknIconUtils.h>
       
    30 #include <AknLayoutDef.h>
       
    31 #include <AknUtils.h>
       
    32 #include <aknlayoutscalable_avkon.cdl.h>
       
    33 #include <barsread.h>
       
    34 #include <AknsUtils.h>
       
    35 #include <AknFepGlobalEnums.h>
       
    36 #include <peninputlayoutinputmodechoice.h>
       
    37 #include <peninputcmd.h>            // use global signal
       
    38 #include <aknfeppeninputenums.h>    //command from fep or IME to plugin
       
    39 
       
    40 #include <aknlayoutscalable_apps.cdl.h>
       
    41 #include <peninputlayoutbubblectrl.h>
       
    42 #include <peninputscrollablelist.h>
       
    43 
       
    44 #include <s32mem.h>
       
    45 #include <peninputvkbctrllayout.h>
       
    46 #include <peninputvkbctrlext.h>
       
    47 
       
    48 // user includes
       
    49 #include "peninputvkb.hrh"
       
    50 #include "peninputvkbwindow.h"
       
    51 #include "peninputvkbevent.h"
       
    52 #include "peninputvkbclientarea.h"
       
    53 #include "peninputvkbdataprovider.h"
       
    54 
       
    55 #include "peninputvkbcnlafdatamgr.h"
       
    56 #include "peninputvkblayout.h"
       
    57 
       
    58 // constant definition
       
    59 const TInt KInvalidImg = -1 ;
       
    60 
       
    61 const TInt KTooltipLeftMargin = 10;
       
    62 const TInt KTooltipTopMargin = 0;
       
    63 const TInt KTooltipRightMargin = 10;
       
    64 const TInt KTooltipBottomMargin = 0;
       
    65 
       
    66 // ======== MEMBER FUNCTIONS ========
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CAknFepVkbWindow::NewL
       
    70 // (other items were commented in a header).
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 CAknFepVkbWindow* CAknFepVkbWindow::NewL(CFepUiLayout* aUiLayout, 
       
    74                                          TInt aControlId,
       
    75                                          MAknFepVkbDataProvider* aDataProvider,
       
    76                                          CAknFepVkbUiStateMgr* aUiStateMgr)
       
    77     {
       
    78     CAknFepVkbWindow* self = 
       
    79         CAknFepVkbWindow::NewLC(aUiLayout, aControlId, aDataProvider, aUiStateMgr);
       
    80     CleanupStack::Pop(self);
       
    81     return self;
       
    82     }
       
    83         
       
    84 // ---------------------------------------------------------------------------
       
    85 // CAknFepVkbWindow::NewLC
       
    86 // (other items were commented in a header).
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 CAknFepVkbWindow* CAknFepVkbWindow::NewLC(CFepUiLayout* aUiLayout, 
       
    90                                           TInt aControlId,
       
    91                                           MAknFepVkbDataProvider* aDataProvider,
       
    92                                           CAknFepVkbUiStateMgr* aUiStateMgr)
       
    93     {
       
    94     CAknFepVkbWindow* self = 
       
    95         new (ELeave) CAknFepVkbWindow(aUiLayout, aControlId, aDataProvider, aUiStateMgr);
       
    96     CleanupStack::PushL(self);
       
    97     self->ConstructL();
       
    98     return self;
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CAknFepVkbWindow::~CAknFepVkbWindow
       
   103 // (other items were commented in a header).
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 CAknFepVkbWindow::~CAknFepVkbWindow()
       
   107     {
       
   108     delete iIdle;
       
   109     delete iLafMgr;
       
   110     iLafMgr = NULL;
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // CAknFepVkbWindow::CAknFepVkbWindow
       
   115 // (other items were commented in a header).
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CAknFepVkbWindow::CAknFepVkbWindow(CFepUiLayout* aUiLayout, 
       
   119                                    TInt aControlId, 
       
   120                                    MAknFepVkbDataProvider* aDataProvider,
       
   121                                    CAknFepVkbUiStateMgr* aUiStateMgr )
       
   122     :CAknFepCtrlBaseWindowExt(aUiLayout, aControlId), 
       
   123     iLafMgr(NULL),
       
   124     iDataProvider(aDataProvider), 
       
   125     iUiStateMgr(aUiStateMgr),
       
   126     iFirstTimeConstruct(ETrue), 
       
   127     iPopupInited(EFalse),
       
   128     iPopupSet(EFalse)    
       
   129     {
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // CAknFepVkbWindow::ConstructL
       
   134 // (other items were commented in a header).
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CAknFepVkbWindow::ConstructL()
       
   138     {
       
   139     iLafMgr = CPeninputCnGenericVkbLafMgr::NewL();
       
   140     iLafMgr->SetInputModeL((TPluginInputMode)(UiLayout()->PenInputType()));
       
   141     
       
   142     BaseConstructL();
       
   143     
       
   144     // Add input context field into the headpane
       
   145 //    AddContextFieldL();
       
   146     
       
   147     // Read bitmaps of close and move button
       
   148     TInt resID = GetWindowResId();
       
   149     SetResourceId( resID );
       
   150     
       
   151     // Create client area
       
   152     iClientArea = CAknFepVkbClientArea::NewL(UiLayout(), 
       
   153                                              EAknFepVkbCtrlIdClientArea,
       
   154                                              iDataProvider,
       
   155                                              iLafMgr);    
       
   156                                
       
   157     // Then add it into the clientpane
       
   158     AddControlL(iClientArea);       
       
   159     iClientArea->SetTopParent(this);
       
   160 
       
   161     
       
   162     //Add popup window
       
   163     AddPopupWindowL();
       
   164 
       
   165     
       
   166     ConstructFromResourceL();
       
   167     
       
   168     // For addition of ITI features, add a candidate list in vkb window   
       
   169     CreateCandidateListOnFSQL();      
       
   170     }
       
   171     
       
   172 // ---------------------------------------------------------------------------
       
   173 // CAknFepVkbWindow::ConstructFromResourceL
       
   174 // (other items were commented in a header).
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 void CAknFepVkbWindow::ConstructFromResourceL()
       
   178     {
       
   179     CAknFepCtrlBaseWindowExt::ConstructFromResourceL();
       
   180     iInputContextField = 
       
   181         static_cast<CFepLayoutMultiLineIcf*>
       
   182         (Control(EPeninputWindowCtrlIdMultiLineICF));
       
   183         
       
   184     iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
       
   185     iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
       
   186     
       
   187     iInputContextField->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
       
   188     iInputContextField->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
       
   189     //Change the ID when ID into release  
       
   190     iInputContextField->MsgBubbleCtrl()->SetBitmapParam(NULL,
       
   191 									  NULL,
       
   192 									  KAknsIIDQsnFrInputPreviewSideL,
       
   193 									  KAknsIIDQsnFrInputPreviewMiddle,
       
   194 									  KAknsIIDQsnFrInputPreviewSideR);  
       
   195 
       
   196     if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   197         {
       
   198         iInputContextField->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
       
   199         }  
       
   200     }    
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CAknFepVkbWindow::ChangeImLayout
       
   204 // (other items were commented in a header).
       
   205 // ---------------------------------------------------------------------------
       
   206 //
       
   207 void CAknFepVkbWindow::ChangeImLayout(TInt aRange, TBool aChangeVkb)
       
   208     {
       
   209 	UiLayout()->DisableLayoutDrawing(ETrue);   
       
   210     TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
   211 
       
   212     if ( iArrowLeftButton )
       
   213         {
       
   214         iArrowLeftButton->Hide( EAknFepVkbImCnZhuyin == imLayout );    
       
   215         }
       
   216     if ( iArrowRightButton )
       
   217         {
       
   218         iArrowRightButton->Hide( EAknFepVkbImCnZhuyin == imLayout );    
       
   219         }
       
   220     
       
   221     iClientArea->ChangeImLayout(aRange, aChangeVkb);
       
   222     SizeChangedForTitle();
       
   223     UiLayout()->DisableLayoutDrawing(EFalse);
       
   224     Draw();
       
   225     }
       
   226 
       
   227 // ---------------------------------------------------------------------------
       
   228 // CAknFepVkbWindow::ChangeVkbLayout
       
   229 // (other items were commented in a header).
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 void CAknFepVkbWindow::ChangeVkbLayout(TInt aVkbLayoutId)
       
   233     {
       
   234     iClientArea->ChangeVkbLayout(aVkbLayoutId);
       
   235     }
       
   236         
       
   237 // ---------------------------------------------------------------------------
       
   238 // CAknFepVkbWindow::LoopVkbLayout
       
   239 // (other items were commented in a header).
       
   240 // ---------------------------------------------------------------------------
       
   241 //
       
   242 void CAknFepVkbWindow::LoopVkbLayout(TVkbShiftType aType, TBool aNotify )
       
   243     {
       
   244     iClientArea->LoopVkbLayout(aType, aNotify);
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // CAknFepVkbWindow::Draw
       
   249 // (other items were commented in a header).
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void CAknFepVkbWindow::Draw()
       
   253 	{
       
   254 	if ( Hiden() )
       
   255 		{
       
   256 		return;
       
   257 		}
       
   258 		
       
   259     CAknFepCtrlBaseWindowExt::Draw();
       
   260     UpdateArea(Rect(), EFalse);
       
   261 	}
       
   262   
       
   263 // ---------------------------------------------------------------------------
       
   264 // CAknFepVkbWindow::SetRect
       
   265 // (other items were commented in a header).
       
   266 // ---------------------------------------------------------------------------
       
   267 //
       
   268 void CAknFepVkbWindow::SetRect(const TRect& aRect)
       
   269     {
       
   270 	TRect rect = aRect;
       
   271 	
       
   272 
       
   273     if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   274         {
       
   275         rect.Move( TPoint(- rect.iTl ));
       
   276         CFepUiBaseCtrl::SetRect( rect );
       
   277         UiLayout()->SetRect(rect);
       
   278         }
       
   279     else
       
   280                                     
       
   281     	{
       
   282         TSize shadowTl = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowTlSize));
       
   283         TSize shadowBr = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowBrSize));
       
   284 
       
   285 	    TRect shadowRect = TRect( TPoint(), 
       
   286 	                              TSize( aRect.Width() + shadowTl.iWidth + shadowBr.iWidth,
       
   287 	                                     aRect.Height() + shadowTl.iHeight + shadowBr.iHeight)
       
   288 	                            );
       
   289 	    rect.Move( TPoint(shadowTl.iWidth, shadowTl.iHeight) - rect.iTl );
       
   290         
       
   291 	CFepUiBaseCtrl::SetRect( rect );
       
   292 
       
   293 	    RootControl()->SetRect( rect );
       
   294     UiLayout()->SetShadowRect(shadowRect);
       
   295 	    }
       
   296      /*   
       
   297     CFepUiBaseCtrl::SetRect(aRect);
       
   298     ResetShadowSizeIfNeeded();*/
       
   299     }
       
   300 
       
   301 // ---------------------------------------------------------------------------
       
   302 // CAknFepVkbWindow::SetPopupProperty
       
   303 // (other items were commented in a header).
       
   304 // ---------------------------------------------------------------------------
       
   305 //
       
   306 void CAknFepVkbWindow::SetPopupProperty()
       
   307 	{
       
   308 	TRect mainPaneRect = *((TRect*)iDataProvider->RequestData(EAknFepDataTypeMainPaneRect));
       
   309 
       
   310     TAknWindowLineLayout choiceWnd = 
       
   311                                 AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine();
       
   312     
       
   313     TAknLayoutRect choiceRect;
       
   314     choiceRect.LayoutRect(mainPaneRect, choiceWnd);
       
   315 
       
   316     TRect itemRect = TRect(0,
       
   317                            0,
       
   318                            choiceRect.Rect().Width(),
       
   319                            AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH);
       
   320 
       
   321     TAknTextLineLayout choiceTextLayout = 
       
   322                          AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine();
       
   323 
       
   324     const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL);
       
   325     iPopupWnd->SetFont(font);
       
   326         
       
   327     iPopupWnd->SetItemRect(itemRect, 
       
   328                            itemRect);
       
   329 
       
   330     TInt leftMargin = choiceTextLayout.il;
       
   331    
       
   332     iPopupWnd->SetMarginAndBaseline(leftMargin,font->HeightInPixels());
       
   333 
       
   334     iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC));
       
   335 
       
   336     if (iPopupWndBgImg)
       
   337     	{
       
   338     	AknIconUtils::SetSize(iPopupWndBgImg, TSize(itemRect.Width(),itemRect.Height()*3), 
       
   339                             EAspectRatioNotPreserved);
       
   340     	}
       
   341     
       
   342     if (iPopupWndFocusImg)
       
   343     	{
       
   344     	AknIconUtils::SetSize(iPopupWndFocusImg, TSize(itemRect.Width(),itemRect.Height()*3), 
       
   345                             EAspectRatioNotPreserved);
       
   346     	}
       
   347     
       
   348     iPopupSet = ETrue;	
       
   349     iPopupItemSize = itemRect.Size();
       
   350 	}
       
   351 
       
   352 // ---------------------------------------------------------------------------
       
   353 // CAknFepVkbWindow::SizeChanged
       
   354 // (other items were commented in a header).
       
   355 // ---------------------------------------------------------------------------
       
   356 //
       
   357 void CAknFepVkbWindow::SizeChanged(TBool /*aLandscapeStyle*/)
       
   358     {
       
   359     SizeChangedForTitle();
       
   360     iClientArea->SizeChanged();
       
   361 
       
   362     Draw();
       
   363         }
       
   364 
       
   365 void CAknFepVkbWindow::SizeChangedForTitle()
       
   366     	{
       
   367 	TRect innerRect;
       
   368 	
       
   369     if (( iLafMgr == NULL ) || 
       
   370         ( iLafMgr && !iLafMgr->IsValid() ))
       
   371         {
       
   372         return;
       
   373         }
       
   374         
       
   375     if (iDataProvider->SizeChanging() || (!iDataProvider->UnitShadowSizeSet()))
       
   376     	{
       
   377     	iDataProvider->ReadUnitShadowSize();
       
   378     	}
       
   379 
       
   380 	TSize shadowTl = *((TSize*)iDataProvider->RequestData(EAknFepDataTypeShadowTlSize));
       
   381     TInt x = shadowTl.iWidth;
       
   382     TInt y = shadowTl.iHeight;
       
   383     
       
   384     if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
   385         {
       
   386         x = 0;
       
   387         y = 0;
       
   388         }
       
   389 
       
   390     
       
   391             
       
   392     TInt btnWidth = iDataProvider->RequestData(EAknFepDataTypeUnitWidth);
       
   393     TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight);    
       
   394     
       
   395     
       
   396     // Close btn
       
   397     TRect closeBtnRect;
       
   398     closeBtnRect.iTl = TPoint(x, y);
       
   399     closeBtnRect.SetSize(TSize(btnWidth, btnHeight));
       
   400     AknPenImageUtils::CalculateGraphicRect( closeBtnRect, innerRect );
       
   401     static_cast<CAknFepCtrlCommonButton*>
       
   402         ( Control( EPeninutWindowCtrlIdCloseBtn ) )->SizeChanged( closeBtnRect, innerRect, ETrue );
       
   403 
       
   404 
       
   405     // ICF
       
   406     TInt columNum = iDataProvider->RequestData(EAknFepDataTypeIcfColumnNums); 
       
   407     TInt titlebarHeight = iDataProvider->RequestData(EAknFepDataTypeTitleBarHeight); 
       
   408     	
       
   409     TRect icfRect;
       
   410     icfRect.iTl = TPoint(closeBtnRect.iBr.iX, closeBtnRect.iTl.iY);
       
   411     icfRect.SetSize(TSize(btnWidth * columNum + iClientArea->iCellAidGap, titlebarHeight));   
       
   412 
       
   413     // Set ICF Margin 
       
   414    	TPeninputCnICFConfig icfCfg;
       
   415    	iLafMgr->GetICFConfig( icfCfg );
       
   416     const CFont* icfFont = iLafMgr->ICFTextFont();
       
   417 	iInputContextField->SetTextMargin( icfCfg.iLeftMargin,
       
   418 									   icfCfg.iRightMargin,
       
   419 									   icfCfg.iTopMargin,
       
   420 									   0 );
       
   421     iInputContextField->SetLineSpace( icfCfg.iLineSpaceMargin );
       
   422     TRAP_IGNORE(iInputContextField->SizeChangedL( icfRect, 
       
   423 	                                  icfCfg.iTextLineHeight,
       
   424 	                                  icfFont->FontMaxHeight(),
       
   425 	                                  icfFont ));    
       
   426 
       
   427     // Option Button
       
   428     TRect optionBtnRect;
       
   429     optionBtnRect.iTl = TPoint(closeBtnRect.iTl.iX, closeBtnRect.iBr.iY);
       
   430     optionBtnRect.SetSize(TSize(btnWidth, btnHeight));
       
   431     AknPenImageUtils::CalculateGraphicRect( optionBtnRect, innerRect );
       
   432     static_cast<CAknFepCtrlEventButton*>
       
   433         (Control(EPeninutWindowCtrlIdOptionBtn))->SizeChanged(optionBtnRect, innerRect, ETrue);
       
   434     
       
   435     TPoint backSpaceRefPoint;
       
   436     
       
   437     // Move Button
       
   438     TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
   439     
       
   440     if (UiLayout()->PenInputType() == EPluginInputModeVkb)
       
   441         {
       
   442         TRect moveBtnRect;
       
   443         if(EAknFepVkbImCnZhuyin == imLayout)
       
   444             {
       
   445             moveBtnRect.iTl = TPoint(icfRect.iBr.iX + btnWidth, icfRect.iTl.iY);
       
   446             moveBtnRect.SetSize(TSize(btnWidth, btnHeight));
       
   447             }
       
   448         else
       
   449             {
       
   450             moveBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY);
       
   451             moveBtnRect.SetSize(TSize(btnWidth * 2, btnHeight));            
       
   452             }
       
   453         AknPenImageUtils::CalculateGraphicRect( moveBtnRect, innerRect );
       
   454         static_cast<CAknFepCtrlDragButton*>
       
   455             ( Control( EPeninutWindowCtrlIdMoveBtn ) )->SizeChanged(moveBtnRect, innerRect, ETrue);
       
   456             
       
   457         backSpaceRefPoint = TPoint(moveBtnRect.iTl.iX, moveBtnRect.iBr.iY);
       
   458         }
       
   459     else if (UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   460         {
       
   461         if ( EAknFepVkbImCnZhuyin == imLayout )
       
   462             {
       
   463             /*TRect emptyRect= TRect();
       
   464             AknPenImageUtils::CalculateGraphicRect( emptyRect, innerRect );
       
   465             static_cast<CAknFepCtrlRepeatButton*>
       
   466                 ( Control( EPeninupWindowCtrlIdArrowLeftBtn ) )->SizeChanged(emptyRect, innerRect, ETrue);
       
   467             static_cast<CAknFepCtrlRepeatButton*>
       
   468                 ( Control( EPeninupWindowCtrlIdArrowRightBtn ) )->SizeChanged(emptyRect, innerRect, ETrue);*/
       
   469            /* TRect arrowRect;
       
   470             TRect innerRect;
       
   471             
       
   472             arrowRect.iTl = TPoint(closeBtnRect.iBr.iX, closeBtnRect.iBr.iY);
       
   473             arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight));
       
   474             AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   475             static_cast<CAknFepCtrlRepeatButton*>
       
   476                 ( Control( EPeninupWindowCtrlIdArrowUpBtn ) )->SizeChanged(arrowRect, innerRect, ETrue);
       
   477                 
       
   478             arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   479             arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight));
       
   480             AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   481             static_cast<CAknFepCtrlRepeatButton*>
       
   482                 ( Control( EPeninupWindowCtrlIdArrowDownBtn ) )->SizeChanged(arrowRect, innerRect, ETrue);
       
   483                 
       
   484             arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   485             arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight));
       
   486             AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   487             static_cast<CAknFepCtrlRepeatButton*>
       
   488                 ( Control( EPeninupWindowCtrlIdArrowLeftBtn ) )->SizeChanged(arrowRect, innerRect, ETrue);
       
   489                 
       
   490             arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   491             arrowRect.SetSize(TSize(btnWidth + btnWidth*2, btnHeight));
       
   492             AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   493             static_cast<CAknFepCtrlRepeatButton*>
       
   494                 ( Control( EPeninupWindowCtrlIdArrowRightBtn ) )->SizeChanged(arrowRect, innerRect, ETrue);*/
       
   495             }
       
   496         else
       
   497             {
       
   498             TRect leftBtnRect;
       
   499             leftBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY);
       
   500             
       
   501             leftBtnRect.SetSize(TSize(btnWidth, btnHeight));        
       
   502 			AknPenImageUtils::CalculateGraphicRect( leftBtnRect, innerRect );
       
   503             iArrowLeftButton->SizeChanged(leftBtnRect, innerRect, ETrue);
       
   504 
       
   505             TRect rightBtnRect;
       
   506             rightBtnRect.iTl = TPoint(leftBtnRect.iBr.iX, leftBtnRect.iTl.iY);
       
   507             rightBtnRect.SetSize(TSize(btnWidth, btnHeight));        
       
   508 			AknPenImageUtils::CalculateGraphicRect( rightBtnRect, innerRect );
       
   509             iArrowRightButton->SizeChanged(rightBtnRect, innerRect, ETrue);
       
   510 
       
   511             backSpaceRefPoint = TPoint(leftBtnRect.iTl.iX, leftBtnRect.iBr.iY);
       
   512             }
       
   513         }
       
   514 
       
   515     // BackSpace button
       
   516     TRect backSpaceBtnRect;
       
   517     if(EAknFepVkbImCnZhuyin == imLayout)
       
   518         {
       
   519         if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   520             {
       
   521             backSpaceBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY);
       
   522             backSpaceBtnRect.SetSize(TSize(btnWidth * 2, btnHeight));
       
   523             }
       
   524         else
       
   525             {
       
   526             backSpaceBtnRect.iTl = TPoint(icfRect.iBr.iX, icfRect.iTl.iY);
       
   527             backSpaceBtnRect.SetSize(TSize(btnWidth, btnHeight));
       
   528             }
       
   529         }
       
   530     else
       
   531         {
       
   532         backSpaceBtnRect.iTl = backSpaceRefPoint;
       
   533         backSpaceBtnRect.SetSize(TSize(btnWidth * 2, btnHeight));
       
   534         }
       
   535     AknPenImageUtils::CalculateGraphicRect( backSpaceBtnRect, innerRect );
       
   536     static_cast<CAknFepCtrlRepeatButton*>
       
   537         ( Control( EPeninutWindowCtrlIdBackspaceBtn ) )->SizeChanged(backSpaceBtnRect, 
       
   538                                                                      innerRect, ETrue);
       
   539 
       
   540     // Tooltip and candidate list
       
   541 	SetITILayoutOnFSQ();
       
   542 
       
   543     if (iDataProvider->SizeChanging() || (!iPopupSet))
       
   544     	{
       
   545     	SetPopupProperty();
       
   546     	}
       
   547     
       
   548         }
       
   549 
       
   550 
       
   551     
       
   552 // ---------------------------------------------------------------------------
       
   553 // CAknFepVkbWindow::HandleControlEvent
       
   554 // (other items were commented in a header).
       
   555 // ---------------------------------------------------------------------------
       
   556 //
       
   557 void CAknFepVkbWindow::HandleControlEvent(TInt aEventType,
       
   558                                           CFepUiBaseCtrl* aCtrl, 
       
   559                                           const TDesC& aEventData)
       
   560     {
       
   561     //Call this function in base class
       
   562     CAknFepCtrlBaseWindowExt::HandleControlEvent(aEventType,aCtrl,aEventData);
       
   563     
       
   564     TUint16* data = (TUint16*) aEventData.Ptr();
       
   565     
       
   566     TBool dealFlag = EFalse;
       
   567     
       
   568     switch (aEventType)
       
   569         {
       
   570         case EEventControlFocusGained:
       
   571             //Get composition
       
   572             {
       
   573             CFepLayoutEditAreaBase* compField = ClientArea()->CompositionField();
       
   574             
       
   575             //if the event is sent by pen down in edit area
       
   576             if ( ( aCtrl ) && ( aCtrl->ControlId() == EPeninputWindowCtrlIdMultiLineICF ) )
       
   577                 {
       
   578                 //Notify compField lost focus
       
   579                 if ( compField )
       
   580                     {
       
   581                     compField->SetFocus(EFalse);
       
   582                     }                
       
   583                 }
       
   584             else if ( ( aCtrl ) && ( aCtrl->ControlId() == EAknFepVkbCtrlIdCompositionField ) )
       
   585                 {
       
   586                 //Notify iInputContextField lost focus
       
   587                 if ( iInputContextField ) 
       
   588                     {
       
   589                     iInputContextField->SetFocus(EFalse);
       
   590                     }
       
   591                 }
       
   592             
       
   593             //if the event is sent from by internal
       
   594             if ( *data == EInputContextFieldGetFocus )
       
   595                 {
       
   596                 if ( compField )
       
   597                     {
       
   598                     compField->SetFocus(EFalse);
       
   599                     }  
       
   600                 if ( iInputContextField ) 
       
   601                     {
       
   602                     iInputContextField->SetFocus(ETrue);
       
   603                     }
       
   604                 }                                    
       
   605             else if ( *data == ECompotisionFieldGetFocus )
       
   606                 {
       
   607                 if ( iInputContextField ) 
       
   608                     {
       
   609                     iInputContextField->SetFocus(EFalse);
       
   610                     }
       
   611                 if ( compField )
       
   612                     {
       
   613                     compField->SetFocus(ETrue);
       
   614                     }                                
       
   615                 }                
       
   616                 
       
   617             dealFlag = ETrue;
       
   618             }
       
   619             break;
       
   620         case EVkbEventUpArrow:
       
   621             {
       
   622             TRAP_IGNORE(iInputContextField->HandleArrowBtnEventL(
       
   623                                                         CFepLayoutMultiLineIcf::EArrowUp));
       
   624             }
       
   625             break;
       
   626         case EVkbEventDownArrow:
       
   627             {
       
   628             TRAP_IGNORE(iInputContextField->HandleArrowBtnEventL(
       
   629                                                         CFepLayoutMultiLineIcf::EArrowDown));
       
   630             }
       
   631             break;                     
       
   632         default:
       
   633             break;
       
   634         }
       
   635     
       
   636     if ( !dealFlag )
       
   637         {
       
   638         iClientArea->HandleControlEvent(aEventType,aCtrl,aEventData);
       
   639         }
       
   640     }
       
   641     
       
   642 // ---------------------------------------------------------------------------
       
   643 // CAknFepVkbWindow::DoClose
       
   644 // (other items were commented in a header).
       
   645 // ---------------------------------------------------------------------------
       
   646 //
       
   647 TBool CAknFepVkbWindow::DoClose()
       
   648     {
       
   649     //Send EVkbEventWindowClose to layout
       
   650     this->ReportEvent(EVkbEventWindowClose,KNullDesC);
       
   651     
       
   652     //Return true which will permit the window close
       
   653     return EFalse;
       
   654     }
       
   655             
       
   656 // ---------------------------------------------------------------------------
       
   657 // CAknFepVkbWindow::ClientArea
       
   658 // (other items were commented in a header).
       
   659 // ---------------------------------------------------------------------------
       
   660 //
       
   661 CAknFepVkbClientArea* CAknFepVkbWindow::ClientArea()
       
   662     {
       
   663     return iClientArea;
       
   664     }       
       
   665 
       
   666 // ---------------------------------------------------------------------------
       
   667 // CAknFepVkbWindow::InputContextField
       
   668 // (other items were commented in a header).
       
   669 // ---------------------------------------------------------------------------
       
   670 //
       
   671 CFepLayoutMultiLineIcf* CAknFepVkbWindow::InputContextField()
       
   672     {
       
   673     return iInputContextField;
       
   674     }
       
   675     
       
   676 // ---------------------------------------------------------------------------
       
   677 // CAknFepVkbWindow::CompositionFieldStringLength
       
   678 // (other items were commented in a header).
       
   679 // ---------------------------------------------------------------------------
       
   680 //
       
   681 TInt CAknFepVkbWindow::CompositionFieldStringLength()
       
   682     {
       
   683     return iClientArea->CompositionFieldStringLength();
       
   684     }
       
   685 
       
   686 // ---------------------------------------------------------------------------
       
   687 // CAknFepVkbWindow::FocusedControlID
       
   688 // (other items were commented in a header).
       
   689 // ---------------------------------------------------------------------------
       
   690 //
       
   691 TInt CAknFepVkbWindow::FocusedControlID()
       
   692     {
       
   693     TInt ctrlID = iInputContextField->ControlId();
       
   694     CFepLayoutEditAreaBase* compField = ClientArea()->CompositionField();
       
   695     
       
   696     if ( compField && compField->IsFocused() )
       
   697         {
       
   698         return compField->ControlId();
       
   699         }
       
   700         
       
   701     return ctrlID;
       
   702     }
       
   703 
       
   704 // ---------------------------------------------------------------------------
       
   705 // CAknFepVkbWindow::SetEditorTextL
       
   706 // (other items were commented in a header).
       
   707 // ---------------------------------------------------------------------------
       
   708 //
       
   709 void CAknFepVkbWindow::SetEditorTextL(const TFepInputContextFieldData& aData)
       
   710     {
       
   711     if(iInputContextField)
       
   712         {
       
   713         iInputContextField->SetTextL(aData);
       
   714         }
       
   715     }
       
   716 
       
   717 // ---------------------------------------------------------------------------
       
   718 // CAknFepVkbWindow::SetEditorTextL
       
   719 // (other items were commented in a header).
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 void CAknFepVkbWindow::SetTextIsSecret( TBool aIsSecret )
       
   723     {
       
   724     if(iInputContextField)
       
   725         {
       
   726         iInputContextField->SetTextIsSecret( aIsSecret );
       
   727         }
       
   728     }
       
   729             
       
   730     
       
   731     
       
   732 // ---------------------------------------------------------------------------
       
   733 // CAknFepVkbWindow::BackgroundConstructL
       
   734 // Do background construct.
       
   735 // ---------------------------------------------------------------------------
       
   736 //
       
   737 TInt CAknFepVkbWindow::BackgroundTaskL(TAny* aPtr)
       
   738     {
       
   739     CAknFepVkbWindow* self = static_cast<CAknFepVkbWindow*>(aPtr);
       
   740     self->DoIdleConstructL();
       
   741     return EFalse;
       
   742     }
       
   743     
       
   744 void CAknFepVkbWindow::DoIdleConstructL()
       
   745     {
       
   746     if (iPopupInited)
       
   747         {
       
   748    	    return;
       
   749         }
       
   750     
       
   751     //set font   
       
   752     /*
       
   753     TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
       
   754     
       
   755     TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
       
   756         
       
   757     TAknLayoutRect mainPaneRect;
       
   758     mainPaneRect.LayoutRect(appWnd.Rect(), mainPane);
       
   759     
       
   760     TAknWindowLineLayout choiceWnd = AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine();
       
   761     
       
   762     TAknLayoutRect choiceRect;
       
   763     choiceRect.LayoutRect(mainPaneRect.Rect(), choiceWnd);
       
   764     
       
   765 
       
   766     TRect itemRect = TRect(0,
       
   767                            0,
       
   768                            choiceRect.Rect().Width(),
       
   769                            AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH);
       
   770 
       
   771     TAknTextLineLayout choiceTextLayout = AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine();
       
   772 
       
   773     const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL);
       
   774     iPopupWnd->SetFont(font);
       
   775     iPopupWnd->SetItemRect(itemRect, 
       
   776                            itemRect);
       
   777 
       
   778     TInt leftMargin = choiceTextLayout.il;
       
   779    
       
   780     iPopupWnd->SetMarginAndBaseline(leftMargin,font->HeightInPixels());
       
   781 
       
   782     iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC));
       
   783     */
       
   784     if (iDataProvider->SizeChanging() || (!iPopupSet))
       
   785     	{
       
   786         SetPopupProperty();
       
   787     	}
       
   788 
       
   789     // Read resource
       
   790     TResourceReader reader;
       
   791     CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AKN_FEP_VKB_POPUP_WINDOW); 
       
   792     
       
   793     GetPopupWndInfoFromRes(reader);
       
   794       
       
   795     CleanupStack::PopAndDestroy(); // reader
       
   796 
       
   797     //add item
       
   798     CFepLayoutChoiceList::SItem item;
       
   799 
       
   800     item.iCommand = EAknFepVkbVkbAccented1;
       
   801     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 );
       
   802     TPtrC p1 = reader.ReadTPtrC();
       
   803     item.iText.Copy( p1 );
       
   804     iPopupWnd->AddItemL( item );
       
   805     CleanupStack::PopAndDestroy( 1 );
       
   806     item.iCommand = EAknFepVkbVkbAccented2;
       
   807     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 );
       
   808     TPtrC p2 = reader.ReadTPtrC();
       
   809     item.iText.Copy( p2 );
       
   810     iPopupWnd->AddItemL( item );
       
   811     CleanupStack::PopAndDestroy( 1 );
       
   812     item.iCommand = EAknFepVkbVkbAccented3;
       
   813     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 );
       
   814     TPtrC p3 = reader.ReadTPtrC();
       
   815     item.iText.Copy( p3 );
       
   816     iPopupWnd->AddItemL( item );
       
   817     CleanupStack::PopAndDestroy( 1 );  
       
   818     iPopupInited = ETrue;
       
   819     
       
   820     iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() );
       
   821     }
       
   822     
       
   823 // ---------------------------------------------------------------------------
       
   824 // CAknFepVkbWindow::AddPopupWindowL
       
   825 // (other items were commented in a header).
       
   826 // ---------------------------------------------------------------------------
       
   827 //
       
   828 void CAknFepVkbWindow::AddPopupWindowL()
       
   829     {
       
   830     iPopupWnd = CPeninputCommonChoiceList::NewL(UiLayout(),
       
   831                                            EAknFepVkbPopupWindow,
       
   832                                 			KAknsIIDQsnFrList,
       
   833                                 			KAknsIIDQsnFrPopupSub );
       
   834     
       
   835     iPopupWnd->AddEventObserver(UiLayout());
       
   836     AddControlL(iPopupWnd);
       
   837 
       
   838     
       
   839     iIdle = CIdle::NewL(CActive::EPriorityIdle);
       
   840     iIdle ->Start(TCallBack(BackgroundTaskL,this));
       
   841     }
       
   842 
       
   843 void  CAknFepVkbWindow::SetSwitchlistLanguage( TInt /*aLang*/ )
       
   844     {
       
   845     }
       
   846     
       
   847 void  CAknFepVkbWindow::SetSwitchlistSecretFlag(TBool aSecret)
       
   848     {
       
   849     static_cast<CPeninputLayoutInputmodelChoice*>
       
   850         (Control( EPeninutWindowCtrlIdSwitcherPopupWindow))->SetSecretEditor(aSecret);
       
   851     }
       
   852 // ---------------------------------------------------------------------------
       
   853 // CPeninputGenericVkbWindow::DimArrowKeys
       
   854 // (other items were commented in a header).
       
   855 // ---------------------------------------------------------------------------
       
   856 //
       
   857 void CAknFepVkbWindow::DimArrowKeys( TBool aDimArrow )
       
   858     {
       
   859     //disable or enable arrow keys of FSQ in secret editor. 
       
   860     if(UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
   861         {
       
   862         iArrowLeftButton->SetDimmed( aDimArrow );
       
   863         iArrowRightButton->SetDimmed( aDimArrow );
       
   864         iClientArea->DimArrowKeys( aDimArrow );
       
   865         }	    	
       
   866     }
       
   867 
       
   868 void CAknFepVkbWindow::DimEnterKey( TBool aDimmed )
       
   869     {
       
   870 	CAknFepCtrlEventButton* enterBtn = static_cast<CAknFepCtrlEventButton*>
       
   871 	                              ( Control(EAknFepVkbCtrlIdEnterBtn) );	
       
   872     if( UiLayout()->PenInputType() == EPluginInputModeFSQ 
       
   873        && enterBtn )
       
   874         {
       
   875         enterBtn->SetDimmed( aDimmed );        
       
   876         }
       
   877     }
       
   878 
       
   879 // --------------------------------------------------------------------------
       
   880 // CAknFepVkbWindow::GetPopupWndInfoFromRes
       
   881 // (other items were commented in a header)
       
   882 // --------------------------------------------------------------------------
       
   883 //
       
   884 void CAknFepVkbWindow::GetPopupWndInfoFromRes(TResourceReader aReader)
       
   885     {
       
   886     TPtrC bmpFileName = aReader.ReadTPtrC();
       
   887     TInt32 imgMajorSkinId = aReader.ReadInt32();
       
   888 
       
   889     TAknsItemID id;
       
   890     
       
   891     MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
       
   892 
       
   893     TInt popWinBmpId = aReader.ReadInt16();
       
   894     TInt popWinBmpMaskId = aReader.ReadInt16();
       
   895     TInt popWinBmpSkinId = aReader.ReadInt16();
       
   896     
       
   897     id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId );
       
   898     
       
   899     if ( popWinBmpId != KInvalidImg )
       
   900     	{
       
   901         TRAP_IGNORE(AknsUtils::CreateIconL( skininstance,
       
   902                                 id,
       
   903                                 iPopupWndBgImg,
       
   904                                 bmpFileName,
       
   905                                 popWinBmpId ));
       
   906             
       
   907         AknIconUtils::SetSize(iPopupWndBgImg, iPopupItemSize, EAspectRatioNotPreserved); 
       
   908         TRAP_IGNORE(iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg ));
       
   909     	}
       
   910     	
       
   911     TInt focusBmpId = aReader.ReadInt16();
       
   912     TInt focusBmpMaskId = aReader.ReadInt16();
       
   913     TInt focusBmpSkinId = aReader.ReadInt16();
       
   914 
       
   915     id.Set( TInt( imgMajorSkinId ), focusBmpSkinId );
       
   916     
       
   917     if ( focusBmpId != KInvalidImg )
       
   918     	{
       
   919     	TRAP_IGNORE(AknsUtils::CreateIconL( skininstance,
       
   920                                 id,
       
   921                                 iPopupWndFocusImg,
       
   922                                 bmpFileName,
       
   923                                 focusBmpId ));
       
   924                                 
       
   925         AknIconUtils::SetSize(iPopupWndFocusImg, iPopupItemSize, EAspectRatioNotPreserved);  
       
   926 
       
   927         iPopupWnd->SetFocusBmp( iPopupWndFocusImg );
       
   928     	}
       
   929     }
       
   930       
       
   931 // ---------------------------------------------------------------------------
       
   932 // CAknFepVkbWindow::PopupAccentWindow
       
   933 // (other items were commented in a header).
       
   934 // ---------------------------------------------------------------------------
       
   935 //
       
   936 void CAknFepVkbWindow::PopupAccentWindow()
       
   937     {
       
   938     CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdAccentedButton);
       
   939     if ( accentBtn )
       
   940         {
       
   941         if (!iPopupInited)
       
   942             {
       
   943             TRAP_IGNORE(DoIdleConstructL());
       
   944             }
       
   945         
       
   946         TRect rect = accentBtn->Rect();   
       
   947         iPopupWnd->Display(rect);
       
   948         iAccentPopup = ETrue;                 
       
   949         }         
       
   950     }
       
   951     
       
   952 // ---------------------------------------------------------------------------
       
   953 // CAknFepVkbWindow::PopupAccentWindow
       
   954 // (other items were commented in a header).
       
   955 // ---------------------------------------------------------------------------
       
   956 //
       
   957 void CAknFepVkbWindow::PopupSwitchWindow()
       
   958     {
       
   959     CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdSwitchToHwrBtn);
       
   960     if ( accentBtn )
       
   961         {
       
   962         if (!iPopupInited)
       
   963             {
       
   964             TRAP_IGNORE(DoIdleConstructL());
       
   965             }
       
   966         
       
   967         iAccentPopup = ETrue;                 
       
   968         
       
   969        	TRAP_IGNORE( static_cast<CPeninputLayoutInputmodelChoice*>
       
   970 		    (Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->PopUpSwitchListL(accentBtn->Rect()) );
       
   971         }         
       
   972     }    
       
   973 // CAknFepVkbWindow::ResetAccentButton
       
   974 // (other items were commented in a header).
       
   975 // ---------------------------------------------------------------------------
       
   976 //
       
   977 void CAknFepVkbWindow::ResetAccentButton()
       
   978     {
       
   979     CFepUiBaseCtrl* accentBtn = Control(EAknFepVkbCtrlIdAccentedButton);
       
   980     if ( accentBtn )
       
   981         {
       
   982         accentBtn->SetActive(EFalse);
       
   983         
       
   984         TRect innerRect;
       
   985         CAknFepCtrlCommonButton* accentBtnCtrl = static_cast<CAknFepCtrlCommonButton*> (accentBtn);
       
   986         AknPenImageUtils::CalculateGraphicRect( accentBtn->Rect(), innerRect );
       
   987         accentBtnCtrl->SizeChanged(accentBtn->Rect(), innerRect, EFalse);                    
       
   988         iAccentPopup = EFalse;
       
   989 
       
   990         iClientArea->ActiveCurrentRange();
       
   991         }          
       
   992     }
       
   993     
       
   994 // ---------------------------------------------------------------------------
       
   995 // CAknFepVkbWindow::NeedCreateWord
       
   996 // (other items were commented in a header).
       
   997 // ---------------------------------------------------------------------------
       
   998 //
       
   999 TBool CAknFepVkbWindow::NeedCreateWord()
       
  1000 	{
       
  1001 	return iClientArea->NeedCreateWord();
       
  1002 	}
       
  1003 
       
  1004 void CAknFepVkbWindow::CloseAccentWindow()
       
  1005     {
       
  1006     if(iAccentPopup)
       
  1007         {
       
  1008         iPopupWnd->CloseWindow();
       
  1009         ResetAccentButton();
       
  1010         }
       
  1011     }
       
  1012     
       
  1013 // ---------------------------------------------------------------------------
       
  1014 // CAknFepVkbWindow::GetCreatedWordSpell
       
  1015 // (other items were commented in a header).
       
  1016 // ---------------------------------------------------------------------------
       
  1017 //
       
  1018 TPtrC CAknFepVkbWindow::GetCreatedWordSpell()
       
  1019     {
       
  1020     return iClientArea->GetCreatedWordSpell();
       
  1021     }
       
  1022 
       
  1023 // ---------------------------------------------------------------------------
       
  1024 // CAknFepVkbWindow::SetEnableSettingBtn
       
  1025 // (other items were commented in a header)
       
  1026 // ---------------------------------------------------------------------------
       
  1027 //     
       
  1028 void CAknFepVkbWindow::SetEnableSettingBtn(TBool aEnable)
       
  1029     {
       
  1030     CAknFepCtrlEventButton* optionBtn = static_cast<CAknFepCtrlEventButton*>
       
  1031         (Control( EPeninutWindowCtrlIdOptionBtn ) );    
       
  1032     if ( aEnable )    
       
  1033         {
       
  1034         optionBtn->SetDimmed(EFalse);
       
  1035         }
       
  1036     else
       
  1037         {
       
  1038         optionBtn->SetDimmed(ETrue);
       
  1039         optionBtn->SetActive(EFalse);
       
  1040         } 
       
  1041     } 
       
  1042 // --------------------------------------------------------------------------
       
  1043 // CAknFepVkbWindow::GetWindowResId
       
  1044 // (other items were commented in a header)
       
  1045 // --------------------------------------------------------------------------
       
  1046 //
       
  1047 TInt CAknFepVkbWindow::GetWindowResId()
       
  1048     {
       
  1049     if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  1050         {
       
  1051         return R_AKN_FEP_VKB_FSQ_WINDOW_INFO;
       
  1052         }
       
  1053     return R_AKN_FEP_VKB_WINDOW_INFO;        
       
  1054     }
       
  1055 
       
  1056 // --------------------------------------------------------------------------
       
  1057 // CAknFepVkbWindow::CreateCustomControlL
       
  1058 // (other items were commented in a header)
       
  1059 // --------------------------------------------------------------------------
       
  1060 //
       
  1061 TBool CAknFepVkbWindow::CreateCustomControlL( TInt16 aControlId, TInt32 aImageId )
       
  1062 	{
       
  1063 	TBool create = ETrue;
       
  1064     switch ( aControlId )
       
  1065         {
       
  1066         case EPeninutWindowCtrlIdMoveBtn:
       
  1067             {
       
  1068             if ( !iMoveButton )
       
  1069                 {
       
  1070                 iMoveButton = CAknFepCtrlDragButton::NewL(UiLayout(), EPeninutWindowCtrlIdMoveBtn);
       
  1071                 iMoveButton->SetImageFrameId( KAknsIIDQsnFrFunctionButtonNormal,
       
  1072         									  KAknsIIDQsnFrFunctionButtonPressed,
       
  1073         									  KAknsIIDQsnFrFunctionButtonInactive ); 
       
  1074                 AddControlL(iMoveButton);
       
  1075                 iMoveButton->AddPositionObserver(this);
       
  1076                 iMoveButton->AddEventObserver( UiLayout() );
       
  1077                 iMoveButton->SetResourceId( aImageId );
       
  1078                 UiLayout()->EnableLayoutMoving( static_cast<CDragBar*>( iMoveButton ) );
       
  1079                 }
       
  1080             iMoveButton->ConstructFromResourceL();
       
  1081             }
       
  1082             break;
       
  1083         case EPeninupWindowCtrlIdArrowLeftBtn:
       
  1084             {
       
  1085             if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1086                 {
       
  1087                 break;
       
  1088                 }
       
  1089 
       
  1090             if (!iArrowLeftButton)
       
  1091                 {
       
  1092 	            iArrowLeftButton = CAknFepCtrlRepeatButton::NewL( 
       
  1093 	                UiLayout(), aControlId, EVkbEventLeftArrow, EKeyLeftArrow, 
       
  1094 	            								  KAknsIIDQsnFrFunctionButtonNormal,
       
  1095 	        									  KAknsIIDQsnFrFunctionButtonPressed,
       
  1096 	        									  KAknsIIDQsnFrFunctionButtonInactive );
       
  1097                  AddControlL(iArrowLeftButton);
       
  1098                 iArrowLeftButton->AddEventObserver(UiLayout());
       
  1099                 iArrowLeftButton->SetResourceId( aImageId );
       
  1100                 }
       
  1101 
       
  1102             iArrowLeftButton->ConstructFromResourceL();
       
  1103             }
       
  1104             break;
       
  1105         case EPeninupWindowCtrlIdArrowRightBtn:
       
  1106             {
       
  1107             if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1108                 {
       
  1109                 break;
       
  1110                 }
       
  1111 
       
  1112             if (!iArrowRightButton)
       
  1113                 {
       
  1114 	            iArrowRightButton = CAknFepCtrlRepeatButton::NewL( 
       
  1115 	                UiLayout(), aControlId, EVkbEventRightArrow, EKeyRightArrow, 
       
  1116 	            								  KAknsIIDQsnFrFunctionButtonNormal,
       
  1117 	        									  KAknsIIDQsnFrFunctionButtonPressed,
       
  1118 	        									  KAknsIIDQsnFrFunctionButtonInactive );                
       
  1119                 AddControlL(iArrowRightButton);
       
  1120                 iArrowRightButton->AddEventObserver(UiLayout());
       
  1121                 iArrowRightButton->SetResourceId( aImageId );
       
  1122                 }
       
  1123             iArrowRightButton->ConstructFromResourceL();
       
  1124             }
       
  1125             break;
       
  1126         default:
       
  1127             {
       
  1128             create = EFalse;
       
  1129             }
       
  1130         }
       
  1131         return create;
       
  1132     }
       
  1133  
       
  1134 void CAknFepVkbWindow::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl)
       
  1135 	{
       
  1136 	AddControlL(aCtrl);
       
  1137 	}
       
  1138 	
       
  1139 void CAknFepVkbWindow::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType)
       
  1140     {
       
  1141     TRawEvent event; 
       
  1142     event.Set(aType,aScanCode);
       
  1143     
       
  1144     TPtrC eventPtr(reinterpret_cast<const TUint16*>(&event),sizeof(event)/sizeof(TUint16));
       
  1145 
       
  1146     UiLayout()->SignalOwner(ESignalSimulateEvent,eventPtr);
       
  1147     }	
       
  1148 	
       
  1149 void CAknFepVkbWindow::SetPromptTextL(TUint8* aData)
       
  1150     {
       
  1151     RDesReadStream readStream;
       
  1152 
       
  1153     TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt));
       
  1154 	  readStream.Open(countPtr);
       
  1155 	  CleanupClosePushL(readStream);
       
  1156     const TInt dataCount = readStream.ReadInt32L();
       
  1157 	  const TInt textCount = readStream.ReadInt32L();
       
  1158     CleanupStack::PopAndDestroy(&readStream);
       
  1159     
       
  1160     TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount );            
       
  1161 	  readStream.Open(ptr);
       
  1162 	  CleanupClosePushL(readStream);
       
  1163 	
       
  1164 	  HBufC8* dataBuf = HBufC8::NewLC(dataCount);
       
  1165 	  TPtr8 dataBufPtr = dataBuf->Des();
       
  1166 	  readStream.ReadL(dataBufPtr, dataCount);
       
  1167 
       
  1168     TFepPromptText* pIcfData = 
       
  1169         reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1170 
       
  1171     HBufC* textBuf;
       
  1172     if (textCount > 0)
       
  1173         {
       
  1174         textBuf = HBufC::NewLC(textCount/2);
       
  1175     	  TPtr textBufPtr = textBuf->Des();
       
  1176     	  readStream.ReadL(textBufPtr, textCount/2);
       
  1177         static_cast<CFepLayoutMultiLineIcf*>
       
  1178             (Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL
       
  1179                 (textBuf->Des(), pIcfData->iCleanContent);
       
  1180         CleanupStack::PopAndDestroy(textBuf);
       
  1181         }
       
  1182     else
       
  1183         {
       
  1184         static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF))->
       
  1185             SetPromptTextL( KNullDesC, pIcfData->iCleanContent );
       
  1186         }
       
  1187 
       
  1188     CleanupStack::PopAndDestroy(dataBuf);
       
  1189 	CleanupStack::PopAndDestroy(&readStream);
       
  1190     }    
       
  1191 
       
  1192 void CAknFepVkbWindow::ChangeMergedButtonStatus( 
       
  1193 											const TInt aIsShiftCase, 
       
  1194     								 		const TInt aIsCapslockCase )
       
  1195     {
       
  1196     iClientArea->ChangeMergedButtonStatus(aIsShiftCase, aIsCapslockCase);
       
  1197     }
       
  1198     
       
  1199 void CAknFepVkbWindow::ShowBubble(TInt aShow)
       
  1200     {
       
  1201     if (aShow > 0)
       
  1202         {
       
  1203         iClientArea->ShowBubble(ETrue);    
       
  1204         }
       
  1205     else
       
  1206         {
       
  1207         iClientArea->ShowBubble(EFalse);     
       
  1208         }
       
  1209     }
       
  1210     
       
  1211 void CAknFepVkbWindow::SetTextAlignmentL( TInt aAlignment )	
       
  1212 	{
       
  1213 	TInt currentLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage);
       
  1214 	
       
  1215 	if ( iInputContextField && currentLanguage != ELangNone )
       
  1216 		{
       
  1217 		iInputContextField->SetTextAlignmentL( aAlignment, currentLanguage );
       
  1218 		}
       
  1219 	}  
       
  1220 	
       
  1221 void CAknFepVkbWindow::UpdateICFTextL()
       
  1222     {
       
  1223     if( iInputContextField )
       
  1224         {
       
  1225         iInputContextField->UpdateSecretTextL();
       
  1226         }
       
  1227     }
       
  1228 
       
  1229 // --------------------------------------------------------------------------
       
  1230 // Show tooltip of ICF
       
  1231 // --------------------------------------------------------------------------
       
  1232 //
       
  1233 void CAknFepVkbWindow::ShowTooltipOnFSQL( const TDesC& aText )
       
  1234     {
       
  1235     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1236         {
       
  1237         return;
       
  1238         }    
       
  1239         
       
  1240     // Calculate tooltip width
       
  1241     const TPeninputCnTooltipBoxLayoutData& tooltipBoxLAF 
       
  1242                                       = iLafMgr->TooltipBoxLayoutData();
       
  1243     TRect tooltipRect = tooltipBoxLAF.iRect;
       
  1244     // Calculate inner rect
       
  1245     TRect innerRect = tooltipRect;
       
  1246     innerRect.iTl += TPoint( KTooltipLeftMargin, KTooltipTopMargin );
       
  1247     innerRect.iBr -= TPoint( KTooltipRightMargin, KTooltipBottomMargin );          
       
  1248     const CFont* font = tooltipBoxLAF.iFont;
       
  1249     // Set inner width in terms of text width
       
  1250     innerRect.SetWidth( font->TextWidthInPixels( aText ) );    
       
  1251     tooltipRect.iTl 
       
  1252            = innerRect.iTl - TPoint( KTooltipLeftMargin, KTooltipTopMargin );
       
  1253     tooltipRect.iBr 
       
  1254            = innerRect.iBr + TPoint( KTooltipRightMargin, KTooltipBottomMargin );
       
  1255     // Set tooltip rect in terms of inner rect
       
  1256     iInputContextField->ShowTooltipL( aText, tooltipRect );    
       
  1257     }
       
  1258 	
       
  1259 // --------------------------------------------------------------------------
       
  1260 // Hide tooltip of ICF
       
  1261 // --------------------------------------------------------------------------
       
  1262 //
       
  1263 void CAknFepVkbWindow::HideTooltipOnFSQ()
       
  1264     {
       
  1265     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1266         {
       
  1267         return;
       
  1268         }
       
  1269     iInputContextField->HideTooltip();
       
  1270     }
       
  1271 
       
  1272 // --------------------------------------------------------------------------
       
  1273 // Hide candidate list
       
  1274 // --------------------------------------------------------------------------
       
  1275 //
       
  1276 void CAknFepVkbWindow::HideCandidateListOnFSQ()
       
  1277     {
       
  1278     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1279         {
       
  1280         return;
       
  1281         }
       
  1282     iCandidateList->Hide( ETrue );
       
  1283     }
       
  1284 	
       
  1285 // --------------------------------------------------------------------------
       
  1286 // Show candidate list
       
  1287 // --------------------------------------------------------------------------
       
  1288 //
       
  1289 void CAknFepVkbWindow::ShowCandidateListOnFSQL(TInt aAlign, const CDesCArray* aItemArray,
       
  1290                                                    TInt aActiveIndex)
       
  1291     {
       
  1292     if (UiLayout()->PenInputType() != EPluginInputModeFSQ)
       
  1293         return;
       
  1294              
       
  1295     iCandidateList->ClearItemsL();
       
  1296     iCandidateList->SetTextAlignment((CGraphicsContext::TTextAlign) aAlign);
       
  1297 
       
  1298     if (aItemArray)
       
  1299         {
       
  1300 		CFepLayoutChoiceList::SItem item;
       
  1301 		item.iCommand = 0;
       
  1302 		
       
  1303         for (TInt i = 0; i < aItemArray->Count(); ++i)
       
  1304             {
       
  1305             if ((*aItemArray)[i].Length() <= item.iText.MaxLength())
       
  1306                 {
       
  1307                 item.iText.Copy((*aItemArray)[i]);
       
  1308                 }
       
  1309             else
       
  1310                 {
       
  1311                 // Given longer than maxlength, display the part of less than max
       
  1312                 item.iText.Copy((*aItemArray)[i].Left(item.iText.MaxLength()));
       
  1313                 }
       
  1314             iCandidateList->AddItemL(item);
       
  1315             }
       
  1316 
       
  1317         iCandidateList->SetCurrentFocusedIndex(aActiveIndex);
       
  1318         }
       
  1319     
       
  1320     CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
       
  1321          (Control(EPeninputWindowCtrlIdMultiLineICF)); 
       
  1322 
       
  1323     TPoint posBelow(0, 0);
       
  1324     TPoint posRight(0, 0);
       
  1325     posBelow = posRight = icf->Rect().iTl;
       
  1326     icf->InlineTextPos(posBelow, posRight);
       
  1327     TPoint tlPos = posRight;
       
  1328     iCandidateList->Display(TRect(tlPos, tlPos), 
       
  1329                             CFepLayoutPopupWnd::EDispBottomRight);
       
  1330     }
       
  1331 
       
  1332 // --------------------------------------------------------------------------
       
  1333 // Handle candidate list selected events.
       
  1334 // --------------------------------------------------------------------------
       
  1335 //
       
  1336 void CAknFepVkbWindow::HandleCandidateListSelectedOnFSQL
       
  1337                          ( CFepUiBaseCtrl* /*aCtrl*/, const TDesC& aEventData )
       
  1338     {
       
  1339     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1340         {
       
  1341         return;
       
  1342         }
       
  1343 
       
  1344     CFepLayoutChoiceList::SEvent* event = 
       
  1345             (CFepLayoutChoiceList::SEvent*)aEventData.Ptr();
       
  1346     if ( event->iIndex != KErrNotFound )
       
  1347         {
       
  1348         TPtrC ptr;
       
  1349         ptr.Set( reinterpret_cast<TUint16*>(&( event->iIndex ) ), 
       
  1350                  sizeof( TInt ) );            
       
  1351         UiLayout()->SignalOwner( ESignalSelectCandidate, ptr );
       
  1352         }
       
  1353     }
       
  1354 
       
  1355 // --------------------------------------------------------------------------
       
  1356 // Create a candidate list control.
       
  1357 // --------------------------------------------------------------------------
       
  1358 //    
       
  1359 void CAknFepVkbWindow::CreateCandidateListOnFSQL()
       
  1360     {
       
  1361     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
  1362         {
       
  1363         return;
       
  1364         }
       
  1365     
       
  1366     iCandidateList = CFepLayoutScrollableList::NewL( 
       
  1367                             UiLayout(), 
       
  1368                             EPentinputHwrCandidateList,
       
  1369                             TSize( 0, 0 ),
       
  1370                             0,
       
  1371                             0,
       
  1372                             TSize( 0, 0 ),
       
  1373                             TSize( 0, 0 ) );
       
  1374          
       
  1375     iCandidateList->SetImgFrId(KAknsIIDQsnFrPopupSub, 
       
  1376                                 KAknsIIDQsnFrFunctionButtonNormal,
       
  1377                                 KAknsIIDQsnFrFunctionButtonPressed,
       
  1378                                 KAknsIIDQsnFrFunctionButtonInactive,
       
  1379                                 KAknsIIDQsnFrList,
       
  1380                                 KAknsIIDQsnFrPopupSub);
       
  1381                                 
       
  1382     iCandidateList->SetResourceId(R_PENINPUT_FSQ_CANDIDATE_LIST);
       
  1383     iCandidateList->ConstructFromResourceL();
       
  1384     iCandidateList->SetPageInfoResID( R_PENINPUT_FSQ_CANDIDATE_LIST_PAGE_NUM );
       
  1385     iCandidateList->AddEventObserver( UiLayout() );
       
  1386     AddControlL(iCandidateList);    
       
  1387     }
       
  1388 
       
  1389 // --------------------------------------------------------------------------
       
  1390 // Retrieve text color from skin for candidiate list.
       
  1391 // --------------------------------------------------------------------------
       
  1392 //
       
  1393 const TRgb CAknFepVkbWindow::CandidateListTextColorOnFSQ()
       
  1394     {
       
  1395     TRgb matchlistcolor = KRgbBlack;
       
  1396     if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  1397         {
       
  1398         MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
       
  1399         AknsUtils::GetCachedColor( skininstance, 
       
  1400                                     matchlistcolor, 
       
  1401                                     KAknsIIDQsnTextColors,
       
  1402                                     EAknsCIQsnTextColorsCG43 );
       
  1403         }
       
  1404     
       
  1405     return matchlistcolor;
       
  1406     }
       
  1407 
       
  1408 // --------------------------------------------------------------------------
       
  1409 // Retrieve text color from skin for autocompletion part.
       
  1410 // --------------------------------------------------------------------------
       
  1411 //
       
  1412 const TRgb CAknFepVkbWindow::AutoCompletionPartColorOnFSQ()
       
  1413     {
       
  1414     TRgb matchlistcolor = KRgbBlack;
       
  1415     if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  1416         {
       
  1417         MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
       
  1418         AknsUtils::GetCachedColor( skininstance, 
       
  1419                                     matchlistcolor, 
       
  1420                                     KAknsIIDQsnTextColors,
       
  1421                                     EAknsCIQsnTextColorsCG64 );
       
  1422         }
       
  1423     
       
  1424     return matchlistcolor;
       
  1425     }
       
  1426 // --------------------------------------------------------------------------
       
  1427 // Set property for tooltip and candidate list.
       
  1428 // --------------------------------------------------------------------------
       
  1429 //
       
  1430 void CAknFepVkbWindow::SetITILayoutOnFSQ()
       
  1431 	{
       
  1432     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ 
       
  1433     		|| !iLafMgr || !iLafMgr->IsValid() )
       
  1434         {
       
  1435         return;
       
  1436         }
       
  1437     
       
  1438     // Addition for ITI features, read LAF data for candidate list
       
  1439     const TPeninputCnCandidateListLayoutData& candidateListLAF =    
       
  1440                                         iLafMgr->CandidateListLayoutData();
       
  1441     iCandidateList->SizeChanged( candidateListLAF.iSelectionItemSize, 
       
  1442                                  candidateListLAF.iSelectionHorMargin,
       
  1443                                  candidateListLAF.iSelectionVerMargin,
       
  1444                                  candidateListLAF.iSelectionNaviSize,
       
  1445                                  candidateListLAF.iSelectionNaviInnerSize );    
       
  1446     iCandidateList->SetPageInfoTextLineLayout
       
  1447                                 ( candidateListLAF.iSelectionPageTextLine );
       
  1448     
       
  1449     
       
  1450     const CFont* itemFont = candidateListLAF.iFont;    
       
  1451     TRgb textColor = CandidateListTextColorOnFSQ();
       
  1452     if ( itemFont )
       
  1453         {
       
  1454         // Set font defined in LAF
       
  1455         iCandidateList->SetTextProperty( itemFont, textColor );
       
  1456         }
       
  1457     else
       
  1458         {
       
  1459         // If font in LAF is NULL, set ICF text font to candidate list
       
  1460         iCandidateList->SetTextProperty( iLafMgr->ICFTextFont(), textColor );
       
  1461         }
       
  1462     
       
  1463     if ( iInputContextField )
       
  1464         {
       
  1465         // read LAF data for tooltip box
       
  1466         const TPeninputCnTooltipBoxLayoutData& tooltipBoxLAF 
       
  1467                                         = iLafMgr->TooltipBoxLayoutData();
       
  1468         iInputContextField->TooltipBubbleCtrl()->SetTextFormat( 
       
  1469                                         tooltipBoxLAF.iTooltipTextLayout );
       
  1470         iInputContextField->TooltipBubbleCtrl()->SetTextColorIndex( 
       
  1471                                         EAknsCIQsnTextColorsCG55 );
       
  1472         iInputContextField->TooltipBubbleCtrl()->SetBitmapParam(NULL,
       
  1473                                         NULL,
       
  1474                                         KAknsIIDQsnFrInputPreviewSideL,
       
  1475                                         KAknsIIDQsnFrInputPreviewMiddle,
       
  1476                                         KAknsIIDQsnFrInputPreviewSideR);        
       
  1477         iInputContextField->TooltipBubbleCtrl()->SetFrameDiff( KTooltipLeftMargin, 
       
  1478         		                                               KTooltipTopMargin,
       
  1479         		                                               KTooltipRightMargin,
       
  1480         		                                               KTooltipBottomMargin );        
       
  1481         // read color from skin for autocompletion part
       
  1482         iInputContextField->SetAutoCompleteTextColor( 
       
  1483                                         AutoCompletionPartColorOnFSQ() );        
       
  1484         }      
       
  1485     }
       
  1486 // End Of File