uifw/eikctl/src/EIKCLBD.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
--- a/uifw/eikctl/src/EIKCLBD.CPP	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/eikctl/src/EIKCLBD.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"
@@ -32,6 +32,8 @@
 #include <layoutmetadata.cdl.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <aknphysics.h>
+#include <AknIconArray.h>
+#include <avkon.mbg>
 
 
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
@@ -51,6 +53,8 @@
 const TInt KColorIconFlag = -1;
 const TInt KColorIconIdx  =  0;
 
+// Number of icons in marking mode icon array
+const TInt KMarkingModeIconArraySize = 2;
 
 /**
 * About animation usage:
@@ -116,7 +120,7 @@
     void DeleteAnim();
     void FocusGained();
     void FocusLost();
-    void SkinChanged();
+    void SkinChangedL();
     void SetControl( CCoeControl* aControl );
 
     // Implementation of MCoeForegroundObserver
@@ -141,6 +145,9 @@
                                  CWindowGc& aGc, 
                                  const TRect& aOutRect, 
                                  const TRect& aInnerRect ) const;
+
+    void LoadMarkingIconsL();
+
 public: //for handling column alignment
     struct TColumnExt
         {
@@ -239,6 +246,7 @@
     
     CArrayFix<TColumnExt>* iColumnExtArray; //for column alignment
     TRect iMarginRect;
+    CAknIconArray* iMarkingIconArray;
     };
 
 /**
@@ -306,6 +314,7 @@
 
     
     iKineticScrolling = CAknPhysics::FeatureEnabled();
+    LoadMarkingIconsL();
     _AKNTRACE_FUNC_EXIT;
     }
 
@@ -330,6 +339,13 @@
     delete iColorBmp;
     delete iHiliBmp;
     delete  iColumnExtArray;
+
+    if ( iMarkingIconArray )
+        {
+        iMarkingIconArray->ResetAndDestroy();
+        }
+
+    delete iMarkingIconArray;
     }
 
 MAknsControlContext* CColumnListBoxDataExtension::SkinBackgroundContext() const
@@ -520,17 +536,20 @@
         }
     }
 
+
 // -----------------------------------------------------------------------------
-// CColumnListBoxDataExtension::SkinChanged
+// CColumnListBoxDataExtension::SkinChangedL
 // -----------------------------------------------------------------------------
 //
-void CColumnListBoxDataExtension::SkinChanged()
+void CColumnListBoxDataExtension::SkinChangedL()
     {
     DeleteAnim();
     TryCreateAnimation();
     CreateColorBitmapsL();
+    LoadMarkingIconsL();
     }
 
+
 // -----------------------------------------------------------------------------
 // CColumnListBoxDataExtension::SetControl
 // -----------------------------------------------------------------------------
@@ -1122,19 +1141,64 @@
                                      KAknsIIDQsnFrListCenterPressed );
     }
 
+
+// -----------------------------------------------------------------------------
+// CColumnListBoxDataExtension::LoadMarkingIconsL
+// -----------------------------------------------------------------------------
+//
+void CColumnListBoxDataExtension::LoadMarkingIconsL()
+    {
+    if ( !iMarkingIconArray )
+        {
+        iMarkingIconArray = new ( ELeave ) CAknIconArray( 
+                KMarkingModeIconArraySize );
+        }
+    else
+        {
+        iMarkingIconArray->ResetAndDestroy();
+        }
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    const TDesC& avkonIconFile = AknIconUtils::AvkonIconFileName();
+
+    CGulIcon* icon = AknsUtils::CreateGulIconL( skin, 
+            KAknsIIDQgnPropCheckboxOn, 
+            avkonIconFile, 
+            EMbmAvkonQgn_prop_checkbox_on, 
+            EMbmAvkonQgn_prop_checkbox_on_mask );
+    
+    CleanupStack::PushL( icon );
+    iMarkingIconArray->AppendL( icon );
+    CleanupStack::Pop( icon );
+
+    icon = AknsUtils::CreateGulIconL( skin, 
+            KAknsIIDQgnPropCheckboxOff, 
+            avkonIconFile, 
+            EMbmAvkonQgn_prop_checkbox_off, 
+            EMbmAvkonQgn_prop_checkbox_off_mask );
+
+    CleanupStack::PushL( icon );
+    iMarkingIconArray->AppendL( icon );
+    CleanupStack::Pop( icon );
+    }
+
+
 EXPORT_C CCoeControl *CColumnListBoxData::Control() const 
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     return iExtension->iControl;
     }
 
 EXPORT_C void CColumnListBoxData::SetControl(CCoeControl *aControl)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->SetControl( aControl );
     }
 
 
 EXPORT_C MAknsControlContext* CColumnListBoxData::SkinBackgroundContext() const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if (iExtension->iSkinEnabled)
         {
         return iExtension->iSkinControlContext;
@@ -1145,12 +1209,14 @@
 
 void CColumnListBoxData::SetSkinBackgroundContext(CAknsListBoxBackgroundControlContext *aContext)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     delete iExtension->iSkinControlContext;
     iExtension->iSkinControlContext = aContext;
     }
 
 void CColumnListBoxData::CreatePictographInterfaceL()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if ( !iExtension->iPictoInterface )
         {
         iExtension->iPictoInterface = CAknPictographInterface::NewL(
@@ -1160,6 +1226,7 @@
 
 EXPORT_C void CColumnListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     iExtension->iSkinHighlightFrameId = aFrameId;
     iExtension->iSkinHighlightFrameCenterId = aFrameCenterId;
@@ -1167,12 +1234,14 @@
 
 EXPORT_C void CColumnListBoxData::SetSkinEnabledL(TBool aEnabled)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     CListBoxData::SetSkinEnabledL(aEnabled);
     iExtension->iSkinEnabled = aEnabled;
     }
 
 EXPORT_C void CColumnListBoxData::SetSkinStyle(const TAknsItemID *aId, const TRect &aTileRect)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if (iExtension->iSkinControlContext)
         {
         iExtension->iSkinControlContext->SetTiledBitmap(*aId);
@@ -1182,6 +1251,7 @@
 
 EXPORT_C void CColumnListBoxData::SetListEndSkinStyle(const TAknsItemID *aId, const TRect &aTileRect)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if (iExtension->iSkinControlContext)
         {
         iExtension->iSkinControlContext->SetBottomBitmap(*aId);
@@ -1191,6 +1261,7 @@
 
 void CColumnListBoxData::CreateMarqueeControlL()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     if ( !iExtension->iMarquee )
         {
@@ -1210,6 +1281,7 @@
 
 void CColumnListBoxData::ResetMarquee()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     if (iExtension->iMarquee)
         {
@@ -1223,11 +1295,13 @@
 
 TInt CColumnListBoxData::CurrentMarqueeItemIndex()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     return iExtension->iCurrentItem;
     }
 
 void CColumnListBoxData::SetCurrentMarqueeItemIndex(TInt aIndex)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->iCurrentItem = aIndex;
     }
 
@@ -1236,6 +1310,7 @@
 //
 EXPORT_C void CColumnListBoxData::EnableMarqueeL(TBool aEnable)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     // CreateMarqueeControlL does nothing if marquee already exists,
     // so let's just call it just in case.
@@ -1246,15 +1321,13 @@
 
 EXPORT_C void CColumnListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition)
     {
-    if (iExtension)
-        iExtension->iSeparatorLinePosition = aPosition;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    iExtension->iSeparatorLinePosition = aPosition;
     }
 EXPORT_C TAknSeparatorLinePosition CColumnListBoxData::SeparatorLinePosition() const
     {
-    if (iExtension)
-        return iExtension->iSeparatorLinePosition;
-    else
-        return ENoLine;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iSeparatorLinePosition;
     }
 EXPORT_C CAknLayoutData *CColumnListBoxData::LayoutData() const
     {
@@ -1311,12 +1384,12 @@
 //    D'tor
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     delete iColumnArray;
     if (IconArray())
         {
         IconArray()->ResetAndDestroy();
-        if (iExtension)
-            delete iExtension->iIconArray;
+        delete iExtension->iIconArray;
         }
     delete iExtension;
     }
@@ -1393,10 +1466,11 @@
 //    Set a columns width
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     TInt index;
     FindColumnIndexOrAddL(index,aColumn);
     At(index).iWidth=aWidth;
-    if ( iExtension && iExtension->iUseLayoutData )
+    if ( iExtension->iUseLayoutData )
         {
         iExtension->iUseLayoutData = EFalse;
         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
@@ -1467,6 +1541,7 @@
 //  Set a columns baseline position
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     TInt index;
     FindColumnIndexOrAddL(index,aColumn);
@@ -1474,7 +1549,7 @@
     
     // can not be nicely supported by new drawing system
     // --> revert to Symbian style drawing
-    if ( iExtension && iExtension->iUseLayoutData )
+    if ( iExtension->iUseLayoutData )
         {
         iExtension->iUseLayoutData = EFalse;
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
@@ -1509,6 +1584,7 @@
 //  Set a columns vertical cap
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     TInt index;
     FindColumnIndexOrAddL(index,aColumn);
@@ -1516,7 +1592,7 @@
 
     // can not be nicely supported by new drawing system
     // --> revert to Symbian style drawing
-    if ( iExtension && iExtension->iUseLayoutData )
+    if ( iExtension->iUseLayoutData )
         {
         iExtension->iUseLayoutData = EFalse;
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
@@ -1628,6 +1704,7 @@
 //    Set a columns alignment
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     TInt index;
     FindColumnIndexOrAddL(index,aColumn);
     At(index).iAlign=aAlign;
@@ -1728,10 +1805,8 @@
 //    Return the list of icons
 //
     {
-    if (iExtension)
-        return iExtension->iIconArray;
-    else
-        return 0;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iIconArray;
     }
 
 EXPORT_C void CColumnListBoxData::SetIconArray(CArrayPtr<CGulIcon>* aArray)
@@ -1739,14 +1814,9 @@
 //    Passes ownership of the icon list aArray (assumes any previous list has been deleted by the caller)
 //
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if (iExtension)
-        iExtension->iIconArray=aArray;
-    else
-        {
-        aArray->ResetAndDestroy();
-        delete aArray;
-        }    
+    iExtension->iIconArray=aArray; 
     }
 
 EXPORT_C CFont* CColumnListBoxData::Font(const TListItemProperties& /*aItemProperties*/, TInt aColumn) const
