uifw/eikctl/src/EIKCLB.CPP
branchRCL_3
changeset 9 0aa5fbdfbc30
parent 8 71dd06cfe933
child 10 3d340a0166ff
--- a/uifw/eikctl/src/EIKCLB.CPP	Wed Apr 14 16:14:00 2010 +0300
+++ b/uifw/eikctl/src/EIKCLB.CPP	Tue Apr 27 16:55:05 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -812,25 +812,27 @@
 EXPORT_C void
 CColumnListBoxView::Draw( const TRect* aRect ) const
     {
-
-    if (RedrawDisabled() || !IsVisible())
+    if ( RedrawDisabled() || !IsVisible() )
         {
         return;
         }
 
-    TInt i=0;
+    TInt i = 0;
 
-    CColumnListBoxItemDrawer* lbi = (CColumnListBoxItemDrawer*)ItemDrawer();
-    CEikListBox* listbox = static_cast<CEikListBox*>( lbi->ColumnData()->Control() );
-    MAknsSkinInstance *skin = AknsUtils::SkinInstance();
-    MAknsControlContext *cc = AknsDrawUtils::ControlContext( listbox );
+    CColumnListBoxItemDrawer* lbi =
+        static_cast<CColumnListBoxItemDrawer*>( ItemDrawer() );
+    CEikListBox* listbox =
+        static_cast<CEikListBox*>( lbi->ColumnData()->Control() );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( listbox );
 
     if ( !cc )
         {
         cc = lbi->ColumnData()->SkinBackgroundContext();
         }
 
-    // draw the whole background at once, this is faster than drawing it in separate items
+    // Draw the whole background at once, this is faster than drawing
+    // it in separate items.
     if ( listbox && listbox->BackgroundDrawingSuppressed() )
         {
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
@@ -856,9 +858,10 @@
         }
 
     TInt firstPotentialItemIndex = iTopItemIndex;
-    TInt lastPotentialItemIndex = iTopItemIndex + NumberOfItemsThatFitInRect(iViewRect);
+    TInt lastPotentialItemIndex =
+        iTopItemIndex + NumberOfItemsThatFitInRect( iViewRect ) - 1;
 
-    if (iModel->NumberOfItems() == 0)
+    if ( iModel->NumberOfItems() == 0 )
         {
         // Empty
         }
@@ -866,15 +869,15 @@
         {
         if ( lastPotentialItemIndex > iBottomItemIndex )
             {
-            // Fix for EAAA-797CKC
             lastPotentialItemIndex = iBottomItemIndex;
             }
+
         ITEM_EXISTS_BEGIN;
-        for (i = firstPotentialItemIndex; i <= lastPotentialItemIndex; i++)
+        for ( i = firstPotentialItemIndex; i <= lastPotentialItemIndex; i++ )
             {
-            if (ITEM_EXISTS(i))
+            if ( ITEM_EXISTS( i ) )
                 {
-                DrawItem(i);
+                DrawItem( i );
                 }
             else
                 {
@@ -885,7 +888,8 @@
 
     if ( listbox && !listbox->BackgroundDrawingSuppressed() )
         {
-        // clear the unused portion of the viewing area (this handles drawing the vertical line too :)
+        // Clear the unused portion of the viewing area
+        // (this handles drawing the vertical line too :)
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
 
@@ -895,32 +899,16 @@
             }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
 
-        TRect usedPortionOfViewRect( iViewRect.iTl + TSize( 0, iVerticalOffset ), TSize( iViewRect.Width(), ( i - iTopItemIndex ) * iItemHeight ) );
+        TRect usedPortionOfViewRect(
+            iViewRect.iTl + TSize( 0, iVerticalOffset ),
+            TSize( iViewRect.Width(), ( i - iTopItemIndex ) * iItemHeight ) );
 
-        // also clear area behind scroll bar.
-        // this is a terrible hack, which is unfortunately needed since layouts
-        // leave 2 pixel (in double res) wide margins to both sides of the
-        // scroll bar, and there is no other way to do this. This hack is
-        // only really valid for main pane lists, but it does not seem to
-        // break popup lists, popup field lists or setting page radiobutton
-        // lists.
-        TRect sbbg( iViewRect );   // whole area behind scroll bar
-        TRect margin( iViewRect ); // it gets even worse in mirrored layouts
+        // Also draw the area behind scroll bar.
+        TRect sbbg( iViewRect ); // whole area behind scroll bar
 
         if ( AknLayoutUtils::LayoutMirrored() )
             {
             sbbg.iBr.iX = iViewRect.iBr.iX - lbi->LafItemSize().iWidth;
-
-            // in mirrored layouts we also need to draw a margin slice in right
-            TRect mainPane;
-            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
-                                               mainPane );
-            TAknLayoutRect listscrollAppPane;
-            listscrollAppPane.LayoutRect( mainPane,
-                                          AknLayoutScalable_Avkon::listscroll_app_pane( 0 ) );
-
-            TInt rMargin = mainPane.iBr.iX - listscrollAppPane.Rect().iBr.iX;
-            margin.iTl.iX = margin.iBr.iX - rMargin;
             }
         else
             {
@@ -937,22 +925,19 @@
                                                    iViewRect,
                                                    usedPortionOfViewRect );
 
-            AknsDrawUtils::Background( skin, cc, listbox, *iGc, sbbg );
-
-            if ( AknLayoutUtils::LayoutMirrored() )
+            if ( !sbbg.IsEmpty() )
                 {
-                AknsDrawUtils::Background( skin, cc, listbox, *iGc, margin );
+                AknsDrawUtils::Background( skin, cc, listbox, *iGc, sbbg );
                 }
             }
         else
             {
             iGc->SetBrushColor( BackColor() );
             DrawUtils::ClearBetweenRects( *iGc, iViewRect, usedPortionOfViewRect );
-            iGc->Clear( sbbg );
-
-            if ( AknLayoutUtils::LayoutMirrored() )
+            
+            if ( !sbbg.IsEmpty() )
                 {
-                iGc->Clear( margin );
+                iGc->Clear( sbbg );
                 }
             }