textinput/peninputgenericvkb/src/peninputgenericvkbwindow.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 11 c8fb4cf7b3ae
child 16 857bebeecec0
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
    34 #include <peninputrangebar.h>
    34 #include <peninputrangebar.h>
    35 #include <peninputdataconverter.h>
    35 #include <peninputdataconverter.h>
    36 #include <peninputdataprovider.h>
    36 #include <peninputdataprovider.h>
    37 #include <peninputclientlayoutinfo.h>
    37 #include <peninputclientlayoutinfo.h>
    38 #include <peninputlayoutchoicelist.h>
    38 #include <peninputlayoutchoicelist.h>
       
    39 #include <peninputlongpressbutton.h>
    39 
    40 
    40 #include <aknlayoutscalable_apps.cdl.h>
    41 #include <aknlayoutscalable_apps.cdl.h>
    41 #include <peninputlayoutbubblectrl.h>
    42 #include <peninputlayoutbubblectrl.h>
    42 #include <peninputscrollablelist.h>
    43 #include <peninputscrollablelist.h>
    43 
    44 
   162         case EPeninputLayoutEventMultiRange:
   163         case EPeninputLayoutEventMultiRange:
   163             {
   164             {
   164             if ( aCtrl->ControlId() == EPeninutWindowCtrlIdMultiRangeBtn )
   165             if ( aCtrl->ControlId() == EPeninutWindowCtrlIdMultiRangeBtn )
   165                 {
   166                 {
   166                 PopupChoiceList();
   167                 PopupChoiceList();
       
   168                 }
       
   169             }
       
   170             break;
       
   171         case EPeninputLayoutEventMultiRangeLongPress:
       
   172             {
       
   173             const TInt range = CPeninputDataConverter::AnyToInt(
       
   174                 iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
       
   175             
       
   176             const TInt langId = IntContext( EPeninputDataTypeInputLanguage );
       
   177 
       
   178             if ( aCtrl->ControlId() == EPeninutWindowCtrlIdMultiRangeBtn )
       
   179                 {
       
   180             
       
   181                 if ( range == ERangeAccent )
       
   182                     {
       
   183                     if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) )
       
   184                         {
       
   185                         ChangeRange(ERangeNative);
       
   186                         }
       
   187                     else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) )
       
   188                         {
       
   189                         ChangeRange(ERangeEnglish);
       
   190                         }
       
   191                     }
       
   192                 else if ( range == ERangeNative )
       
   193                     {            
       
   194                     if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNativeNumber ) )
       
   195                         {
       
   196                         
       
   197                         if ( langId != ELangArabic && langId != ELangFarsi 
       
   198                                 && langId != ELangUrdu && langId != ELangThai )
       
   199                             {
       
   200                                 ChangeRange(ERangeNativeNumber);
       
   201                             }
       
   202                         }
       
   203                     else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNumber ) )
       
   204                         {
       
   205                         if ( langId != ELangArabic && langId != ELangFarsi 
       
   206                                 && langId != ELangUrdu && langId != ELangThai )
       
   207                             {
       
   208                                 ChangeRange(ERangeNumber);
       
   209                             }                       
       
   210                         }
       
   211                     }
       
   212                 else if ( range == ERangeEnglish )
       
   213                     {
       
   214                     if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNumber ) )
       
   215                         {
       
   216                         ChangeRange(ERangeNumber);
       
   217                         }
       
   218                     }
       
   219                 else if ( range == ERangeNativeNumber )
       
   220                     {
       
   221                     if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) )
       
   222                         {
       
   223                         ChangeRange(ERangeNative);
       
   224                         }                   
       
   225                     else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) )
       
   226                         {
       
   227                         ChangeRange(ERangeEnglish);
       
   228                         }
       
   229                     }
       
   230                 else if ( range == ERangeNumber )
       
   231                     {
       
   232                     if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) )
       
   233                         {
       
   234                         ChangeRange(ERangeNative);
       
   235                         }                   
       
   236                     else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) )
       
   237                         {
       
   238                         ChangeRange(ERangeEnglish);
       
   239                         }                   
       
   240                     }
       
   241 
       
   242                 TRAP_IGNORE( UpdateRangeCtrlsL() );
   167                 }
   243                 }
   168             }
   244             }
   169             break;
   245             break;
   170         case EPeninputLayoutVkbEventResetShift: 
   246         case EPeninputLayoutVkbEventResetShift: 
   171             {
   247             {
  1148     else
  1224     else
  1149         {
  1225         {
  1150         resId = numberRangeResId; 
  1226         resId = numberRangeResId; 
  1151         }
  1227         }
  1152         
  1228         
  1153     rangeBtn->SetResourceId( resId );
  1229     if( rangeBtn->ResourceId() != resId )
  1154     rangeBtn->ConstructFromResourceL();
  1230     	{
       
  1231 		rangeBtn->SetResourceId( resId );
       
  1232 		rangeBtn->ConstructFromResourceL(); 
       
  1233     	}
       
  1234 
  1155     rangeBtn->SetDimmed( count < 1 );    
  1235     rangeBtn->SetDimmed( count < 1 );    
  1156     }
  1236     }
  1157 
  1237 
  1158 // ---------------------------------------------------------------------------
  1238 // ---------------------------------------------------------------------------
  1159 // Get resource ids of range button icon
  1239 // Get resource ids of range button icon
  1494         button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId, 
  1574         button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId, 
  1495             aEventId, aUnicode );
  1575             aEventId, aUnicode );
  1496         }
  1576         }
  1497     else
  1577     else
  1498         {
  1578         {
  1499         button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId, 
  1579         if ( aControlId == EPeninutWindowCtrlIdMultiRangeBtn )
  1500             aEventId, aUnicode,
  1580             {
  1501 			  KAknsIIDQsnFrFunctionButtonNormal,
  1581             button = CAknFepCtrlLongPressButton::NewL( UiLayout(), aControlId, 
  1502 			  KAknsIIDQsnFrFunctionButtonPressed,
  1582                 aEventId, aUnicode,
  1503 			  KAknsIIDQsnFrFunctionButtonInactive );
  1583                 KAknsIIDQsnFrFunctionButtonNormal,
       
  1584                 KAknsIIDQsnFrFunctionButtonPressed,
       
  1585                 KAknsIIDQsnFrFunctionButtonInactive );                
       
  1586             }
       
  1587         else
       
  1588             {
       
  1589             button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId, 
       
  1590                 aEventId, aUnicode,
       
  1591                 KAknsIIDQsnFrFunctionButtonNormal,
       
  1592                 KAknsIIDQsnFrFunctionButtonPressed,
       
  1593                 KAknsIIDQsnFrFunctionButtonInactive );        
       
  1594             }
  1504         }
  1595         }
  1505         
  1596         
  1506     CleanupStack::PushL( button );  
  1597     CleanupStack::PushL( button );  
  1507     if ( button )
  1598     if ( button )
  1508         {
  1599         {
  2477 		
  2568 		
  2478 // --------------------------------------------------------------------------
  2569 // --------------------------------------------------------------------------
  2479 // Show tooltip of ICF
  2570 // Show tooltip of ICF
  2480 // --------------------------------------------------------------------------
  2571 // --------------------------------------------------------------------------
  2481 //
  2572 //
  2482 void CPeninputGenericVkbWindow::ShowTooltipL( const TDesC& aText )
  2573 void CPeninputGenericVkbWindow::ShowTooltipL( const TDesC& aText, TInt aLangCode )
  2483     {
  2574     {
  2484     CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
  2575     CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
  2485                                 (Control(EPeninputWindowCtrlIdMultiLineICF));    
  2576                                 (Control(EPeninputWindowCtrlIdMultiLineICF));    
  2486     CPeninputGenericVkbLayout* layout 
  2577     CPeninputGenericVkbLayout* layout 
  2487                       = static_cast<CPeninputGenericVkbLayout*>( UiLayout() );    
  2578                       = static_cast<CPeninputGenericVkbLayout*>( UiLayout() );    
  2504     tooltipRect.iTl 
  2595     tooltipRect.iTl 
  2505            = innerRect.iTl - TPoint( KTooltipLeftMargin, KTooltipTopMargin );
  2596            = innerRect.iTl - TPoint( KTooltipLeftMargin, KTooltipTopMargin );
  2506     tooltipRect.iBr 
  2597     tooltipRect.iBr 
  2507            = innerRect.iBr + TPoint( KTooltipRightMargin, KTooltipBottomMargin );
  2598            = innerRect.iBr + TPoint( KTooltipRightMargin, KTooltipBottomMargin );
  2508     // Set tooltip rect in terms of inner rect
  2599     // Set tooltip rect in terms of inner rect
  2509     icf->ShowTooltipL( aText, tooltipRect );
  2600     icf->ShowTooltipL( aText, tooltipRect, aLangCode );
  2510     }
  2601     }
  2511 	
  2602 	
  2512 // --------------------------------------------------------------------------
  2603 // --------------------------------------------------------------------------
  2513 // Hide tooltip of ICF
  2604 // Hide tooltip of ICF
  2514 // --------------------------------------------------------------------------
  2605 // --------------------------------------------------------------------------
  2799     if ( icf )
  2890     if ( icf )
  2800         {
  2891         {
  2801         TAknTextLineLayout textLine = iLafMgr->IndiText();
  2892         TAknTextLineLayout textLine = iLafMgr->IndiText();
  2802         TRect bubbleRect = iLafMgr->IndiPaneRectWithText();
  2893         TRect bubbleRect = iLafMgr->IndiPaneRectWithText();
  2803         TRect iconRect = iLafMgr->IndiIconRectWithText();
  2894         TRect iconRect = iLafMgr->IndiIconRectWithText();
  2804         TSize offset( 60, 6 );
  2895         TSize offset;
       
  2896         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  2897         offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
  2805         TSize size( iconRect.Width(), iconRect.Height());
  2898         TSize size( iconRect.Width(), iconRect.Height());
  2806         
  2899         
  2807         icf->MsgBubbleCtrl()->SetRect( bubbleRect );
  2900         icf->MsgBubbleCtrl()->SetRect( bubbleRect );
  2808         icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
  2901         icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
  2809         icf->MsgBubbleCtrl()->SetTextFormat( textLine );
  2902         icf->MsgBubbleCtrl()->SetTextFormat( textLine );
  2817                                (Control(EPeninputWindowCtrlIdMultiLineICF));
  2910                                (Control(EPeninputWindowCtrlIdMultiLineICF));
  2818     if ( icf )
  2911     if ( icf )
  2819         {
  2912         {
  2820         TRect bubbleRect = iLafMgr->IndiPaneRectWithoutText();
  2913         TRect bubbleRect = iLafMgr->IndiPaneRectWithoutText();
  2821         TRect iconRect = iLafMgr->IndiIconRectWithoutText();
  2914         TRect iconRect = iLafMgr->IndiIconRectWithoutText();
  2822         TSize offset( 0, 6 );
  2915         TSize offset;
       
  2916         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
       
  2917         offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
  2823         TSize size( iconRect.Width(), iconRect.Height());
  2918         TSize size( iconRect.Width(), iconRect.Height());
  2824         
  2919         
  2825         icf->MsgBubbleCtrl()->SetRect( bubbleRect );
  2920         icf->MsgBubbleCtrl()->SetRect( bubbleRect );
  2826         icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
  2921         icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size );
  2827         }
  2922         }