@@ -1778,6 +1848,7 @@
 
 void CColumnListBoxData::DrawHighLight( CWindowGc& aGc, const TRect& aRect, TBool aHighlight, MAknsSkinInstance* aSkin ) const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     // SERIES60 Highlight drawing.
     if( aHighlight )
         {
@@ -1943,7 +2014,17 @@
                                      TBool aHighlight,
                                      const TColors& aColors ) const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );    
+    
+    __ASSERT_DEBUG( iExtension->iControl, Panic( EEikPanicNullPointer ));
+    
+    CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
+    if ( listbox && !listbox->View()->ViewRect().Intersects( aRect ) )
+        {
+        // outside of the clipping rect -> don't process this item
+        return;
+        }
 
     TInt lastColumn = Min( LastColumn(), KMaxColumn );
     TInt column=0;
@@ -1951,10 +2032,10 @@
     TPtrC tempText;
 
     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
-
+    
     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
-    if (!cc)
+    if ( !cc )
         {
         cc = SkinBackgroundContext();
         }
@@ -1963,13 +2044,6 @@
     TBool rectClipped[KMaxColumn];
     
     Mem::FillZ( &rectClipped[0], KMaxColumn * sizeof( TBool ) );
-    
-    if ( iExtension->iSubCellsMightIntersect )
-        {
-        CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aRect );
-        }
-
-    CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
@@ -2002,20 +2076,27 @@
             }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
         }
