menufw/menufwui/mmwidgets/src/mmgridview.cpp
changeset 5 c743ef5928ba
parent 4 4d54b72983ae
child 16 9674c1a575e9
equal deleted inserted replaced
4:4d54b72983ae 5:c743ef5928ba
   212 //
   212 //
   213 // -----------------------------------------------------------------------------
   213 // -----------------------------------------------------------------------------
   214 //
   214 //
   215 void CMmGridView::Draw(const TRect* aClipRect) const
   215 void CMmGridView::Draw(const TRect* aClipRect) const
   216     {
   216     {
   217     CMmListBoxItemDrawer* itemDrawer =
   217     const_cast<CMmGridView*>( this )->UpdateItemHeightAndWidth();
   218             STATIC_CAST( CMmListBoxItemDrawer*, ItemDrawer() );
       
   219     TSize size = itemDrawer->GetItemSize( 0, EFalse );
       
   220     if ( itemDrawer->ItemCellSize() != size  )
       
   221         {
       
   222         const_cast<CMmGridView*>( this )->SetItemHeight( size.iHeight );
       
   223         const_cast<CMmGridView*>( this )->SetColumnWidth( size.iWidth );
       
   224         }
       
   225     DoDraw( aClipRect );
   218     DoDraw( aClipRect );
   226     }
   219     }
   227 
   220 
   228 // -----------------------------------------------------------------------------
   221 // -----------------------------------------------------------------------------
   229 //
   222 //
   297 	static_cast<CMmGrid*>(itemDrawer->Widget())->SetItemHeight( aItemHeight );
   290 	static_cast<CMmGrid*>(itemDrawer->Widget())->SetItemHeight( aItemHeight );
   298 	
   291 	
   299 	CAknGridView::SetItemHeight(aItemHeight);
   292 	CAknGridView::SetItemHeight(aItemHeight);
   300 	}
   293 	}
   301 
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 //
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 void CMmGridView::UpdateItemHeightAndWidth()
       
   300     {
       
   301     if ( iModel && iModel->NumberOfItems() )
       
   302         {
       
   303         CMmListBoxItemDrawer* itemDrawer =
       
   304                 STATIC_CAST( CMmListBoxItemDrawer*, ItemDrawer() );
       
   305         TSize size = itemDrawer->GetItemSize( 0, EFalse );
       
   306         if ( itemDrawer->ItemCellSize() != size  )
       
   307             {
       
   308             const_cast<CMmGridView*>( this )->SetItemHeight( size.iHeight );
       
   309             const_cast<CMmGridView*>( this )->SetColumnWidth( size.iWidth );
       
   310             }
       
   311         }
       
   312     }
       
   313 
   302 //End of file
   314 //End of file