idlehomescreen/xmluirendering/renderingplugins/xnmenufactory/src/xnmenuadapter.cpp
changeset 1 5315654608de
parent 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
0:f72a12da539e 1:5315654608de
    68 const TInt KCBACommandSecond         = 6201;
    68 const TInt KCBACommandSecond         = 6201;
    69 const TInt KCBACommandMiddle         = 6202; 
    69 const TInt KCBACommandMiddle         = 6202; 
    70 
    70 
    71 const TInt KXnMenuArrayGranularity   = 6;
    71 const TInt KXnMenuArrayGranularity   = 6;
    72 const TInt KWideScreenWidth          = 640;
    72 const TInt KWideScreenWidth          = 640;
    73 
       
    74 _LIT( KMskIconDialer, "#dialer");
       
    75 
    73 
    76 using namespace XnPropertyNames;
    74 using namespace XnPropertyNames;
    77 
    75 
    78 static CXnNodePluginIf* FindChildL(CXnNodePluginIf& aNode, 
    76 static CXnNodePluginIf* FindChildL(CXnNodePluginIf& aNode, 
    79     const TDesC8& aType, const TDesC8& aTarget = KNullDesC8);
    77     const TDesC8& aType, const TDesC8& aTarget = KNullDesC8);
    91       iImageOn( EFalse ),  
    89       iImageOn( EFalse ),  
    92       iInvertMask( EFalse ),
    90       iInvertMask( EFalse ),
    93       iPreserveAspectRatio( EFalse ),            
    91       iPreserveAspectRatio( EFalse ),            
    94       iUpdateAppearance( ETrue ),
    92       iUpdateAppearance( ETrue ),
    95       iOwnBitmaps( ETrue ),
    93       iOwnBitmaps( ETrue ),
    96       iDefault( EFalse )
    94       iDefault( EFalse ),
    97 #if 0 // MSK icon change
       
    98 	  ,
       
    99       iId( KAknsIIDQsnIconColors ),
    95       iId( KAknsIIDQsnIconColors ),
   100       iBmpFile( NULL ),
    96       iBmpFile( NULL ),
   101       iBmp( 0 ),
    97       iBmp( 0 ),
   102       iBmpM( 0 )
    98       iBmpM( 0 )
   103 #endif // MSK icon change
       
   104         {
    99         {
   105         }  
   100         }  
   106                               
   101                               
   107     ~CXnSoftkeyItem()
   102     ~CXnSoftkeyItem()
   108         {
   103         {
   127             }
   122             }
   128         
   123         
   129         iImageOn = EFalse;        
   124         iImageOn = EFalse;        
   130         iInvertMask = EFalse;
   125         iInvertMask = EFalse;
   131         iPreserveAspectRatio = EFalse;
   126         iPreserveAspectRatio = EFalse;
   132 #if 0 // MSK icon change
       
   133         delete iBmpFile;
   127         delete iBmpFile;
   134         iBmpFile = NULL;
   128         iBmpFile = NULL;
   135 #endif // MSK icon change
       
   136         }        
   129         }        
   137         
   130         
   138     CXnNodePluginIf* iNode;
   131     CXnNodePluginIf* iNode;
   139     TInt             iPosition;
   132     TInt             iPosition;
   140     TInt             iCommandId;    
   133     TInt             iCommandId;    
   145     TBool            iInvertMask;
   138     TBool            iInvertMask;
   146     TBool            iPreserveAspectRatio;    
   139     TBool            iPreserveAspectRatio;    
   147     TBool            iUpdateAppearance;
   140     TBool            iUpdateAppearance;
   148     TBool            iOwnBitmaps;
   141     TBool            iOwnBitmaps;
   149     TBool            iDefault;
   142     TBool            iDefault;
   150 #if 0 // MSK icon change
       
   151     TAknsItemID      iId;
   143     TAknsItemID      iId;
   152     HBufC*           iBmpFile;
   144     HBufC*           iBmpFile;
   153     TInt32           iBmp;
   145     TInt32           iBmp;
   154     TInt32           iBmpM;
   146     TInt32           iBmpM;
   155 #endif // MSK icon change
       
   156     };
   147     };
   157 
   148 
   158 
   149 
   159 inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1, 
   150 inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1, 
   160     TAknWindowComponentLayout aLine2 ) 
   151     TAknWindowComponentLayout aLine2 ) 
  1102 // 
  1093 // 
  1103 // -----------------------------------------------------------------------------
  1094 // -----------------------------------------------------------------------------
  1104 //
  1095 //
  1105 void CXnMenuAdapter::SetSoftkeyAppearanceL( CXnSoftkeyItem& aItem )
  1096 void CXnMenuAdapter::SetSoftkeyAppearanceL( CXnSoftkeyItem& aItem )
  1106     {
  1097     {
  1107 #if 0 // MSK icon change
       
  1108     if( IsNodeVisibleL( *aItem.iNode) )
  1098     if( IsNodeVisibleL( *aItem.iNode) )
  1109         {
  1099         {
  1110         if( aItem.iImageOn )
  1100         if( aItem.iImageOn )
  1111             {
  1101             {
  1112             ChangeSoftkeyImageL( aItem );
  1102             ChangeSoftkeyImageL( aItem );
  1127 
  1117 
  1128             iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel );
  1118             iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel );
  1129             }
  1119             }
  1130         }
  1120         }
  1131     }
  1121     }
  1132 #else // MSK icon change
       
  1133     if( IsNodeVisibleL( *aItem.iNode) )
       
  1134         {
       
  1135         if( aItem.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition 
       
  1136             || aItem.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition)
       
  1137             {
       
  1138             if(aItem.iImageOn)
       
  1139                 {
       
  1140                 ChangeSoftkeyImageL(aItem);
       
  1141                 }
       
  1142             else if(aItem.iLabel)// change label
       
  1143                 {
       
  1144                 TBool left(EFalse);
       
  1145                 if(aItem.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition)
       
  1146                     {
       
  1147                     left = ETrue;
       
  1148                     }
       
  1149                 EikSoftkeyImage::SetLabel( iContainer,left );
       
  1150                 iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel );
       
  1151                 
       
  1152                 }
       
  1153                                    
       
  1154             }
       
  1155         else if(aItem.iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition)   
       
  1156             {
       
  1157             if( aItem.iLabel )
       
  1158                 {
       
  1159                 // Msk will have predefined image based on command id                                                            
       
  1160                 if( *aItem.iLabel == menu::KMSKDotImage16 )
       
  1161                     {
       
  1162                     aItem.iCommandId = KCBACommandFirst;
       
  1163                     }                                           
       
  1164                 else if(*aItem.iLabel == KMskIconDialer)
       
  1165                     {
       
  1166 #ifndef _AVKON_CBA_LSC                    
       
  1167                     aItem.iCommandId = EAknSoftkeyDialler;
       
  1168 #endif                    
       
  1169                     }
       
  1170                 else
       
  1171                     {
       
  1172                     aItem.iCommandId = KCBACommandMiddle;
       
  1173                     }
       
  1174                 iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel );
       
  1175                 }
       
  1176             }
       
  1177         }
       
  1178     }
       
  1179 #endif // MSK icon change
       
  1180 
  1122 
  1181 // -----------------------------------------------------------------------------
  1123 // -----------------------------------------------------------------------------
  1182 // CXnMenuAdapter::InitSoftkeyItemsL
  1124 // CXnMenuAdapter::InitSoftkeyItemsL
  1183 // 
  1125 // 
  1184 // -----------------------------------------------------------------------------
  1126 // -----------------------------------------------------------------------------
  1218     CXnNodePluginIf* node( aItem.iNode );
  1160     CXnNodePluginIf* node( aItem.iNode );
  1219     
  1161     
  1220     // No layout calulations needed
  1162     // No layout calulations needed
  1221     node->SetLayoutCapable( EFalse );                                                                 
  1163     node->SetLayoutCapable( EFalse );                                                                 
  1222 
  1164 
  1223 #if 0 // MSK icon change
       
  1224     if ( aItem.iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition )
  1165     if ( aItem.iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition )
  1225         {
  1166         {
  1226         aItem.iImageOn = ETrue;
  1167         aItem.iImageOn = ETrue;
  1227         return;
  1168         return;
  1228         }
  1169         }
  1229 #endif // MSK icon change
       
  1230 
  1170 
  1231     CXnProperty* pathProp( node->PathL() );
  1171     CXnProperty* pathProp( node->PathL() );
  1232     if( pathProp )
  1172     if( pathProp )
  1233         {     
  1173         {     
  1234         HBufC* bitmapPath( NULL );                                  
  1174         HBufC* bitmapPath( NULL );                                  
  1776 // 
  1716 // 
  1777 // -----------------------------------------------------------------------------
  1717 // -----------------------------------------------------------------------------
  1778 //
  1718 //
  1779 void CXnMenuAdapter::SetContainerL( CEikButtonGroupContainer& aContainer )
  1719 void CXnMenuAdapter::SetContainerL( CEikButtonGroupContainer& aContainer )
  1780     {
  1720     {
       
  1721     
       
  1722     User::LeaveIfNull( &aContainer );
       
  1723     
  1781     TBool updateNeeded( EFalse );
  1724     TBool updateNeeded( EFalse );
  1782     
  1725     
  1783     TInt statusPaneId( iAvkonAppUi->StatusPane()->CurrentLayoutResId() );
  1726     TInt statusPaneId( iAvkonAppUi->StatusPane()->CurrentLayoutResId() );
  1784     
  1727     
  1785     if(iPreviousMenuPaneId != statusPaneId)
  1728     if(iPreviousMenuPaneId != statusPaneId)
  1983         softkey->iNode->SetDirtyL();
  1926         softkey->iNode->SetDirtyL();
  1984                 
  1927                 
  1985         }
  1928         }
  1986     }
  1929     }
  1987 
  1930 
  1988 #if 0 // MSK icon change
       
  1989 // -----------------------------------------------------------------------------
  1931 // -----------------------------------------------------------------------------
  1990 // CXnMenuAdapter::SetSoftKeyImageL
  1932 // CXnMenuAdapter::SetSoftKeyImageL
  1991 // 
  1933 // 
  1992 // -----------------------------------------------------------------------------
  1934 // -----------------------------------------------------------------------------
  1993 //
  1935 //
  2037 
  1979 
  2038         // Image set, mark node as dirty
  1980         // Image set, mark node as dirty
  2039         softkey->iNode->SetDirtyL();
  1981         softkey->iNode->SetDirtyL();
  2040         }
  1982         }
  2041     }
  1983     }
  2042 #endif // MSK icon change
       
  2043 
  1984 
  2044 // -----------------------------------------------------------------------------
  1985 // -----------------------------------------------------------------------------
  2045 // CXnMenuAdapter::SetSoftKeyTextL
  1986 // CXnMenuAdapter::SetSoftKeyTextL
  2046 // 
  1987 // 
  2047 // -----------------------------------------------------------------------------
  1988 // -----------------------------------------------------------------------------
  2420 // CXnMenuAdapter::ChangeSoftkeyImageL
  2361 // CXnMenuAdapter::ChangeSoftkeyImageL
  2421 // ---------------------------------------------------------------------------
  2362 // ---------------------------------------------------------------------------
  2422 //
  2363 //
  2423 void CXnMenuAdapter::ChangeSoftkeyImageL(const CXnSoftkeyItem& aSoftkey)
  2364 void CXnMenuAdapter::ChangeSoftkeyImageL(const CXnSoftkeyItem& aSoftkey)
  2424     {
  2365     {
  2425 #if 0 // MSK icon change
       
  2426     if ( aSoftkey.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition || 
  2366     if ( aSoftkey.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition || 
  2427             aSoftkey.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition )
  2367             aSoftkey.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition )
  2428         {
  2368         {
  2429 #endif // MSK icon change
       
  2430         TSize size;
  2369         TSize size;
  2431         if(AknLayoutUtils::PenEnabled())
  2370         if(AknLayoutUtils::PenEnabled())
  2432             {
  2371             {
  2433             size = SoftkeyImageRect(*iContainer,aSoftkey.iPosition).Size();
  2372             size = SoftkeyImageRect(*iContainer,aSoftkey.iPosition).Size();
  2434             }
  2373             }
  2442 
  2381 
  2443         if(aSoftkey.iPosition != CEikButtonGroupContainer::ELeftSoftkeyPosition)
  2382         if(aSoftkey.iPosition != CEikButtonGroupContainer::ELeftSoftkeyPosition)
  2444             {
  2383             {
  2445             left = EFalse;
  2384             left = EFalse;
  2446             }
  2385             }
  2447         EikSoftkeyImage::SetImage( iContainer, *image, left );                        
  2386         EikSoftkeyImage::SetImage( iContainer, *image, left );
  2448 #if 0 // MSK icon change
       
  2449         }
  2387         }
  2450     else if ( aSoftkey.iBmpFile )
  2388     else if ( aSoftkey.iBmpFile )
  2451         {
  2389         {
  2452         CEikCba* cba = static_cast< CEikCba* >( iContainer->ButtonGroup() );
  2390         CEikCba* cba = static_cast< CEikCba* >( iContainer->ButtonGroup() );
  2453         // use iAvkonAppUi
  2391         // use iAvkonAppUi
  2458                 aSoftkey.iBmp,
  2396                 aSoftkey.iBmp,
  2459                 aSoftkey.iBmpM,
  2397                 aSoftkey.iBmpM,
  2460                 ETrue );
  2398                 ETrue );
  2461         cba->DrawNow();
  2399         cba->DrawNow();
  2462         }
  2400         }
  2463 #endif // MSK icon change
       
  2464     }
  2401     }
  2465 
  2402 
  2466 // ---------------------------------------------------------------------------
  2403 // ---------------------------------------------------------------------------
  2467 // CXnMenuAdapter::AddItemsToMenuPaneL
  2404 // CXnMenuAdapter::AddItemsToMenuPaneL
  2468 // ---------------------------------------------------------------------------
  2405 // ---------------------------------------------------------------------------
  2624     else if(targetProp)
  2561     else if(targetProp)
  2625         {
  2562         {
  2626         softkey->iImageOn = EFalse;
  2563         softkey->iImageOn = EFalse;
  2627         softkey->iLabel = FindSoftkeyLabelL(aNode);        
  2564         softkey->iLabel = FindSoftkeyLabelL(aNode);        
  2628         }
  2565         }
  2629 #if 0 // MSK icon change
       
  2630     else
  2566     else
  2631        {
  2567        {
  2632        InitSoftkeyItemImageL( *softkey );
  2568        InitSoftkeyItemImageL( *softkey );
  2633        }
  2569        }
  2634 #else // MSK icon change
  2570 
  2635     else if(softkey->iPosition != CEikButtonGroupContainer::EMiddleSoftkeyPosition)
       
  2636        { // we can't set own image to middle softkey
       
  2637        InitSoftkeyItemImageL( *softkey );
       
  2638        }
       
  2639 #endif // MSK icon change
       
  2640     softkey->iUpdateAppearance = ETrue;
  2571     softkey->iUpdateAppearance = ETrue;
  2641     iSoftkeyItems.AppendL(softkey);
  2572     iSoftkeyItems.AppendL(softkey);
  2642     CleanupStack::Pop(softkey);
  2573     CleanupStack::Pop(softkey);
  2643     return softkey;
  2574     return softkey;
  2644     }
  2575     }