-
-    DrawHighLight( aGc, aRect, aHighlight, skin );
+    if ( iExtension->iCurrentRow < listbox->BottomItemIndex() )
+        {
+        AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
+        }
     
+    DrawHighLight( aGc, aRect, aHighlight, skin );    
+    TRect itemRect( aRect );
+    DrawMarkingModeIcons( aItemProperties, aGc, itemRect );
+    if ( iExtension->iSubCellsMightIntersect )
+        {
+        CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, itemRect );
+        }
     // The column draw loop
     column = 0;
     TInt subCellIndex = 0;
-
-    if ( !iExtension ) { return; }
     
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST   
     if ( transApi )
         {
         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
-        CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
+        CListBoxView* view = listbox->View();
         aGc.SetClippingRect( view->ViewRect() );
         }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
@@ -2025,7 +2106,10 @@
         TextUtils::ColumnText( text, column, aText );
         if ( text == KNullDesC ) { continue; }
 
-        if ( iExtension->FindSLSubCellIndex( subCellIndex, column )!=0 ) { continue; }
+        if ( iExtension->FindSLSubCellIndex( subCellIndex, column )!=0 ) 
+            { 
+            continue; 
+            }
         
         CGraphicsContext::TTextAlign align=ColumnAlignment(column);
         TBool isLayoutAlignment = iExtension->ColumnLayoutAlignment(column);
@@ -2036,22 +2120,26 @@
             
             TRgb textColor( aTextColor );
             
-            if (aHighlight)
+            if ( aHighlight )
                 {
                 textColor = aColors.iHighlightedText;
                 aGc.SetBrushColor(aColors.iHighlightedBack);    
                 }
