textinput/peninputfingerhwrar/src/peninputfingerhwrarlafmanager.cpp
branchRCL_3
changeset 7 a47de9135b21
parent 3 f5a1e66df979
child 8 6ceef9a83b1a
equal deleted inserted replaced
3:f5a1e66df979 7:a47de9135b21
     1 /*
     1 /*
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 
    18 
    19 // INCLUDES
    19 // INCLUDES
    20 #include <aknlayoutscalable_avkon.cdl.h>
    20 #include <aknlayoutscalable_avkon.cdl.h>
    21 #include <aknlayoutscalable_apps.cdl.h>
    21 #include <aknlayoutscalable_apps.cdl.h>
    22 #include <AknUtils.h>
    22 #include <aknutils.h>
    23 
    23 
    24 #include "peninputfingerhwrarlafmanager.h"
    24 #include "peninputfingerhwrarlafmanager.h"
    25 #include "peninputfingerhwrarcontrolid.h"
    25 #include "peninputfingerhwrarcontrolid.h"
    26 
    26 
    27 #define LAF_MODIFY 1
    27 #define LAF_MODIFY 1
   264 										LayoutLine();
   264 										LayoutLine();
   265     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   265     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   266     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(1).
   266     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(1).
   267 										LayoutLine();
   267 										LayoutLine();
   268     btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane); 
   268     btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane); 
   269     iRectBtnImeSwitch = btnbgRect.Rect();
       
   270     
   269     
   271     // Arrow up button
   270     // Arrow up button
   272     btnpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_pane( 1 , 2 , 0 ).
   271     btnpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_pane( 1 , 2 , 0 ).
   273 										LayoutLine();
   272 										LayoutLine();
   274     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   273     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   317     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   316     btnRect.LayoutRect(btnrowRect.Rect(), btnpane);
   318     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(0).
   317     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(0).
   319 										LayoutLine();
   318 										LayoutLine();
   320 	btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane);									    
   319 	btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane);									    
   321     
   320     
   322     iRectFixSctpad = btnrowRect.Rect();
   321 
   323     iSizeFixSctpadCell = btnRect.Rect().Size();
       
   324     iRectSpase = btnbgRect.Rect();
       
   325     iRectSpase.Move(-iRectFixSctpad.iTl );
       
   326 
   322 
   327     // Enter button
   323     // Enter button
   328     btnpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_pane( 0 , 1 , 0 ).
   324     btnpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_pane( 0 , 1 , 0 ).
   329 										LayoutLine();
   325 										LayoutLine();
   330 	btnRect.LayoutRect(btnrowRect.Rect(), btnpane);																		
   326 	btnRect.LayoutRect(btnrowRect.Rect(), btnpane);																		
   331     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(0).
   327     btnbgpane = AknLayoutScalable_Avkon::fshwr2_func_candi_cell_bg_pane(0).
   332 										LayoutLine();									
   328 										LayoutLine();									
   333 	btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane);
   329 	btnbgRect.LayoutRect(btnRect.Rect(), btnbgpane);
   334 										    
   330 										    
   335     iRectEnter = btnbgRect.Rect();
   331     iRectEnter = btnbgRect.Rect();
   336     iRectEnter.Move(-iRectFixSctpad.iTl);
       
   337 
   332 
   338     
   333     
   339     // Writing box
   334     // Writing box
   340     TAknWindowLineLayout writingboxpane;
   335     TAknWindowLineLayout writingboxpane;
   341     TAknLayoutRect boxRect;
   336     TAknLayoutRect boxRect;
   388     iBubbleFont = previewWndText.Font();
   383     iBubbleFont = previewWndText.Font();
   389     //==========================================================================
   384     //==========================================================================
   390     // going to be removed if the LAF data is ready
   385     // going to be removed if the LAF data is ready
   391     //
   386     //
   392     #ifdef HackerVersion
   387     #ifdef HackerVersion
   393 	
   388 	const TUint KMarginLayout = 4;
   394 	// hardcode those and remove them after the laf data is ready
   389 	// hardcode those and remove them after the laf data is ready
   395 	// do we really need to read ui data from laf system?
   390 	// do we really need to read ui data from laf system?
   396 	// icf margins
   391 	// icf margins
   397 	iIcfTextLeftMarginCn = 14;
   392 	iIcfTextLeftMarginCn = 14;
   398 	iIcfTextRightMarginCn = 14;
   393 	iIcfTextRightMarginCn = 14;
   404 	iCandsHorizontalMargin = 1;
   399 	iCandsHorizontalMargin = 1;
   405     iCandsVerticalMargin = 1;
   400     iCandsVerticalMargin = 1;
   406 	
   401 	
   407     if(iIsLandscape)
   402     if(iIsLandscape)
   408     	{
   403     	{
   409     	TInt buttonHight = (iLayoutRect.Height()-20)/6;//-6; // 1mm ~= 6 pixls
   404     	TInt buttonHight = (iLayoutRect.Height()-2*KMarginLayout)/6;//-6; // 1mm ~= 6 pixls
   410         TInt buttonWidth = (iLayoutRect.Width()-20)/8;//-8;
   405         TInt buttonWidth = (iLayoutRect.Width()-2*KMarginLayout)/8;//-8;
   411     	
   406     	
   412     	iRectBtnClose = TRect(iLayoutRect.iTl+TPoint(10,10),TPoint(buttonWidth+10,buttonHight+10));
   407     	iRectBtnClose = TRect(iLayoutRect.iTl+TPoint(KMarginLayout,KMarginLayout),TPoint(buttonWidth+KMarginLayout,buttonHight+KMarginLayout));
   413     	
   408     	
   414     	iRectBtnOption = iRectBtnClose;
   409     	iRectBtnOption = iRectBtnClose;
   415     	iRectBtnOption.Move(TPoint(buttonWidth,0));
   410     	iRectBtnOption.Move(TPoint(buttonWidth,0));
   416     	
   411     	
   417     	iRectBtnRangeSmb = iRectBtnOption;
   412     	iRectBtnRangeSmb = iRectBtnOption;
   431         iRectBtnArrowLeft.Move(TPoint(buttonWidth,0));
   426         iRectBtnArrowLeft.Move(TPoint(buttonWidth,0));
   432         
   427         
   433         iRectBtnArrowRight = iRectBtnArrowLeft;
   428         iRectBtnArrowRight = iRectBtnArrowLeft;
   434         iRectBtnArrowRight.Move(TPoint(buttonWidth,0));
   429         iRectBtnArrowRight.Move(TPoint(buttonWidth,0));
   435         
   430         
   436         // fix symbol table
   431 		iSizeBtnPadding = TSize(6,6);
   437         TPoint fixSctTl = iRectBtnClose.iTl+TPoint(0,buttonHight);
   432 
   438         iRectFixSctpad = TRect(fixSctTl,fixSctTl+TPoint(4*buttonWidth,buttonHight));
       
   439 	    
   433 	    
   440 	    iRectSpase = iRectBtnClose;
   434 	    iRectSpase = iRectBtnClose;
   441 	    iRectSpase.Move(TPoint(0,buttonHight));
   435 	    iRectSpase.Move(TPoint(0,buttonHight));
   442 	    
   436 	    
   443 	    iRectEnter = iRectSpase;
   437 	    iRectEnter = iRectSpase;
   444 	    iRectEnter.Move(TPoint(buttonWidth,0));
   438 	    iRectEnter.Move(TPoint(buttonWidth,0));
   445 	            
   439 	            
   446 	    iRectSpase.Move(-iRectFixSctpad.iTl );
   440 
   447 	    iRectEnter.Move(-iRectFixSctpad.iTl );
       
   448 	    
       
   449 	    iSizeFixSctpadCell = iRectSpase.Size();
       
   450 	    
   441 	    
   451         // candate position
   442         // candate position
   452         iCandidateLTPos = iRectBtnClose.iTl + TPoint(0,buttonHight);
   443         iCandidateLTPos = iRectBtnClose.iTl + TPoint(0,buttonHight);
   453     	iCandsUnitWidth = buttonWidth-iCandsVerticalMargin;
   444     	iCandsUnitWidth = buttonWidth-iCandsVerticalMargin;
   454         iCandsUnitHeight = buttonHight;
   445         iCandsUnitHeight = buttonHight;
   455 		
   446 		
   456     	// icf editor rect
   447     	// icf editor rect
   457     	iRectIcf = TRect(TPoint(4*buttonWidth+10,10),TPoint(iLayoutRect.iBr.iX-10,2*buttonHight+10));
   448     	iRectIcf = TRect(TPoint(4*buttonWidth+KMarginLayout,KMarginLayout),TPoint(iLayoutRect.iBr.iX-KMarginLayout,2*buttonHight+KMarginLayout));
   458     	
   449     	
   459     	// iwriting box
   450     	// iwriting box
   460     	iRectWritingBox	= TRect(TPoint(10,2*buttonHight+10),iLayoutRect.iBr-TPoint(10,10));
   451     	iRectWritingBox	= TRect(TPoint(KMarginLayout,2*buttonHight+KMarginLayout),iLayoutRect.iBr-TPoint(KMarginLayout,KMarginLayout));
   461     	
   452     	
   462     	// construct symbol table
   453     	// construct symbol table
   463     	iRectOfSymbolTable = iRectWritingBox;
   454     	iRectOfSymbolTable = iRectWritingBox;
   464     	iRectOfSymbolTable.Move(TPoint(buttonWidth,-buttonHight));
   455     	iRectOfSymbolTable.Move(TPoint(buttonWidth,-buttonHight));
   465     	iRectOfSymbolTable.SetHeight(5*buttonHight);
   456     	iRectOfSymbolTable.SetHeight(5*buttonHight);
   487     	    }
   478     	    }
   488         }
   479         }
   489     else
   480     else
   490     	{
   481     	{
   491         // icf rect
   482         // icf rect
   492         iRectIcf = TRect(iLayoutRect.iTl+TPoint(10,10),TPoint(iLayoutRect.iBr.iX-10,22.5*9));
   483         iRectIcf = TRect(iLayoutRect.iTl+TPoint(KMarginLayout,KMarginLayout),TPoint(iLayoutRect.iBr.iX-KMarginLayout,22.5*9));
   493         TPoint backSpaceTl = iRectIcf.iTl+TPoint(0,iRectIcf.Height());
   484         
   494         
   485 		TInt buttonHight = (iLayoutRect.Height()-iRectIcf.Height()-2*KMarginLayout)/6;//(15*9)/2; // 1mm ~= 9pixls
   495 		TInt buttonHight = (iLayoutRect.Height()-iRectIcf.Height()-20)/6;//(15*9)/2; // 1mm ~= 9pixls
   486         TInt buttonWidth = (iLayoutRect.Width()-2*KMarginLayout)/4;
   496         TInt buttonWidth = (iLayoutRect.Width()-20)/4;
       
   497 		
   487 		
   498         // the button on second row
   488         // the button on second row
   499         iRectBtnBackspace = TRect(backSpaceTl,backSpaceTl+TPoint(buttonWidth,buttonHight));
   489 		TPoint firstButtonTl = iRectIcf.iTl+TPoint(0,iRectIcf.Height());
   500         iRectBtnOption = iRectBtnBackspace;
   490 		iRectBtnClose = TRect(firstButtonTl,firstButtonTl+TPoint(buttonWidth,buttonHight));
       
   491 
       
   492         iRectBtnOption = iRectBtnClose;
   501         iRectBtnOption.Move(TPoint(buttonWidth,0));
   493         iRectBtnOption.Move(TPoint(buttonWidth,0));
   502         iRectBtnRangeSmb = iRectBtnOption;
   494         
       
   495 		iRectBtnRangeSmb = iRectBtnOption;
   503         iRectBtnRangeSmb.Move(TPoint(buttonWidth,0));
   496         iRectBtnRangeSmb.Move(TPoint(buttonWidth,0));
   504         iRectBtnClose = iRectBtnRangeSmb;
   497         
   505         iRectBtnClose.Move(TPoint(buttonWidth,0));
   498 		iRectBtnBackspace = iRectBtnRangeSmb;
       
   499         iRectBtnBackspace.Move(TPoint(buttonWidth,0));
   506         
   500         
   507         // arrow button: on third row
   501         // arrow button: on third row
   508         iRectBtnArrowUp = iRectBtnBackspace;
   502         iRectBtnArrowUp = iRectBtnClose;
   509         iRectBtnArrowUp.Move(TPoint(0,buttonHight));
   503         iRectBtnArrowUp.Move(TPoint(0,buttonHight));
   510         
   504         
   511         iRectBtnArrowDown = iRectBtnArrowUp;
   505         iRectBtnArrowDown = iRectBtnArrowUp;
   512         iRectBtnArrowDown.Move(TPoint(buttonWidth,0));
   506         iRectBtnArrowDown.Move(TPoint(buttonWidth,0));
   513         
   507         
   514         iRectBtnArrowLeft = iRectBtnArrowDown;
   508         iRectBtnArrowLeft = iRectBtnArrowDown;
   515         iRectBtnArrowLeft.Move(TPoint(buttonWidth,0));
   509         iRectBtnArrowLeft.Move(TPoint(buttonWidth,0));
   516         
   510         
   517         iRectBtnArrowRight = iRectBtnArrowLeft;
   511         iRectBtnArrowRight = iRectBtnArrowLeft;
   518         iRectBtnArrowRight.Move(TPoint(buttonWidth,0));
   512         iRectBtnArrowRight.Move(TPoint(buttonWidth,0));
   519        
   513         
       
   514         // button padding
       
   515 		iSizeBtnPadding = TSize(6,6);
       
   516 		
   520         // candate position
   517         // candate position
   521         iCandidateLTPos = iRectBtnBackspace.iTl + TPoint(0,buttonHight);
   518         iCandidateLTPos = iRectBtnClose.iTl + TPoint(0,buttonHight);
   522         iCandsUnitWidth = buttonWidth-iCandsVerticalMargin;
   519         iCandsUnitWidth = buttonWidth-iCandsVerticalMargin;
   523         iCandsUnitHeight = buttonHight;
   520         iCandsUnitHeight = buttonHight;
   524 		
   521 		
   525         // HWR Box Rect
   522         // HWR Box Rect
   526         iRectWritingBox = TRect(TPoint(iRectBtnArrowUp.iTl.iX,iRectBtnArrowUp.iBr.iY),iLayoutRect.iBr-TPoint(10,10));
   523         iRectWritingBox = TRect(TPoint(iRectBtnArrowUp.iTl.iX,iRectBtnArrowUp.iBr.iY),iLayoutRect.iBr-TPoint(KMarginLayout,KMarginLayout));
   527 		
   524 		
   528 		// construct symbol table
   525 		// construct symbol table
   529     	iRectOfSymbolTable = iRectWritingBox;
   526     	iRectOfSymbolTable = iRectWritingBox;
   530     	iRectOfSymbolTable.Move(TPoint(0,-buttonHight));
   527     	iRectOfSymbolTable.Move(TPoint(0,-buttonHight));
   531     	iRectOfSymbolTable.SetHeight(5*buttonHight);
   528     	iRectOfSymbolTable.SetHeight(5*buttonHight);
   629             }
   626             }
   630         case EHwrCtrlIdLanguageOption:
   627         case EHwrCtrlIdLanguageOption:
   631             {
   628             {
   632             return iRectBtnOption;
   629             return iRectBtnOption;
   633             }
   630             }
   634         case EHwrCtrlIdVkbSwitcher:
       
   635             {
       
   636             return iRectBtnImeSwitch;
       
   637             }
       
   638         case EHwrCtrlId3Page1Btn:
   631         case EHwrCtrlId3Page1Btn:
   639         case EHwrCtrlId3Page2Btn:
   632         case EHwrCtrlId3Page2Btn:
   640         case EHwrCtrlId3Page3Btn:
   633         case EHwrCtrlId3Page3Btn:
   641 		case EHwrCtrlId2Page1Btn:
   634 		case EHwrCtrlId2Page1Btn:
   642         case EHwrCtrlId2Page2Btn:
   635         case EHwrCtrlId2Page2Btn:
   734 //
   727 //
   735 TSize CPeninputFingerHwrArLafManager::ButtonInnerPadding()
   728 TSize CPeninputFingerHwrArLafManager::ButtonInnerPadding()
   736     {
   729     {
   737     return iSizeBtnPadding;
   730     return iSizeBtnPadding;
   738     }
   731     }
   739 
   732     
   740 
       
   741 // ---------------------------------------------------------------------------
       
   742 // get cell size of virtual numpad.
       
   743 // ---------------------------------------------------------------------------
       
   744 //
       
   745 TRect CPeninputFingerHwrArLafManager::VirtualNumpadCellSize()
       
   746     {
       
   747     return iSizeNumpadCell;
       
   748     }
       
   749     
       
   750 
       
   751 // ---------------------------------------------------------------------------
       
   752 // get text layout of virtual numpad.
       
   753 // ---------------------------------------------------------------------------
       
   754 //
       
   755 TAknTextLineLayout CPeninputFingerHwrArLafManager::NumpadKeyTxtLayout()
       
   756     {
       
   757     TAknTextLineLayout layout = AknLayoutScalable_Avkon::
       
   758         cell_fshwr2_syb_bg_pane_t1(0).LayoutLine();
       
   759     return layout;    
       
   760     }
       
   761 
   733 
   762 // ---------------------------------------------------------------------------
   734 // ---------------------------------------------------------------------------
   763 // get row count of virtual sctpad.
   735 // get row count of virtual sctpad.
   764 // ---------------------------------------------------------------------------
   736 // ---------------------------------------------------------------------------
   765 //
   737 //
   782 // ---------------------------------------------------------------------------
   754 // ---------------------------------------------------------------------------
   783 //
   755 //
   784 TRect CPeninputFingerHwrArLafManager::VirtualSctpadCellSize()
   756 TRect CPeninputFingerHwrArLafManager::VirtualSctpadCellSize()
   785     {
   757     {
   786     return iSizeSctpadCell;
   758     return iSizeSctpadCell;
   787     }
       
   788 
       
   789 // ---------------------------------------------------------------------------
       
   790 // get cell size of virtual sctpad.
       
   791 // ---------------------------------------------------------------------------
       
   792 //
       
   793 TRect CPeninputFingerHwrArLafManager::FixVirtualSctpadCellSize()
       
   794     {
       
   795     return iSizeFixSctpadCell;
       
   796     }
   759     }
   797     
   760     
   798     
   761     
   799 // ---------------------------------------------------------------------------
   762 // ---------------------------------------------------------------------------
   800 // get preview bubble rect.
   763 // get preview bubble rect.
   847         aArrayRects.Append(absoluteRect);
   810         aArrayRects.Append(absoluteRect);
   848         } 
   811         } 
   849     }
   812     }
   850 
   813 
   851 // ---------------------------------------------------------------------------
   814 // ---------------------------------------------------------------------------
   852 // get space and enter key rect.
       
   853 // ---------------------------------------------------------------------------
       
   854 //
       
   855 void CPeninputFingerHwrArLafManager::GetFixVirtualKeyRects( RArray<TRect>& aArrayRects )
       
   856     {   
       
   857     aArrayRects.Reset();
       
   858     aArrayRects.Append( iRectSpase );
       
   859     aArrayRects.Append( iRectEnter );
       
   860     }
       
   861 
       
   862 // ---------------------------------------------------------------------------
       
   863 // get text layout of virtual sctpad.
   815 // get text layout of virtual sctpad.
   864 // ---------------------------------------------------------------------------
   816 // ---------------------------------------------------------------------------
   865 //
   817 //
   866 TAknTextLineLayout CPeninputFingerHwrArLafManager::SctpadKeyTxtLayout()
   818 TAknTextLineLayout CPeninputFingerHwrArLafManager::SctpadKeyTxtLayout()
   867     {
   819     {