phoneuis/easydialing/src/easydialinglistbox.cpp
branchRCL_3
changeset 6 38529f706030
parent 5 2a26698d78ba
child 7 544e34b3255a
equal deleted inserted replaced
5:2a26698d78ba 6:38529f706030
   277 //
   277 //
   278 void CEasyDialingListBox::SizeChanged()
   278 void CEasyDialingListBox::SizeChanged()
   279     {
   279     {
   280     CEikFormattedCellListBox::SizeChanged();
   280     CEikFormattedCellListBox::SizeChanged();
   281     
   281     
       
   282     TRect parentRect = Rect();
       
   283     
   282     // Set the listbox colors.
   284     // Set the listbox colors.
   283     // For some reason, calling this in HandleResourceChange is not enough, it does
   285     // For some reason, calling this in HandleResourceChange is not enough, it does
   284     // not get called in situation it should.
   286     // not get called in situation it should.
   285     ItemDrawer()->SetColors();
   287     ItemDrawer()->SetColors();
   286    
   288     
   287     // resize scroll bar
   289     // Get all the layout rects
       
   290     TAknLayoutRect rect;
       
   291     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
       
   292 
       
   293     TAknWindowComponentLayout viewLayout( AknLayoutScalable_Apps::dia3_list_pane( variety ) );
       
   294     rect.LayoutRect(parentRect, viewLayout );
       
   295     TRect viewRect( rect.Rect() );
       
   296     // Add a bit of margin around the view as layout doesn't define any
       
   297     viewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth );
       
   298     
       
   299     TAknWindowComponentLayout scrollBarLayout( AknLayoutScalable_Apps::scroll_pane_cp12() );
       
   300     rect.LayoutRect( parentRect, scrollBarLayout );
       
   301     TRect scrollBarRect( rect.Rect() );
       
   302 
       
   303     TRect viewAndScrollBarRect( viewRect );
       
   304     if ( AknLayoutUtils::LayoutMirrored() )
       
   305         {
       
   306         viewAndScrollBarRect.iTl.iX = scrollBarRect.iTl.iX + KListBoxMarginWidth;
       
   307         }
       
   308     else
       
   309         {
       
   310         viewAndScrollBarRect.iBr.iX = scrollBarRect.iBr.iX - KListBoxMarginWidth;
       
   311         }
       
   312 
       
   313     // If scrollbar is not needed, then we can use all the space for the list view
       
   314     if ( GetHeightBasedOnNumberOfItems( iNumberOfNames ) <= parentRect.Height() )
       
   315         {
       
   316         viewRect = viewAndScrollBarRect;
       
   317         scrollBarRect.SetWidth( 0 );
       
   318         }
       
   319 
       
   320     // Set view rect
       
   321     iView->SetViewRect( viewRect );
       
   322     
       
   323     // Set scroll bar rect
   288     if ( iSBFrame )
   324     if ( iSBFrame )
   289         {
   325         {
   290         TAknLayoutRect rect;
       
   291         TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
       
   292     
       
   293         TAknWindowComponentLayout viewLayout( AknLayoutScalable_Apps::dia3_list_pane( variety ) );
       
   294         rect.LayoutRect( Rect(), viewLayout );
       
   295         TRect viewRect( rect.Rect() );
       
   296         // Add a bit of margin around the view as layout doesn't define any
       
   297         viewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth );
       
   298         
       
   299         TAknWindowComponentLayout scrollBarLayout( AknLayoutScalable_Apps::scroll_pane_cp12() );
       
   300         rect.LayoutRect( Rect(), scrollBarLayout );
       
   301         TRect scrollBarRect( rect.Rect() );
       
   302 
       
   303         iView->SetViewRect( viewRect );
       
   304         
       
   305         CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*>( iSBFrame->VerticalScrollBar() );
   326         CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*>( iSBFrame->VerticalScrollBar() );
   306 
       
   307         scrollbar->SetFixedLayoutRect( scrollBarRect );
   327         scrollbar->SetFixedLayoutRect( scrollBarRect );
   308         scrollbar->SetRect( scrollBarRect );
   328         scrollbar->SetRect( scrollBarRect );
   309         
   329         scrollbar->MakeVisible( scrollBarRect.Width() != 0 );
   310         TRect viewAndScrollBarRect( viewRect );
   330         }
   311         
   331 
   312         if ( AknLayoutUtils::LayoutMirrored() )
   332     iBGContext->SetFrameRects( parentRect, viewAndScrollBarRect );
   313             {
       
   314             viewAndScrollBarRect.iTl = scrollBarRect.iTl;
       
   315             }
       
   316         else
       
   317             {
       
   318             viewAndScrollBarRect.iBr = scrollBarRect.iBr;
       
   319             }
       
   320         iBGContext->SetFrameRects( Rect(), viewAndScrollBarRect );
       
   321         }
       
   322     }
   333     }
   323 
   334 
   324 
   335 
   325 // -----------------------------------------------------------------------------
   336 // -----------------------------------------------------------------------------
   326 // MopSupplyObject
   337 // MopSupplyObject