-            if (AknsUtils::AvkonSkinEnabled())
+            if ( AknsUtils::AvkonSkinEnabled() )
                 {
-                if (iExtension->iTextColor != NULL)
-                    {
-                    textColor = iExtension->iTextColor;
-                    }
-                
-                if (aHighlight && iExtension->iHighlightedTextColor != NULL)
-                    {
-                    textColor = iExtension->iHighlightedTextColor;
-                    }
+                CListBoxView* view = listbox->View();
+                TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor;
+                if ( !useOverrideColor )
+                   {                 
+                   if ( iExtension->iTextColor != NULL )
+                       {
+                       textColor = iExtension->iTextColor;
+                       }
+                   if ( aHighlight && iExtension->iHighlightedTextColor != NULL )
+                       {
+                       textColor = iExtension->iHighlightedTextColor;
+                       }
+                   }
                 }
                 
             const CFont* rowAndColFont=RowAndColumnFont(iExtension->iCurrentRow,column);
@@ -2070,7 +2158,7 @@
                 // check if there are icons affecting this text layout
                 TInt gSC = iExtension->AtSL(subCellIndex).iConditionValue; // graphical subcell which might affect this text subcell
                 
-                if (gSC > -1)
+                if ( gSC > -1 )
                     {
                     TInt tempIndex;
                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
@@ -2086,7 +2174,7 @@
                         }
                     }
                     
-                if (gSC == -1) // no affecting icons -> use default layout
+                if ( gSC == -1 ) // no affecting icons -> use default layout
                     {
                     textLineLayout = iExtension->AtSL(subCellIndex).iTextLayout;
                     }
