uifw/AvKon/src/eikfrlb.cpp
branchRCL_3
changeset 23 3d340a0166ff
parent 18 0aa5fbdfbc30
child 29 a8834a2e9a96
--- a/uifw/AvKon/src/eikfrlb.cpp	Tue Apr 27 16:55:05 2010 +0300
+++ b/uifw/AvKon/src/eikfrlb.cpp	Tue May 11 16:27:42 2010 +0300
@@ -162,17 +162,11 @@
             {
             backgroundDrawer->Draw( *iGc, *control, r );
             }
-        else if ( CAknEnv::Static()->TransparencyEnabled() )
+        else
             {
             AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
                                    KAknsDrawParamNoClearUnderImage );
             }
-        else
-            {
-            AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
-                                   KAknsDrawParamNoClearUnderImage |
-                                   KAknsDrawParamBottomLevelRGBOnly );
-            }
         }
     else
         {
@@ -219,6 +213,11 @@
 #endif //RD_UI_TRANSITION_EFFECTS_LIST
 
     TBool removeicon = (!aItemIsSelected && !ItemMarkReverse()) || (aItemIsSelected && ItemMarkReverse());
+    
+    if ( Flags() & CListItemDrawer::EMarkingModeEnabled )
+        {
+        removeicon = EFalse;
+        }
 
     CFormattedCellListBoxData::TColors colors;
     colors.iText=iTextColor;
@@ -404,18 +403,6 @@
     iTopItemIndex = aTop;
     }
 
-void 
-CFormattedCellListBoxItemDrawer::DrawCurrentItemRect(const TRect& aRect) const
-    {
-    _AKNTRACE_FUNC_ENTER;    
-    iGc->SetClippingRect(iViewRect);
-    iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
-    iGc->SetPenColor(iHighlightedBackColor);
-    iGc->DrawRect(aRect);
-    iGc->CancelClippingRect();
-    _AKNTRACE_FUNC_EXIT;
-    }
-
 
 //
 // CEikFormattedCellListBox
@@ -812,7 +799,6 @@
     
     itemDrawer->SetTopItemIndex( iTopItemIndex );
 
-    TBool transparencyEnabled = CAknEnv::Static()->TransparencyEnabled();
     TInt numberOfItems = iModel->NumberOfItems();
     
     if ( numberOfItems > 0 )
@@ -824,149 +810,121 @@
             CAknListLoader::TfxApiInternal( gc );
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
 		
-		if ( transparencyEnabled )
-		    {
-    		if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
-	    		{
+        if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
+    		{
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
-                drawingInitiated = transApi && !transApi->EffectsDisabled();
+            drawingInitiated = transApi && !transApi->EffectsDisabled();
 #else
-                drawingInitiated = EFalse;
+            drawingInitiated = EFalse;
 #endif
-    			}
+			}
 
-	    	if ( !drawingInitiated )
-		    	{
-    			iWin->Invalidate( *aClipRect );
-	    		iWin->BeginRedraw( *aClipRect );
-		    	}
-		    }
+    	if ( !drawingInitiated )
+	    	{
+			iWin->Invalidate( *aClipRect );
+    		iWin->BeginRedraw( *aClipRect );
+	    	}
 
         TInt lastPotentialItemIndex =
             Min( numberOfItems,
                  iTopItemIndex + NumberOfItemsThatFitInRect( iViewRect ) );
 
+        gc->SetClippingRect( iViewRect );
+        
         while ( i < lastPotentialItemIndex )      
             {
+            DrawItem( i++ );
+            }
+
+        gc->CancelClippingRect();
+
+        if ( control && !static_cast<CEikListBox*>( control )->
+                BackgroundDrawingSuppressed() )
+            {
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
             if ( transApi )
                 {
-                transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
-                }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
-            gc->SetClippingRect( iViewRect );
-            
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-            if ( transApi )
-                {
-                transApi->StopDrawing();
+                transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
                 }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
-            DrawItem( i++ );
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-            if ( transApi )
-                {
-                transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
-                }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
 
-            gc->CancelClippingRect();
-            
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-            if ( transApi )
+            if ( i > iBottomItemIndex + 1 )
                 {
-                transApi->StopDrawing();
+                i = iBottomItemIndex + 1;
                 }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-            }
 
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-        if ( transApi )
-            {
-            transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
-            }
-
-        if ( i > iBottomItemIndex + 1 )
-            {
-            i = iBottomItemIndex + 1;
-            }
-
-        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 ) );
 #else
