idlehomescreen/widgetmanager/src/wmlistbox.cpp
branchRCL_3
changeset 19 79311d856354
parent 18 d05a55b217df
child 23 7be2816dbabd
--- a/idlehomescreen/widgetmanager/src/wmlistbox.cpp	Wed Apr 14 15:47:59 2010 +0300
+++ b/idlehomescreen/widgetmanager/src/wmlistbox.cpp	Tue Apr 27 16:26:12 2010 +0300
@@ -146,28 +146,6 @@
 	}
 
 // ---------------------------------------------------------
-// CWmListItemDrawer::ResizeDefaultBitmaps
-// ---------------------------------------------------------
-//
-void CWmListItemDrawer::ResizeDefaultBitmaps()
-    {
-	TAknWindowLineLayout logoPane = 
-	          AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine();
-
-    TAknLayoutRect layoutRect;
-    TRect rect = TRect( ItemCellSize() );
-    layoutRect.LayoutRect( rect, logoPane );
-    
-    // RESIZE DEFAULT LOGO BITMAPS ACCORDING TO LAYOUT
-    TSize size = layoutRect.Rect().Size();
-    AknIconUtils::SetSize( 
-        iDefaultLogoImage, size, EAspectRatioPreserved );
-    AknIconUtils::SetSize( 
-        iDefaultLogoImageMask, size, EAspectRatioPreserved );
-    }
-	
-
-// ---------------------------------------------------------
 // CWmListItemDrawer::UpdateItemHeight
 // ---------------------------------------------------------
 //
@@ -182,7 +160,7 @@
         ::listrow_wgtman_pane().LayoutLine();
     TAknLayoutRect listRowPaneRect;
     listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane );
-    iListBox->View()->SetItemHeight( listRowPaneRect.Rect().Height() );
+    TRAP_IGNORE( iListBox->SetItemHeightL( listRowPaneRect.Rect().Height() ); );
     iListBox->View()->ItemDrawer()->SetItemCellSize( listRowPaneRect.Rect().Size() );
     }
 
@@ -221,21 +199,38 @@
                                   KAknsIIDQsnFrList,
                                   KAknsIIDQsnFrListCenter );
         }
-    
     // DRAW LOGO
     CFbsBitmap* bitmap = const_cast<CFbsBitmap*>(wData.LogoImage());
     CFbsBitmap* mask = const_cast<CFbsBitmap*>(wData.LogoImageMask());
     TAknLayoutRect logoLayout;
     logoLayout.LayoutRect( itemRect,
              AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
-
-    if ( !bitmap && !wData.IsPrepairingLogo() )
+    if ( ( !bitmap || !mask ) && iDefaultLogoImage && iDefaultLogoImageMask )
         {
-        logoLayout.DrawImage( gc, iDefaultLogoImage, iDefaultLogoImageMask );
+        // real logo missing use default
+        TSize size = logoLayout.Rect().Size();
+        if ( iDefaultLogoImage->SizeInPixels() != size )
+            {
+            // Resize default icons only when they are really needed
+            AknIconUtils::SetSize( 
+                iDefaultLogoImage, size, EAspectRatioPreserved );
+            AknIconUtils::SetSize( 
+                iDefaultLogoImageMask, size, EAspectRatioPreserved );
+            }
+    
+        gc.DrawBitmapMasked( logoLayout.Rect(), 
+                iDefaultLogoImage, 
+                TRect(TPoint(0, 0), iDefaultLogoImage->SizeInPixels()), 
+                iDefaultLogoImageMask, 
+                EFalse );
         }
     else if( bitmap && mask )
         {
-        logoLayout.DrawImage( gc, bitmap, mask );
+        gc.DrawBitmapMasked( logoLayout.Rect(), 
+                bitmap, 
+                TRect(TPoint(0, 0), bitmap->SizeInPixels()), 
+                mask, 
+                ETrue );
         }
 
     // DRAW NAME
@@ -302,15 +297,6 @@
     }
 
 // ---------------------------------------------------------
-// CWmListItemDrawer::HandleSkinChanged
-// ---------------------------------------------------------
-//
-void CWmListItemDrawer::HandleSkinChanged()
-    {
-    ResizeDefaultBitmaps();
-    }
-
-// ---------------------------------------------------------
 // CWmListBox::NewL
 // ---------------------------------------------------------
 //
@@ -491,21 +477,7 @@
 	iLogoSize = LogoSize();
     for ( TInt i=0; i<iVisibleWidgetArray.Count(); i++)
         {
-        iVisibleWidgetArray[i]->ReCreateLogo( iLogoSize );
-        }
-    }
-
-// ---------------------------------------------------------
-// CWmListBox::HandleSkinChanged
-// ---------------------------------------------------------
-//
-void CWmListBox::HandleSkinChanged()
-    {
-    CWmListItemDrawer* itemDrawer = 
-                        static_cast <CWmListItemDrawer*>( iItemDrawer );
-    if ( itemDrawer )
-        {
-        itemDrawer->HandleSkinChanged();
+        iVisibleWidgetArray[i]->UpdateLogo( iLogoSize, EFalse );
         }
     }
 
@@ -592,7 +564,6 @@
     if ( itemDrawer )
         {
         itemDrawer->UpdateItemHeight();
-        itemDrawer->ResizeDefaultBitmaps();
         }
     }