@@ -2095,7 +2183,7 @@
   
             if( !isLayoutAlignment )
                 { 
-                switch(align) 
+                switch( align ) 
                     {
                     case CGraphicsContext::ELeft : 
                         {
@@ -2117,7 +2205,7 @@
                 }
             
             TAknLayoutText textLayout;
-            textLayout.LayoutText( aRect, textLineLayout, usedFont );
+            textLayout.LayoutText( itemRect, textLineLayout, usedFont );
             // *2 == leave some room for marquee
             const TInt maxlen( KMaxColumnDataLength * 2 ); 
             TBuf<maxlen> convBuf = text.Left(maxlen);
@@ -2153,9 +2241,9 @@
                 }
 
             TBool marqueeDisabled(EFalse);
-            if (listbox != NULL && 
-                listbox->View() != NULL && 
-                listbox->View()->ItemDrawer() != NULL)
+            if ( listbox != NULL && 
+                 listbox->View() != NULL && 
+                 listbox->View()->ItemDrawer() != NULL)
                 {
                 marqueeDisabled = listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
                 }
@@ -2164,7 +2252,7 @@
                 {
                 iExtension->iMarquee->UseLogicalToVisualConversion( bidiConv );
                 
-                if ( iExtension->iMarquee->DrawText( aGc, aRect, textLineLayout, convBuf, usedFont, textColor ) )
+                if ( iExtension->iMarquee->DrawText( aGc, itemRect, textLineLayout, convBuf, usedFont, textColor ) )
                     {
                     // all the loops have been executed
                     textLayout.DrawText( aGc, convBuf, bidiConv, textColor );
@@ -2243,7 +2331,7 @@
                 continue;
                 }
 
-            if (aHighlight && (index > 0xffff))
+            if ( aHighlight && (index > 0xffff) )
                 {
                 index = index >> 16; // we have different icon for highlight
                 }
@@ -2254,10 +2342,10 @@
             TAknWindowLineLayout graphicLayout = iExtension->AtSL(subCellIndex).iGraphicLayout;
             TAknLayoutRect graphicRect; 
             
-            graphicRect.LayoutRect(aRect,graphicLayout);
+            graphicRect.LayoutRect( itemRect,graphicLayout );
             TSize graphicSize( graphicRect.Rect().Size() );
             
-            if (index>=0 && IconArray())
+            if ( index>=0 && IconArray() )
                 {
                 CGulIcon* icon=(*IconArray())[index];
                 CFbsBitmap* bitmap=icon->Bitmap();
@@ -2266,8 +2354,8 @@
                     {
                     TSize size( bitmap->SizeInPixels() );
                     
-                    if (size.iWidth != graphicSize.iWidth &&
-                        size.iHeight != graphicSize.iHeight )
+                    if ( size.iWidth != graphicSize.iWidth &&
+                         size.iHeight != graphicSize.iHeight )
                         {
                         AknIconUtils::SetSize( bitmap,
                                                graphicSize,
@@ -2297,6 +2385,7 @@
                                TBool aHighlight,
                                const TColors& aColors ) const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ ); 
 
     if ( aHighlight )
@@ -2330,11 +2419,62 @@
         return;
         }
 
+    CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
+    TRect itemRect( aRect );
+    
     TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels());
     TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels();
-    TRect textRect( aRect );
+    // SERIES60 Background drawing.
+    MAknsSkinInstance *skin = AknsUtils::SkinInstance();
+    MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
+    if (!cc)
+        {
+        cc = SkinBackgroundContext();
+        }
+
+#ifdef RD_UI_TRANSITION_EFFECTS_LIST
+
+    MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
+
+#endif // RD_UI_TRANSITION_EFFECTS_LIST
+
+    if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
+        {
+#ifdef RD_UI_TRANSITION_EFFECTS_LIST
+        if ( transApi )
+            {
+            transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
+            }
+#endif // RD_UI_TRANSITION_EFFECTS_LIST
+
+        aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+        aGc.SetPenStyle(CGraphicsContext::ESolidPen);
+
+        if ( listbox )
+            {
+            AknsDrawUtils::Background( skin, cc, listbox, aGc, aRect );
+            }
+        else
+            {
+            aGc.Clear(aRect);
+            }
+
+#ifdef RD_UI_TRANSITION_EFFECTS_LIST   
+        if ( transApi )
+            {
+            transApi->StopDrawing();
+            }
+#endif // RD_UI_TRANSITION_EFFECTS_LIST
+        }
+    if ( iExtension->iCurrentRow < listbox->BottomItemIndex() )
+        {
+        AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
+        }
+    DrawHighLight( aGc, aRect, aHighlight, skin );        
+    DrawMarkingModeIcons( aItemProperties, aGc, itemRect );
+    TRect textRect( itemRect );
+    textRect.iBr.iX = itemRect.iTl.iX;    
     TRect textMRect; // textrect with margins.
-    textRect.iBr.iX=aRect.iTl.iX;
     TInt column=0;
     TPtrC text;
 
@@ -2344,11 +2484,11 @@
     // be too difficult to do without - and this is cleaner solution.
     
     // pass 1, figures out x-coordinates for columns.
-    TInt x = aRect.iTl.iX;
+    TInt x = itemRect.iTl.iX;
     TBool mirror = AknLayoutUtils::LayoutMirrored();
     if (mirror)
         {
-        x = aRect.iBr.iX;
+        x = itemRect.iBr.iX;
         }
     TInt maxx = x;
     while(column <= lastColumn)
@@ -2413,58 +2553,7 @@
 
     // pass 3 drawing
 
-    // SERIES60 Background drawing.
-    MAknsSkinInstance *skin = AknsUtils::SkinInstance();
-    MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
-    if (!cc)
-        {
-        cc = SkinBackgroundContext();
-        }
-
-    // aRect is list item's rect, width of which is smaller than width of the list
-    // with a scroll bar. List needs to draw under scroll bar anyway, so we need to
-    // modify given rect here.
-    TRect r(aRect);
-    
-    CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-
-    MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
-
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
-    if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
-        {
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
-        if ( transApi )
-            {
-            transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
-            }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
-        aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
-        aGc.SetPenStyle(CGraphicsContext::ESolidPen);
-
-        if ( listbox )
-            {
-            AknsDrawUtils::Background( skin, cc, listbox, aGc, aRect );
-            }
-        else
-            {
-            aGc.Clear(aRect);
-            }
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST   
-        if ( transApi )
-            {
-            transApi->StopDrawing();
-            }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-        }
-    
- // LISTBOX LINES NEED TO BE DRAWN HERE.
-    DrawHighLight( aGc, aRect, aHighlight, skin );
+
 
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
     if ( transApi )
@@ -2474,7 +2563,6 @@
         aGc.SetClippingRect( view->ViewRect() );
         }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
-
     // The column draw loop
     column = 0;
     FOREVER
@@ -2527,15 +2615,15 @@
                     aGc.SetPenColor(aColors.iHighlightedText);
                     aGc.SetBrushColor(aColors.iHighlightedBack);    
                     }
