uifw/eikctl/src/EIKCLB.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
--- a/uifw/eikctl/src/EIKCLB.CPP	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/eikctl/src/EIKCLB.CPP	Wed Sep 01 12:16:19 2010 +0100
@@ -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"
@@ -481,7 +481,8 @@
 #ifdef RD_LIST_STRETCH
 EXPORT_C void CEikColumnListBox::EnableStretching( const TBool aEnabled )
     {
-    if ( ItemDrawer()->ColumnData()->StretchingEnabled() != aEnabled )
+    if ( ItemDrawer() && 
+         ( ItemDrawer()->ColumnData()->StretchingEnabled() != aEnabled ) )
         {
         ItemDrawer()->ColumnData()->EnableStretching( aEnabled );
         SizeChanged();
@@ -593,17 +594,6 @@
     data->SetItemCellSize( iItemCellSize );
     }
 
-void CColumnListBoxItemDrawer::DrawCurrentItemRect(const TRect& aRect) const
-//
-//    Draw the item background
-//
-    {
-    iGc->SetClippingRect(iViewRect);
-    iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
-    iGc->SetPenColor(iHighlightedBackColor);    // KDefaultLbxHighlightRectColor
-    iGc->DrawRect(aRect);
-    iGc->CancelClippingRect();
-    }
 
 /**
 * Returns a pointer to the column data. Does not imply transfer of ownership.
@@ -655,6 +645,12 @@
     TInt pos = -1;
 
     TBool removeicon = (!aItemIsSelected && !ItemMarkReverse()) || (aItemIsSelected && ItemMarkReverse());
+    
+    if ( Flags() & CListItemDrawer::EMarkingModeEnabled )
+        {
+        removeicon = EFalse;
+        }
+
     if ( Flags() & EDrawMarkSelection && ItemMarkPosition() != -1 && removeicon)
         {
         repl.Set( ItemMarkReplacement() );
@@ -809,55 +805,45 @@
 #define ITEM_EXISTS_ONCE(x) (((x) > -1) && ((x) < iModel->NumberOfItems()))
 
 EXPORT_C void
-CColumnListBoxView::Draw( const TRect* aRect ) const
+CColumnListBoxView::Draw( const TRect* /*aRect*/ ) const
     {
+    // If we get here background is drawn via avkon implementation -> raise the
+    // corresponding flag in item drawer.
+    if ( iItemDrawer )
+        {
+        iItemDrawer->SetFlags( CListItemDrawer::ENativeImplementation );
+        }
 
-    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
-    if ( listbox && listbox->BackgroundDrawingSuppressed() )
-        {
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-            MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
-            if ( transApi )
-                {
-                transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
-                }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
-        AknsDrawUtils::Background( skin, cc, listbox, *iGc, *aRect );
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-        if ( transApi )
-            {
-            transApi->StopDrawing();
-            }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-        }
-    else if ( !listbox )
+    if ( !listbox )
         {
         iGc->Clear();
         }
 
     TInt firstPotentialItemIndex = iTopItemIndex;
-    TInt lastPotentialItemIndex = iTopItemIndex + NumberOfItemsThatFitInRect(iViewRect) - 1;
+    TInt lastPotentialItemIndex =
+        iTopItemIndex + NumberOfItemsThatFitInRect( iViewRect ) - 1;
+    TBool backgroundDrawingSuppressed = ( listbox && listbox->BackgroundDrawingSuppressed() );
 
-    if (iModel->NumberOfItems() == 0)
+    if ( iModel->NumberOfItems() == 0 )
         {
         // Empty
         }
@@ -865,26 +851,37 @@
         {
         if ( lastPotentialItemIndex > iBottomItemIndex )
             {
-            // Fix for EAAA-797CKC
             lastPotentialItemIndex = iBottomItemIndex;
             }
-        ITEM_EXISTS_BEGIN;
-        for (i = firstPotentialItemIndex; i <= lastPotentialItemIndex; i++)
+
+        if ( backgroundDrawingSuppressed )
             {
-            if (ITEM_EXISTS(i))
+            iGc->SetClippingRect( iViewRect );
+            }
+
+        ITEM_EXISTS_BEGIN;
+        for ( i = firstPotentialItemIndex; i <= lastPotentialItemIndex; i++ )
+            {
+            if ( ITEM_EXISTS( i ) )
                 {
-                DrawItem(i);
+                DrawItem( i );
                 }
             else
                 {
                 break;
                 }
             }
+
+        if ( backgroundDrawingSuppressed )
+            {
+            iGc->CancelClippingRect();
+            }
         }
 
-    if ( listbox && !listbox->BackgroundDrawingSuppressed() )
+    if ( !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 );
 
@@ -894,32 +891,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
             {
@@ -936,22 +917,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 );
                 }
             }