idlehomescreen/widgetmanager/src/wmportalbutton.cpp
changeset 5 c743ef5928ba
parent 4 4d54b72983ae
child 9 f966699dea19
equal deleted inserted replaced
4:4d54b72983ae 5:c743ef5928ba
   318 //
   318 //
   319 TSize CWmPortalButton::LayoutIconSize() const
   319 TSize CWmPortalButton::LayoutIconSize() const
   320     {
   320     {
   321     TBool landscape = Layout_Meta_Data::IsLandscapeOrientation();
   321     TBool landscape = Layout_Meta_Data::IsLandscapeOrientation();
   322     TAknLayoutRect imageLayout;
   322     TAknLayoutRect imageLayout;
   323     imageLayout.LayoutRect( Rect(),
   323     if ( iWmMainContainer->Configuration().PortalButtonCount() == 1 )
   324         AknLayoutScalable_Apps::wgtman_btn_pane_g1(
   324         {
   325             landscape ? 1 : 0).LayoutLine() );
   325         imageLayout.LayoutRect( Rect(), AknLayoutScalable_Apps::
       
   326                 wgtman_btn_pane_g1( landscape ? 1 : 0).LayoutLine() );
       
   327         }
       
   328     else
       
   329         {
       
   330         TInt variety = (landscape ? 5 : 4);
       
   331         imageLayout.LayoutRect( Rect(), AknLayoutScalable_Apps
       
   332                 ::wgtman_btn_pane_g1( variety ).LayoutLine() );
       
   333         }
       
   334     
   326     return imageLayout.Rect().Size();
   335     return imageLayout.Rect().Size();
   327     }
   336     }
   328 
   337 
   329 // ---------------------------------------------------------
   338 // ---------------------------------------------------------
   330 // CWmPortalButton::SizeChanged
   339 // CWmPortalButton::SizeChanged
   437         
   446         
   438         // draw image if one exists
   447         // draw image if one exists
   439         if ( iButtonIcon && iButtonIconMask )
   448         if ( iButtonIcon && iButtonIconMask )
   440             {
   449             {
   441             TAknLayoutRect imageLayout;
   450             TAknLayoutRect imageLayout;
   442             imageLayout.LayoutRect( rect,
   451             if ( iWmMainContainer->Configuration().PortalButtonCount() == 1 )
   443                     AknLayoutScalable_Apps::wgtman_btn_pane_g1(
   452                 {
   444                             landscape ? 1 : 0).LayoutLine() );
   453                 imageLayout.LayoutRect( rect, AknLayoutScalable_Apps::
       
   454                         wgtman_btn_pane_g1( landscape ? 3 : 0).LayoutLine() );
       
   455                 }
       
   456             else
       
   457                 {
       
   458                 TInt variety = (landscape ? 7 : 4);
       
   459                 imageLayout.LayoutRect( rect, AknLayoutScalable_Apps
       
   460                         ::wgtman_btn_pane_g1( variety ).LayoutLine() );
       
   461                 }
   445             imageLayout.DrawImage( gc, iButtonIcon, iButtonIconMask );
   462             imageLayout.DrawImage( gc, iButtonIcon, iButtonIconMask );
   446             }
   463             }
   447         
   464         
   448         // draw text if portrait        
   465         // draw text if portrait        
   449         if ( !landscape )
   466         if ( !landscape )
   450             {
   467             {
   451             TAknTextComponentLayout leftLayout;
   468             TAknTextComponentLayout leftLayout;
   452             leftLayout = AknLayoutScalable_Apps::wgtman_btn_pane_t1( 
   469             TInt variety = 
   453                                                 landscape ? 1 : 0  );
   470                 ((iWmMainContainer->Configuration().PortalButtonCount()== 2)? 4:0 );
       
   471             leftLayout = AknLayoutScalable_Apps::wgtman_btn_pane_t1( variety  );
   454             DrawText( gc, state->Text(), leftLayout, 1 );
   472             DrawText( gc, state->Text(), leftLayout, 1 );
   455             }
   473             }
   456         }
   474         }
   457     }
   475     }
   458 
   476