idlehomescreen/widgetmanager/src/wmlistbox.cpp
branchRCL_3
changeset 19 79311d856354
parent 18 d05a55b217df
child 23 7be2816dbabd
equal deleted inserted replaced
18:d05a55b217df 19:79311d856354
   144     delete iDefaultLogoImage;
   144     delete iDefaultLogoImage;
   145     delete iDefaultLogoImageMask;
   145     delete iDefaultLogoImageMask;
   146 	}
   146 	}
   147 
   147 
   148 // ---------------------------------------------------------
   148 // ---------------------------------------------------------
   149 // CWmListItemDrawer::ResizeDefaultBitmaps
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 void CWmListItemDrawer::ResizeDefaultBitmaps()
       
   153     {
       
   154 	TAknWindowLineLayout logoPane = 
       
   155 	          AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine();
       
   156 
       
   157     TAknLayoutRect layoutRect;
       
   158     TRect rect = TRect( ItemCellSize() );
       
   159     layoutRect.LayoutRect( rect, logoPane );
       
   160     
       
   161     // RESIZE DEFAULT LOGO BITMAPS ACCORDING TO LAYOUT
       
   162     TSize size = layoutRect.Rect().Size();
       
   163     AknIconUtils::SetSize( 
       
   164         iDefaultLogoImage, size, EAspectRatioPreserved );
       
   165     AknIconUtils::SetSize( 
       
   166         iDefaultLogoImageMask, size, EAspectRatioPreserved );
       
   167     }
       
   168 	
       
   169 
       
   170 // ---------------------------------------------------------
       
   171 // CWmListItemDrawer::UpdateItemHeight
   149 // CWmListItemDrawer::UpdateItemHeight
   172 // ---------------------------------------------------------
   150 // ---------------------------------------------------------
   173 //
   151 //
   174 void CWmListItemDrawer::UpdateItemHeight()
   152 void CWmListItemDrawer::UpdateItemHeight()
   175     {
   153     {
   180     listPaneRect.LayoutRect( iListBox->Rect(), listPane );
   158     listPaneRect.LayoutRect( iListBox->Rect(), listPane );
   181     TAknWindowLineLayout listRowPane = AknLayoutScalable_Apps
   159     TAknWindowLineLayout listRowPane = AknLayoutScalable_Apps
   182         ::listrow_wgtman_pane().LayoutLine();
   160         ::listrow_wgtman_pane().LayoutLine();
   183     TAknLayoutRect listRowPaneRect;
   161     TAknLayoutRect listRowPaneRect;
   184     listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane );
   162     listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane );
   185     iListBox->View()->SetItemHeight( listRowPaneRect.Rect().Height() );
   163     TRAP_IGNORE( iListBox->SetItemHeightL( listRowPaneRect.Rect().Height() ); );
   186     iListBox->View()->ItemDrawer()->SetItemCellSize( listRowPaneRect.Rect().Size() );
   164     iListBox->View()->ItemDrawer()->SetItemCellSize( listRowPaneRect.Rect().Size() );
   187     }
   165     }
   188 
   166 
   189 // ---------------------------------------------------------
   167 // ---------------------------------------------------------
   190 // CWmListItemDrawer::DrawItem
   168 // CWmListItemDrawer::DrawItem
   219                                   itemRect,
   197                                   itemRect,
   220                                   innerRect,
   198                                   innerRect,
   221                                   KAknsIIDQsnFrList,
   199                                   KAknsIIDQsnFrList,
   222                                   KAknsIIDQsnFrListCenter );
   200                                   KAknsIIDQsnFrListCenter );
   223         }
   201         }
   224     
       
   225     // DRAW LOGO
   202     // DRAW LOGO
   226     CFbsBitmap* bitmap = const_cast<CFbsBitmap*>(wData.LogoImage());
   203     CFbsBitmap* bitmap = const_cast<CFbsBitmap*>(wData.LogoImage());
   227     CFbsBitmap* mask = const_cast<CFbsBitmap*>(wData.LogoImageMask());
   204     CFbsBitmap* mask = const_cast<CFbsBitmap*>(wData.LogoImageMask());
   228     TAknLayoutRect logoLayout;
   205     TAknLayoutRect logoLayout;
   229     logoLayout.LayoutRect( itemRect,
   206     logoLayout.LayoutRect( itemRect,
   230              AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
   207              AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
   231 
   208     if ( ( !bitmap || !mask ) && iDefaultLogoImage && iDefaultLogoImageMask )
   232     if ( !bitmap && !wData.IsPrepairingLogo() )
   209         {
   233         {
   210         // real logo missing use default
   234         logoLayout.DrawImage( gc, iDefaultLogoImage, iDefaultLogoImageMask );
   211         TSize size = logoLayout.Rect().Size();
       
   212         if ( iDefaultLogoImage->SizeInPixels() != size )
       
   213             {
       
   214             // Resize default icons only when they are really needed
       
   215             AknIconUtils::SetSize( 
       
   216                 iDefaultLogoImage, size, EAspectRatioPreserved );
       
   217             AknIconUtils::SetSize( 
       
   218                 iDefaultLogoImageMask, size, EAspectRatioPreserved );
       
   219             }
       
   220     
       
   221         gc.DrawBitmapMasked( logoLayout.Rect(), 
       
   222                 iDefaultLogoImage, 
       
   223                 TRect(TPoint(0, 0), iDefaultLogoImage->SizeInPixels()), 
       
   224                 iDefaultLogoImageMask, 
       
   225                 EFalse );
   235         }
   226         }
   236     else if( bitmap && mask )
   227     else if( bitmap && mask )
   237         {
   228         {
   238         logoLayout.DrawImage( gc, bitmap, mask );
   229         gc.DrawBitmapMasked( logoLayout.Rect(), 
       
   230                 bitmap, 
       
   231                 TRect(TPoint(0, 0), bitmap->SizeInPixels()), 
       
   232                 mask, 
       
   233                 ETrue );
   239         }
   234         }
   240 
   235 
   241     // DRAW NAME
   236     // DRAW NAME
   242     TRgb textColor;
   237     TRgb textColor;
   243     TAknsQsnTextColorsIndex index =
   238     TAknsQsnTextColorsIndex index =
   300     {
   295     {
   301     return iDefaultLogoImageMask;
   296     return iDefaultLogoImageMask;
   302     }
   297     }
   303 
   298 
   304 // ---------------------------------------------------------
   299 // ---------------------------------------------------------
   305 // CWmListItemDrawer::HandleSkinChanged
       
   306 // ---------------------------------------------------------
       
   307 //
       
   308 void CWmListItemDrawer::HandleSkinChanged()
       
   309     {
       
   310     ResizeDefaultBitmaps();
       
   311     }
       
   312 
       
   313 // ---------------------------------------------------------
       
   314 // CWmListBox::NewL
   300 // CWmListBox::NewL
   315 // ---------------------------------------------------------
   301 // ---------------------------------------------------------
   316 //
   302 //
   317 CWmListBox* CWmListBox::NewL(
   303 CWmListBox* CWmListBox::NewL(
   318         CWmPlugin& aWmPlugin,
   304         CWmPlugin& aWmPlugin,
   489     {
   475     {
   490     iLogoSize = TSize( 0, 0);
   476     iLogoSize = TSize( 0, 0);
   491 	iLogoSize = LogoSize();
   477 	iLogoSize = LogoSize();
   492     for ( TInt i=0; i<iVisibleWidgetArray.Count(); i++)
   478     for ( TInt i=0; i<iVisibleWidgetArray.Count(); i++)
   493         {
   479         {
   494         iVisibleWidgetArray[i]->ReCreateLogo( iLogoSize );
   480         iVisibleWidgetArray[i]->UpdateLogo( iLogoSize, EFalse );
   495         }
       
   496     }
       
   497 
       
   498 // ---------------------------------------------------------
       
   499 // CWmListBox::HandleSkinChanged
       
   500 // ---------------------------------------------------------
       
   501 //
       
   502 void CWmListBox::HandleSkinChanged()
       
   503     {
       
   504     CWmListItemDrawer* itemDrawer = 
       
   505                         static_cast <CWmListItemDrawer*>( iItemDrawer );
       
   506     if ( itemDrawer )
       
   507         {
       
   508         itemDrawer->HandleSkinChanged();
       
   509         }
   481         }
   510     }
   482     }
   511 
   483 
   512 // ---------------------------------------------------------
   484 // ---------------------------------------------------------
   513 // CWmListBox::HandleWidgetDataChanged
   485 // CWmListBox::HandleWidgetDataChanged
   590     CWmListItemDrawer* itemDrawer = 
   562     CWmListItemDrawer* itemDrawer = 
   591                     static_cast <CWmListItemDrawer*>( iItemDrawer );
   563                     static_cast <CWmListItemDrawer*>( iItemDrawer );
   592     if ( itemDrawer )
   564     if ( itemDrawer )
   593         {
   565         {
   594         itemDrawer->UpdateItemHeight();
   566         itemDrawer->UpdateItemHeight();
   595         itemDrawer->ResizeDefaultBitmaps();
       
   596         }
   567         }
   597     }
   568     }
   598 
   569 
   599 // ---------------------------------------------------------
   570 // ---------------------------------------------------------
   600 // CWmListBox::Draw
   571 // CWmListBox::Draw