-        // clear the unused portion of the viewing area
-        TRect usedPortionOfViewRect( iViewRect.iTl.iX,
+            // clear the unused portion of the viewing area
+            TRect usedPortionOfViewRect( iViewRect.iTl.iX,
                                      iViewRect.iTl.iY + iVerticalOffset,
                                      iViewRect.Width(),
                                      ItemPos( lastPotentialItemIndex ).iY );
         
-        if ( aClipRect )
-            {
-            usedPortionOfViewRect.iBr.iX = aClipRect->iBr.iX;
-            }
-
+            if ( aClipRect )
+                {
+                usedPortionOfViewRect.iBr.iX = aClipRect->iBr.iX;
+                }
 #endif
 
-        // Also draw the area behind scroll bar.
-        TRect sbbg( iViewRect ); // whole area behind scroll bar
-        
-        if ( AknLayoutUtils::LayoutMirrored() )
-            {
-            _AKNTRACE("CFormattedCellListBoxView::Draw Layout mirrored");
-            sbbg.iBr.iX = iViewRect.iBr.iX - itemDrawer->LafItemSize().iWidth;
-            }
-        else
-            {
-            sbbg.iTl.iX = iViewRect.iTl.iX + itemDrawer->LafItemSize().iWidth;
-            }
-
-        // Unused portion will be cleared only if listbox background is drawn.
-        if ( itemDrawer->ColumnData()->IsBackgroundDrawingEnabled() ) 
-            {
-            if ( control )
+            // Also draw the area behind scroll bar.
+            TRect sbbg( iViewRect ); // whole area behind scroll bar
+            
+            if ( AknLayoutUtils::LayoutMirrored() )
                 {
-                if ( !control->FindBackground() )
-                    {
-                    AknsDrawUtils::BackgroundBetweenRects( skin, 
-                                                           cc, 
-                                                           control, 
-                                                           *gc, 
-                                                           iViewRect, 
-                                                           usedPortionOfViewRect );
-
-                    if ( !sbbg.IsEmpty() )
-                        {
-                        AknsDrawUtils::Background( skin,
-                                                   cc,
-                                                   control,
-                                                   *gc,
-                                                   sbbg );
-                        }
-                    }
+                _AKNTRACE("CFormattedCellListBoxView::Draw Layout mirrored");
+                sbbg.iBr.iX = iViewRect.iBr.iX - itemDrawer->LafItemSize().iWidth;
                 }
             else
                 {
-                gc->SetBrushColor( BackColor() );
-                DrawUtils::ClearBetweenRects( *gc,
-                                              iViewRect,
-                                              usedPortionOfViewRect );
-                gc->Clear( sbbg );
+                sbbg.iTl.iX = iViewRect.iTl.iX + itemDrawer->LafItemSize().iWidth;
                 }
-            }
+    
+            // Unused portion will be cleared only if listbox background is drawn.
+            if ( itemDrawer->ColumnData()->IsBackgroundDrawingEnabled() ) 
+                {
+                if ( control )
+                    {
+                    if ( !control->FindBackground() )
+                        {
+                        AknsDrawUtils::BackgroundBetweenRects( skin, 
+                                                               cc, 
+                                                               control, 
+                                                               *gc, 
+                                                               iViewRect, 
+                                                               usedPortionOfViewRect );
+    
+                        if ( !sbbg.IsEmpty() )
+                            {
+                            AknsDrawUtils::Background( skin,
+                                                       cc,
+                                                       control,
+                                                       *gc,
+                                                       sbbg );
+                            }
+                        }
+                    }
+                else
+                    {
+                    gc->SetBrushColor( BackColor() );
+                    DrawUtils::ClearBetweenRects( *gc,
+                                                  iViewRect,
+                                                  usedPortionOfViewRect );
+                    gc->Clear( sbbg );
+                    }
+                }
 
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
-    if ( transApi )
-        {
-        transApi->StopDrawing();
-        }
+            if ( transApi )
+                {
+                transApi->StopDrawing();
+                }
 #endif //RD_UI_TRANSITION_EFFECTS_LIST      
 
+            }
 
-		if ( transparencyEnabled && !drawingInitiated )
+		if ( !drawingInitiated )
 			{
 			iWin->EndRedraw();
 			}
@@ -1343,9 +1301,14 @@
 void CFormattedCellListBoxItemDrawer::DrawBackgroundAndSeparatorLines( 
         const TRect& aItemTextRect, TBool aDrawSeparator ) const
     {
+    // If we get here background is drawn via avkon implementation -> raise the
+    // corresponding flag in item drawer.
+    const_cast<CFormattedCellListBoxItemDrawer*>( this )->SetFlags( ENativeImplementation );
+
     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
     CCoeControl* control = FormattedCellData()->Control();
     MAknsControlContext *cc = AknsDrawUtils::ControlContext( control );
+    CEikListBox* listbox = static_cast<CEikListBox*>( control );
 
     if ( !cc )
         {
@@ -1367,7 +1330,8 @@
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
 
     // background
-    if ( FormattedCellData()->IsBackgroundDrawingEnabled() )
+    if ( FormattedCellData()->IsBackgroundDrawingEnabled() && listbox
+            && !listbox->BackgroundDrawingSuppressed() )
         {
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
@@ -1387,19 +1351,12 @@
                 backgroundDrawer->Draw( *iGc, *control, aItemTextRect );
                 bgDrawn = ETrue;
                 }
-            else if ( CAknEnv::Static()->TransparencyEnabled() )
+            else
                 {
                 bgDrawn = AknsDrawUtils::Background(
                     skin, cc, control, *iGc, aItemTextRect,
                     KAknsDrawParamNoClearUnderImage );
                 }
-            else
-                {
-                bgDrawn = AknsDrawUtils::Background(
-                    skin, cc, control, *iGc, aItemTextRect,
-                    KAknsDrawParamNoClearUnderImage | 
-                    KAknsDrawParamBottomLevelRGBOnly );
-                }
             }
         if ( !bgDrawn )
             {
@@ -1411,12 +1368,12 @@
             transApi->StopDrawing();
             }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
+        }
 
-        if ( aDrawSeparator && control && 
-            static_cast<CEikListBox*>( control )->ItemsInSingleLine() == 1 )
-            {
-            AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor, skin );
-            }
+    if ( aDrawSeparator && listbox && 
+        listbox->ItemsInSingleLine() == 1 )
+        {
+        AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor, skin );
         }
     }