-
-                if (AknsUtils::AvkonSkinEnabled() && iExtension)
+                CListBoxView* view = listbox->View();
+                TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor;
+                if ( AknsUtils::AvkonSkinEnabled() && !useOverrideColor )
                     {
-                    if (iExtension->iTextColor != NULL)
+                    if ( iExtension->iTextColor != NULL )
                         {
                         aGc.SetPenColor(iExtension->iTextColor);
                         }
-
-                    if (aHighlight && iExtension->iHighlightedTextColor != NULL)
+                    if ( aHighlight && iExtension->iHighlightedTextColor != NULL )
                         {
                         aGc.SetPenColor(iExtension->iHighlightedTextColor);
                         }
@@ -2661,8 +2749,7 @@
                         {
                         CGulIcon* icon=(*IconArray())[index];
                         
-                        if ( iExtension
-                             && iExtension->iSubCellIconSize[column] != TSize(0,0) )
+                        if ( iExtension->iSubCellIconSize[column] != TSize(0,0) )
                             {
                             TSize wanted( iExtension->iSubCellIconSize[column] );
                             TSize got( icon->Bitmap()->SizeInPixels() );
@@ -2735,6 +2822,76 @@
 #endif //RD_UI_TRANSITION_EFFECTS_LIST
     }
 
+// -----------------------------------------------------------------------------
+// CColumnListBoxData::DrawMarkingModeIcons
+// -----------------------------------------------------------------------------
+//
+void CColumnListBoxData::DrawMarkingModeIcons( 
+                const TListItemProperties& aProperties,
+                CWindowGc& aGc,
+                TRect& aItemRect ) const
+    {
+    CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
+    TRect textRect( aItemRect );
+    
+    if ( listbox->View() && listbox->View()->ItemDrawer() )
+        {
+        if ( listbox->View()->ItemDrawer()->Flags() 
+                & CListItemDrawer::EMarkingModeEnabled &&
+                !aProperties.IsSelectionHidden() &&
+                iExtension->iMarkingIconArray &&
+                iExtension->iMarkingIconArray->Count() == 
+                        KMarkingModeIconArraySize )          
+            {
+            if ( AknLayoutUtils::LayoutMirrored() )
+                {
+                textRect.iBr.iX -= 
+                    AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 
+                        0 ).LayoutLine().ir;
+                }
+            else
+                {
+                textRect.iTl.iX += 
+                    AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 
+                        0 ).LayoutLine().il;
+                }            
+            TAknLayoutRect layoutRect;
+            layoutRect.LayoutRect( aItemRect, 
+                AknLayoutScalable_Avkon::list_single_graphic_pane_g1( 0 ) );
+            
+            // unchecked icon
+            CGulIcon* icon = (*iExtension->iMarkingIconArray)[1];
+            
+            if ( listbox->View()->ItemIsSelected( iExtension->iCurrentRow ) )
+                {
+                icon = (*iExtension->iMarkingIconArray)[0];
+                }
+            CFbsBitmap* bitmap = icon->Bitmap();
+            
+            if ( bitmap )
+                {
+                TSize size( bitmap->SizeInPixels() ); // set size if not already
+                TSize targetSize( layoutRect.Rect().Size() );
+                
+                if ( size.iWidth != targetSize.iWidth &&
+                     size.iHeight != targetSize.iHeight )
+                    {
+                    AknIconUtils::SetSize(
+                        bitmap,
+                        targetSize,
+                        EAspectRatioPreservedAndUnusedSpaceRemoved ); 
+                    }
+
+                aGc.BitBltMasked( layoutRect.Rect().iTl,
+                                  bitmap,
+                                  TRect( layoutRect.Rect().Size() ),
+                                  icon->Mask(),
+                                  EFalse );
+                }   
+            aItemRect = textRect;
+            }
+        }
+    }
 
 void CColumnListBoxData::AddColumnL(TInt aColumn)
 //
@@ -2861,8 +3018,8 @@
                                                        TInt aColumn,
                                                        const CFont* aFont)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if (!iExtension) return;
     TInt index = 0;
     iExtension->FindRowAndColumnIndexOrAddL(index,aRow,aColumn);
     iExtension->At(index).iFont=aFont;
