textinput/peninputgenericitut/src/peninputitutwesternuistatespelling.cpp
branchRCL_3
changeset 7 a47de9135b21
parent 0 eb1f2e154e89
child 8 6ceef9a83b1a
equal deleted inserted replaced
3:f5a1e66df979 7:a47de9135b21
    23 #include <peninputcommonbutton.h>
    23 #include <peninputcommonbutton.h>
    24 #include <peninputlayout.h>
    24 #include <peninputlayout.h>
    25 #include <peninputcmd.h>
    25 #include <peninputcmd.h>
    26 #include <peninputlabel.h>
    26 #include <peninputlabel.h>
    27 
    27 
       
    28 // Fix bug for EZLG-7YUAP7
       
    29 #include <peninputrawkeybutton.h>
       
    30 
    28 #include "peninputitutwesternuistatespelling.h"
    31 #include "peninputitutwesternuistatespelling.h"
    29 #include "peninputgenericitutuimgrbase.h"
    32 #include "peninputgenericitutuimgrbase.h"
    30 #include "peninputgenericitutdatamgr.h"
    33 #include "peninputgenericitutdatamgr.h"
    31 #include "peninputgenericitutlayoutcontext.h"
    34 #include "peninputgenericitutlayoutcontext.h"
    32 #include "peninputgenericitutconverter.h"
    35 #include "peninputgenericitutconverter.h"
    33 #include "peninputitutcustomizationresourcemgr.h"
    36 #include "peninputitutcustomizationresourcemgr.h"
    34 #include "peninputgenericitutlayout.h"
    37 #include "peninputgenericitutlayout.h"
    35 #include "peninputcommonbgctrl.h"
    38 #include "peninputcommonbgctrl.h"
    36 #include "peninputgenericitutwindowmanager.h"
    39 #include "peninputgenericitutwindowmanager.h"
    37 #include "peninputgenericitutwindow.h"
    40 #include "peninputgenericitutwindow.h"
       
    41 #include <peninputlayoutbubblectrl.h>
    38 
    42 
    39 CWesternItutUiStateSpelling* CWesternItutUiStateSpelling::NewL(CGenericItutUiMgrBase* aOwner)
    43 CWesternItutUiStateSpelling* CWesternItutUiStateSpelling::NewL(CGenericItutUiMgrBase* aOwner)
    40     {
    44     {
    41     CWesternItutUiStateSpelling* self = new (ELeave) CWesternItutUiStateSpelling(aOwner);
    45     CWesternItutUiStateSpelling* self = new (ELeave) CWesternItutUiStateSpelling(aOwner);
    42     CleanupStack::PushL(self);
    46     CleanupStack::PushL(self);
   113     // update resource id of keypad
   117     // update resource id of keypad
   114     iOwner->DataMgr()->NotifyChangeControlLayout(
   118     iOwner->DataMgr()->NotifyChangeControlLayout(
   115         MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId);
   119         MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId);
   116 
   120 
   117     // hide not needed controls
   121     // hide not needed controls
   118     iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(ETrue);
   122     CFepUiBaseCtrl* baseCtrl = iOwner->LayoutContext()->Control(ECtrlIdSwitch);
       
   123     if ( baseCtrl )
       
   124         {
       
   125         baseCtrl->Hide(ETrue);
       
   126         }
   119     iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)->Hide(ETrue);
   127     iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)->Hide(ETrue);
   120     iOwner->LayoutContext()->Control(ECtrlIdArrowRight)->Hide(ETrue);
   128     iOwner->LayoutContext()->Control(ECtrlIdArrowRight)->Hide(ETrue);
   121     iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(ETrue);
   129     iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(ETrue);
   122     iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(ETrue);
   130     iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(ETrue);
   123     iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(ETrue);
   131     baseCtrl = iOwner->LayoutContext()->Control(ECtrlIdIndicator);
       
   132     if ( baseCtrl )
       
   133         {
       
   134         baseCtrl->Hide(ETrue);
       
   135         }
       
   136     // Fix bug for EZLG-7YUAP7 
       
   137     // Hide Chinese Arrow Up button and Arrow Down button 
       
   138     CAknFepCtrlRawKeyButton* upbtn = 
       
   139         static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowUp));
       
   140     CAknFepCtrlRawKeyButton* downbtn =  
       
   141         static_cast<CAknFepCtrlRawKeyButton *>(iOwner->LayoutContext()->Control(ECtrlIdArrowDown));
       
   142 
       
   143     if( upbtn )
       
   144         {
       
   145     	upbtn->Hide(ETrue);
       
   146         }
       
   147     
       
   148     if( downbtn )
       
   149     	{
       
   150     	downbtn->Hide(ETrue);
       
   151     	}
       
   152     //
       
   153 
   124 
   154 
   125     TAknTextLineLayout btntextformat = TItutDataConverter::AnyToTextLine(
   155     TAknTextLineLayout btntextformat = TItutDataConverter::AnyToTextLine(
   126                                                iOwner->DataMgr()->RequestData(EBtnTextLine));
   156                                                iOwner->DataMgr()->RequestData(EBtnTextLine));
   127     TAknTextLineLayout btntextCancel = TItutDataConverter::AnyToTextLine(
   157     TAknTextLineLayout btntextCancel = TItutDataConverter::AnyToTextLine(
   128                                                iOwner->DataMgr()->RequestData(ESpellTextCancle));
   158                                                iOwner->DataMgr()->RequestData(ESpellTextCancle));
   139     iOwner->DataMgr()->SetSpellMode(ETrue);
   169     iOwner->DataMgr()->SetSpellMode(ETrue);
   140     iICF->SetLineSeparatorAfterPrompt(ETrue);
   170     iICF->SetLineSeparatorAfterPrompt(ETrue);
   141     
   171     
   142     ReCalcLayoutL();
   172     ReCalcLayoutL();
   143     CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>
   173     CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>
   144                                       (iOwner->LayoutContext()->Control(ECtrlIdSpellIndicator));	
   174                                   (iOwner->LayoutContext()->Control(ECtrlIdSpellIndicator));
   145     indilabel->Hide( EFalse );
   175     if ( indilabel )
       
   176         {
       
   177         indilabel->Hide( EFalse );
       
   178         }
   146     iOwner->DataMgr()->SetUpdate(ETrue);
   179     iOwner->DataMgr()->SetUpdate(ETrue);
   147     }
   180     }
   148 
   181 
   149 void CWesternItutUiStateSpelling::OnExit()
   182 void CWesternItutUiStateSpelling::OnExit()
   150     {
   183     {
   151     CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>
   184     CAknFepCtrlLabel* indilabel = static_cast<CAknFepCtrlLabel*>
   152     								                  (iOwner->LayoutContext()->Control(ECtrlIdSpellIndicator));
   185                                   (iOwner->LayoutContext()->Control(ECtrlIdSpellIndicator));
   153     indilabel->Hide( ETrue );
   186     if ( indilabel )
       
   187         {
       
   188         indilabel->Hide( ETrue );
       
   189         }
   154     iOk->Hide(ETrue);
   190     iOk->Hide(ETrue);
   155     iCancel->Hide(ETrue);
   191     iCancel->Hide(ETrue);
   156     iOwner->DataMgr()->SetSpellMode(EFalse);
   192     iOwner->DataMgr()->SetSpellMode(EFalse);
   157     iICF->SetLineSeparatorAfterPrompt(EFalse);
   193     iICF->SetLineSeparatorAfterPrompt(EFalse);
   158     // Hide background of the spell popup window
   194     // Hide background of the spell popup window
   231 
   267 
   232     btnrect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(EItutPosCancel));
   268     btnrect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(EItutPosCancel));
   233     iCancel->SetTextFormat(btntextCancel);
   269     iCancel->SetTextFormat(btntextCancel);
   234     iCancel->SizeChanged(btnrect, btnrect, ETrue);
   270     iCancel->SizeChanged(btnrect, btnrect, ETrue);
   235     //iICF->SetRect( TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(ESpellICFRect)) );
   271     //iICF->SetRect( TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(ESpellICFRect)) );
   236     CFont* icffont = TItutDataConverter::AnyToFont(iOwner->DataMgr()->RequestData(EIcfFont));
   272     CFont* icffont;
       
   273     if ( iOwner->DataMgr()->IsPortraitWest() && 
       
   274             (!iOwner->DataMgr()->IsChineseGlobalLanguage()))
       
   275         {
       
   276         icffont = TItutDataConverter::AnyToFont(iOwner->DataMgr()->RequestData(ESpellFont));
       
   277         }
       
   278     else
       
   279         {
       
   280         icffont = TItutDataConverter::AnyToFont(iOwner->DataMgr()->RequestData(EIcfFont));
       
   281         }
   237     TRect rect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(ESpellICFRect) );
   282     TRect rect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(ESpellICFRect) );
   238     
   283     
   239     //rect.iTl.iY -= 50;
   284     //rect.iTl.iY -= 50;
   240     iICF->SetTextMargin ( 2,
   285     iICF->SetTextMargin ( 2,
   241     					  2,
   286     					  2,
   242     					  2,
   287     					  2,
   243     					  2);
   288     					  2);
   244  
   289  
   245     iICF->SetLineSpace( 1 );
   290     iICF->SetLineSpace( 1 );
   246     iICF->SizeChangedL(rect, 
   291     if ( iOwner->DataMgr()->IsPortraitWest() && 
   247                   //icffont->HeightInPixels(),
   292             (!iOwner->DataMgr()->IsChineseGlobalLanguage()))
   248                   iOwner->DataMgr()->iIcfTextHeight,
   293         {
   249                   icffont->FontMaxHeight(),
   294         iICF->SizeChangedL(rect, 
   250                   icffont);
   295                       iOwner->DataMgr()->iSpellIcfTextHeightForPrtWest,
       
   296                       icffont->FontMaxHeight(),
       
   297                       icffont);
       
   298         }
       
   299     else
       
   300         {
       
   301         iICF->SizeChangedL(rect, 
       
   302                       iOwner->DataMgr()->iIcfTextHeight,
       
   303                       icffont->FontMaxHeight(),
       
   304                       icffont);
       
   305         }
   251 
   306 
   252     CAknFepCtrlCommonButton* clrBtn = static_cast<CAknFepCtrlCommonButton*>(
   307     CAknFepCtrlCommonButton* clrBtn = static_cast<CAknFepCtrlCommonButton*>(
   253 									  iOwner->LayoutContext()->Control(ECtrlIdBackspace) );
   308 									  iOwner->LayoutContext()->Control(ECtrlIdBackspace) );
   254 	
   309 	
   255 	// When size changed in r-to-l language, it should be mirrored
   310 	// When size changed in r-to-l language, it should be mirrored
   262 	
   317 	
   263 	if( bSizedChanged && iOwner->DataMgr()->IsRtoLLanguage() )
   318 	if( bSizedChanged && iOwner->DataMgr()->IsRtoLLanguage() )
   264 		{
   319 		{
   265 		iOwner->UiManager()->Window()->HandleButtonResOnLangDirChange( ECtrlIdBackspace );			
   320 		iOwner->UiManager()->Window()->HandleButtonResOnLangDirChange( ECtrlIdBackspace );			
   266 		}
   321 		}
       
   322 	if ( iOwner->DataMgr()->IsPortraitWest() && 
       
   323 	        (!iOwner->DataMgr()->IsChineseGlobalLanguage()))
       
   324 	    {
       
   325 		iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)->Hide( EFalse );
       
   326 		iOwner->LayoutContext()->Control(ECtrlIdArrowRight)->Hide( EFalse );
       
   327 		
       
   328 	    // left button
       
   329 		CAknFepCtrlCommonButton* middleBtn = static_cast<CAknFepCtrlCommonButton*>(
       
   330 									  iOwner->LayoutContext()->Control(ECtrlIdArrowLeft));
       
   331 		TRect middleRect = TItutDataConverter::AnyToRect( 
       
   332 				iOwner->DataMgr()->RequestData(ESpellArrowLeft));
       
   333 		TRect middleInnerRect = TItutDataConverter::AnyToRect( 
       
   334 							iOwner->DataMgr()->RequestData(ESpellArrowLeftInner));
       
   335 		middleBtn->SizeChanged( middleRect, middleInnerRect, ETrue );
       
   336 	
       
   337 		// right button
       
   338 		middleBtn = static_cast<CAknFepCtrlCommonButton*>(
       
   339 									  iOwner->LayoutContext()->Control(ECtrlIdArrowRight));
       
   340 		middleRect = TItutDataConverter::AnyToRect( 
       
   341 				iOwner->DataMgr()->RequestData(ESpellArrowRight));
       
   342 		middleInnerRect = TItutDataConverter::AnyToRect( 
       
   343 							iOwner->DataMgr()->RequestData(ESpellArrowRightInner));
       
   344 		middleBtn->SizeChanged( middleRect, middleInnerRect, ETrue );
       
   345 		
       
   346 		// Indicator bubble
       
   347         TRect bubbleRect = TItutDataConverter::AnyToRect( 
       
   348                 iOwner->DataMgr()->RequestData( ESpellIndiPaneWithoutTextRect ));
       
   349         TRect iconRect = TItutDataConverter::AnyToRect( 
       
   350                 iOwner->DataMgr()->RequestData( ESpellIndiIconWithoutTextRect ));
       
   351         TSize offset( 0, 6 );
       
   352         TSize size( iconRect.Width(), iconRect.Height());
       
   353         
       
   354         iICF->MsgBubbleCtrl()->SetRect( bubbleRect );
       
   355         iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
       
   356         
       
   357         TBuf<100> text;
       
   358         iICF->MsgBubbleCtrl()->GetText( text );
       
   359         iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect());
       
   360 	    }
   267 	}
   361 	}
   268 	
   362 	
   269 // End Of File
   363 // End Of File