@@ -2871,7 +3028,7 @@
 EXPORT_C const CFont* 
 CColumnListBoxData::RowAndColumnFont(TInt aRow,TInt aColumn) const
     {
-    if (!iExtension) return 0;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     TInt index = 0;
     if (iExtension->FindRowAndColumnIndex(index,aRow,aColumn)!=0)
         return 0;
@@ -2880,6 +3037,7 @@
 
 void CColumnListBoxData::SetCurrentItemIndex(TInt aIndex)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     if( iExtension->iCurrentRow != aIndex )
         {
@@ -2906,6 +3064,7 @@
     const TBool aHighlight,
     const TBool aIsTextClipped ) const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     TBool marqueeDisabled =
         static_cast<CEikListBox*>(
@@ -2933,6 +3092,7 @@
 
 EXPORT_C void CColumnListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, const TInt aScrollDelay)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     if ( iExtension->iMarquee )
         {
@@ -2951,6 +3111,7 @@
 EXPORT_C void CColumnListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, 
                                                    const TInt aScrollDelay, const TInt aInterval)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     if ( iExtension->iMarquee )
         {
@@ -2964,8 +3125,9 @@
 EXPORT_C
 void CColumnListBoxData::SetSubCellIconSize(TInt aIndex, TSize aSize)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if (iExtension && aIndex < 6 && aIndex >= 0)
+    if ( aIndex < 6 && aIndex >= 0 )
         {
         iExtension->iSubCellIconSize[aIndex] = aSize;
         }
@@ -2973,7 +3135,8 @@
 
 TSize CColumnListBoxData::GetSubCellIconSize(TInt aIndex)
     {
-    if (iExtension && aIndex < 6 && aIndex >= 0)
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    if ( aIndex < 6 && aIndex >= 0 )
         {
         return iExtension->iSubCellIconSize[aIndex];
         }
@@ -2986,9 +3149,8 @@
 //
 EXPORT_C const CAknsEffectAnim* CColumnListBoxData::HighlightAnim() const
     {
-    if( iExtension )
-        return iExtension->iAnimation;
-    return NULL;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iAnimation;
     }
 
 // -----------------------------------------------------------------------------
@@ -2997,10 +3159,7 @@
 //
 EXPORT_C void CColumnListBoxData::AboutToDrawHighlightAnim() const
     {
-    if( !iExtension )
-        {
-        return;
-        }
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if( !iExtension->iAnimation || !iExtension->iControl )
         {
         return;
@@ -3029,11 +3188,9 @@
 EXPORT_C void CColumnListBoxData::SetHighlightAnimBackgroundDrawer(
     MColumnListBoxAnimBackgroundDrawer* aDrawer )
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if( iExtension )
-        {
-        iExtension->iHighlightBgDrawer = aDrawer;
-        }
+    iExtension->iHighlightBgDrawer = aDrawer;
     }
 
 // -----------------------------------------------------------------------------
@@ -3042,15 +3199,14 @@
 //
 EXPORT_C void CColumnListBoxData::SetItemCellSize( const TSize& aSizeInPixels )
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if( iExtension )
+ 
+    if( iExtension->iAnimSize != aSizeInPixels )
         {
-        if( iExtension->iAnimSize != aSizeInPixels )
-            {
-            iExtension->Play();
-            }
-        iExtension->iAnimSize = aSizeInPixels;
+        iExtension->Play();
         }
+    iExtension->iAnimSize = aSizeInPixels;
     }
 
 // -----------------------------------------------------------------------------
@@ -3059,8 +3215,7 @@
 //
 EXPORT_C TBool CColumnListBoxData::HasHighlightAnim() const
     {
-    if( !iExtension )
-        return EFalse;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if( !iExtension->iAnimation )
         return EFalse;
     return ETrue;
@@ -3073,9 +3228,7 @@
 EXPORT_C TBool CColumnListBoxData::DrawHighlightAnim(
         CBitmapContext& aGc, const TRect& aRect ) const
     {
-    if( !iExtension )
-        return EFalse;
-
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if( !iExtension->iAnimation )
         return EFalse;
 
@@ -3088,6 +3241,7 @@
 //
 void CColumnListBoxData::FocusGained()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->FocusGained();
     }
 
@@ -3097,17 +3251,19 @@
 //
 void CColumnListBoxData::FocusLost()
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->FocusLost();
     }
 
 void CColumnListBoxData::HandleResourceChange( TInt aType )
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s] aType = %d", "CColumnListBoxData", __FUNCTION__, aType  );
     // Animation is skin dependent, whenever skin changes animation changes
     // too.
     if( KAknsMessageSkinChange == aType )
         {
-        iExtension->SkinChanged();
+        TRAP_IGNORE( iExtension->SkinChangedL() );
         }
     else if(aType == KEikDynamicLayoutVariantSwitch)
         {
@@ -3159,34 +3315,28 @@
 
 void CColumnListBoxData::SetESSTextColor(TRgb aTextColor)
     {
-    if (iExtension)
-        iExtension->iTextColor = aTextColor;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    iExtension->iTextColor = aTextColor;
     }
 
 void CColumnListBoxData::SetESSHighlightedTextColor(TRgb aHighlightedTextColor)
     {
-    if (iExtension)
-        iExtension->iHighlightedTextColor = aHighlightedTextColor;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    iExtension->iHighlightedTextColor = aHighlightedTextColor;
     }
 
 EXPORT_C void CColumnListBoxData::SetColumnUnderlined( TBitFlags32 aUnderlinedColumns )
     {
-    if ( iExtension )
-        {
-        iExtension->iUnderlineFlagSet = ETrue;
-        iExtension->iUnderlineFlags   = aUnderlinedColumns;
-        }
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    iExtension->iUnderlineFlagSet = ETrue;
+    iExtension->iUnderlineFlags   = aUnderlinedColumns;
     }
 
 void CColumnListBoxData::SetUnderlineStyle( TListItemProperties aProperties,
                                             CWindowGc& aGc,
                                             TInt aColumn ) const
     {
-    if ( !iExtension )
-        {
-        return;
-        }
-
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     if ( !iExtension->iUnderlineFlagSet )
         {
         // underlining is already either on or off and
@@ -3213,13 +3363,9 @@
 //
 EXPORT_C void CColumnListBoxData::ResetSLSubCellArray()
     {
-    if ( !iExtension )
-        {
-        return;
-        }
-
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->iMarginRect = TRect::EUninitialized;
-    if ( iExtension && iExtension->iUseLayoutData )
+    if ( iExtension->iUseLayoutData )
         {
         iExtension->iUseLayoutData = EFalse;
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST 
@@ -3247,8 +3393,8 @@
 EXPORT_C void CColumnListBoxData::SetGraphicSubCellL(TInt aSubCell,
                                                    const TAknWindowLineLayout &aGraphicLayout)       
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if (!iExtension) return;
     TInt index = 0;
     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
     iExtension->AtSL(index).iTextLayout=NULL;
@@ -3296,8 +3442,8 @@
 EXPORT_C void CColumnListBoxData::SetTextSubCellL(TInt aSubCell,
                                                 const TAknTextLineLayout &aTextLayout)
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
-    if (!iExtension) return;
     TInt index = 0;
     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
     iExtension->AtSL(index).iTextLayout=aTextLayout;
@@ -3346,6 +3492,7 @@
                                                          const TAknTextLineLayout &aTextLayout,
                                                          TInt aAffectedSubCell)  
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
     // iConditionValue of affected subcell (=text subcell, which has different layouts)
     // contains index of graphical subcell, which existence should be checked first.
@@ -3355,7 +3502,6 @@
 
     // for compabitility - needed at least for text wrapping
     SetOptionalColumnL( aSubCell, ETrue );
-    if (!iExtension) return;
 
     TInt i = 0x01;
     i = i << aSubCell;
@@ -3482,10 +3628,8 @@
 //
 TBool CColumnListBoxData::UsesScalableLayoutData() const
     {
-    if (iExtension)
-        return iExtension->iUseLayoutData;
-
-    return EFalse;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iUseLayoutData;
     }
 
 // -----------------------------------------------------------------------------
@@ -3494,11 +3638,7 @@
 //
 void CColumnListBoxData::EnableStretching( const TBool aEnabled )
     {
-    if ( !iExtension )
-        {
-        return;
-        }
-        
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->iStretchingEnabled = aEnabled;        
     }
 
@@ -3509,11 +3649,7 @@
 //
 EXPORT_C TBool CColumnListBoxData::StretchingEnabled() const
     {
-    if ( !iExtension )
-        {
-        return EFalse;
-        }
-        
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );      
     return iExtension->iStretchingEnabled;        
     }
 
@@ -3539,6 +3675,7 @@
     const TDesC& aText, 
     const TRect& aItemRect ) const
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
 
     TInt column = 0;
@@ -3653,6 +3790,7 @@
 //
 EXPORT_C void CColumnListBoxData::SubCellsMightIntersect( const TBool aMightIntersect )
     {
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
     iExtension->iSubCellsMightIntersect = aMightIntersect;
     }
     
@@ -3753,16 +3891,14 @@
 
 EXPORT_C TUint32 CColumnListBoxData::CurrentItemTextWasClipped() const
     {
-    return iExtension ? iExtension->iClippedColumns : 0;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iClippedColumns;
     }
 
 TBool CColumnListBoxData::KineticScrollingEnabled() const
     {
-    if ( iExtension )
-        {
-        return iExtension->iKineticScrolling;       
-        }
-    return EFalse;
+	__ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ) );
+    return iExtension->iKineticScrolling;       
     }