uifw/eikctl/src/EIKCLBD.CPP
changeset 0 2f259fa3e83a
child 3 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <eikclbd.h>
       
    19 #include <aknlists.h>
       
    20 #include <AknsEffectAnim.h>
       
    21 #include <AknPictographInterface.h>
       
    22 #include <AknPictographDrawerInterface.h>
       
    23 #include <centralrepository.h>
       
    24 #include <AvkonInternalCRKeys.h>
       
    25 #include <AknsListBoxBackgroundControlContext.h>
       
    26 #include <AknMarqueeControl.h>
       
    27 #include <eikpanic.h>
       
    28 #include <eikcoctlpanic.h>
       
    29 #include <gulicon.h>
       
    30 #include <AknBidiTextUtils.h>
       
    31 #include <skinlayout.cdl.h>
       
    32 #include <layoutmetadata.cdl.h>
       
    33 #include <aknlayoutscalable_avkon.cdl.h>
       
    34 #include <aknphysics.h>
       
    35 
       
    36 
       
    37 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
    38 #include <aknlistloadertfx.h>
       
    39 #include <aknlistboxtfxinternal.h>
       
    40 #endif //RD_UI_TRANSITION_EFFECTS_LIST
       
    41 
       
    42 #include <touchfeedback.h>
       
    43 
       
    44 #include "akntrace.h"
       
    45 
       
    46 const TInt KColumnListBoxGranularity=4;
       
    47 const TInt KNoActualColumnFont=-1;
       
    48 const TInt KMaxColumn = 6;
       
    49 
       
    50 // colored tick marks support
       
    51 const TInt KColorIconFlag = -1;
       
    52 const TInt KColorIconIdx  =  0;
       
    53 
       
    54 
       
    55 /**
       
    56 * About animation usage:
       
    57 * All animation usage is implemented in this class. Animation is eye candy and
       
    58 * low priority when it comes to resources -> on resource failures animation
       
    59 * fails fast to release resources for more critical functionality. Also, no
       
    60 * attempt to (re)construct failed animation is made.
       
    61 *
       
    62 * User inactivity is not being observed. Only one animation is used. Extension
       
    63 * is CActive to make it possible to postpone animation deletion on animation
       
    64 * failure.
       
    65 */
       
    66 NONSHARABLE_CLASS(CColumnListBoxDataExtension) :
       
    67     public CActive,
       
    68     public MAknPictographAnimatorCallBack,
       
    69     public MCoeForegroundObserver,
       
    70     public MAknsEffectAnimObserver,
       
    71     public MListBoxItemChangeObserver
       
    72     {
       
    73 public:
       
    74     enum TFlag
       
    75         {
       
    76         // Set if current item background should be copied to animation as
       
    77         // input layer.
       
    78         EFlagUpdateBg      = 0,
       
    79 
       
    80         // Set if animation has been resized at least once
       
    81         EFlagHasLayers     = 1,
       
    82 
       
    83         // Set if foreground has been gained.
       
    84         EFlagHasForeground = 2
       
    85         };
       
    86     enum TSubCellType
       
    87         {
       
    88         EEikSLGraphic,
       
    89         EEikSLText,
       
    90         EEikSLNumeric
       
    91         };
       
    92 
       
    93 public:
       
    94     CColumnListBoxDataExtension();
       
    95     void ConstructL( CColumnListBoxData* aListBoxData,
       
    96                      const TAknsItemID& aAnimationIID );
       
    97     ~CColumnListBoxDataExtension();
       
    98     static TInt RedrawEvent(TAny* aControl);
       
    99     TBool IsMarqueeOn();
       
   100     struct SRowAndColumn
       
   101         {
       
   102         TInt iIndex; // 24 bits for row and 8 bits for column
       
   103         const CFont* iFont;
       
   104         };
       
   105     SRowAndColumn& At(TInt aArrayIndex);
       
   106     const SRowAndColumn& At(TInt aArrayIndex) const;
       
   107     void AddRowAndColumnL(TInt aRow,TInt aColumn);
       
   108     TInt FindRowAndColumnIndex(TInt& aArrayIndex,TInt aRow,TInt aColumn) const;
       
   109     void FindRowAndColumnIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aColumn);
       
   110 
       
   111     inline void NoAnimIfError( TInt aError );
       
   112     void TryCreateAnimation();
       
   113     TBool SyncAnim( const TSize& aSize );
       
   114     TBool SyncAndDrawAnim( CBitmapContext& aGc, const TRect& aRect );
       
   115     MAknsControlContext* SkinBackgroundContext() const;
       
   116     void DeleteAnim();
       
   117     void FocusGained();
       
   118     void FocusLost();
       
   119     void SkinChanged();
       
   120     void SetControl( CCoeControl* aControl );
       
   121 
       
   122     // Implementation of MCoeForegroundObserver
       
   123     void HandleGainingForeground();
       
   124     void HandleLosingForeground();
       
   125 
       
   126     // Implementation of MAknsEffectAnimObserver
       
   127     void AnimFrameReady( TInt aError, TInt );
       
   128 
       
   129     // Implementation of MListBoxItemChangeObserver
       
   130     void ListBoxItemsChanged(CEikListBox* aListBox);
       
   131 
       
   132     // Overloads CActive::DoCancel
       
   133     void DoCancel();
       
   134     // Overloads CActive::RunL
       
   135     void RunL();
       
   136 
       
   137     void Play();
       
   138     void CreateColorBitmapsL();
       
   139     
       
   140     TBool DrawPressedDownEffectL( MAknsSkinInstance* aInstance, 
       
   141                                  CWindowGc& aGc, 
       
   142                                  const TRect& aOutRect, 
       
   143                                  const TRect& aInnerRect ) const;
       
   144 public: //for handling column alignment
       
   145     struct TColumnExt
       
   146         {
       
   147         TInt    iColumn; // Must be first entry 
       
   148         TBool   iLayoutAlign;//is layout alignment or Set by client 
       
   149         };    
       
   150     TInt  AddColumnExtL(TInt aColumn);        
       
   151     void  FindColumnExtIndexOrAddL(TInt& aArrayIndex,TInt aColumn);  
       
   152     void  SetColumnLayoutAlignmentL(TInt aColumn);  
       
   153             
       
   154           
       
   155     TBool FindColumnExtIndex(TInt& aArrayIndex,TInt aColumn) const; 
       
   156     TBool ColumnLayoutAlignment(TInt aColumn) const;  
       
   157     
       
   158 public: // new list layout system
       
   159     struct SRowAndSubCell
       
   160         {
       
   161         TInt iIndex; // 24 bits for row and 8 bits for subcell
       
   162         const CFont* iFont;
       
   163         };
       
   164     struct SSLSubCell
       
   165         {
       
   166         TInt iSubCell; // Must be first entry
       
   167         TAknTextLineLayout iTextLayout;
       
   168         TAknWindowLineLayout iGraphicLayout;
       
   169         TInt iSubCellType;
       
   170         TInt iConditionValue; // used with conditional layouts for not always drawn subcells
       
   171         };
       
   172 
       
   173     SSLSubCell& AtSL(TInt aArrayIndex);
       
   174     const SSLSubCell& AtSL(TInt aArrayIndex) const;
       
   175     void AddSLSubCellL(TInt aSubCell);
       
   176     TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const;
       
   177     void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell);
       
   178     void ResetSLSubCellArray();
       
   179 
       
   180     
       
   181 private: // New internal methods
       
   182     TBool DrawHighlightBackground( CFbsBitGc& aGc );
       
   183     void PostDeleteAnimation();
       
   184     void CreateAnimationL();
       
   185     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
       
   186 
       
   187 private: // from MAknPictographAnimatorCallback
       
   188     void DrawPictographArea();
       
   189 
       
   190 public:
       
   191     CArrayPtr<CGulIcon>* iIconArray;
       
   192     CCoeControl *iControl; // not owned
       
   193     CAknsListBoxBackgroundControlContext* iSkinControlContext;
       
   194     const TAknsItemID *iSkinHighlightFrameId;
       
   195     const TAknsItemID *iSkinHighlightFrameCenterId;
       
   196     TBool iSkinEnabled;
       
   197     CAknPictographInterface* iPictoInterface;
       
   198     CAknMarqueeControl*   iMarquee;
       
   199     CAknMarqueeControl*   i2ndLineMarquee;
       
   200     TInt                  iCurrentItem; // Marquee:
       
   201     TInt iCurrentRow; // Current list row being drawn.
       
   202     CArrayFix<SRowAndColumn>* iRowAndColumnArray;
       
   203     TSize iSubCellIconSize[6]; // Store icon sizes for each column
       
   204     TAknSeparatorLinePosition iSeparatorLinePosition;
       
   205     CAknsEffectAnim* iAnimation;
       
   206     /**
       
   207     * Stored flags are explained in enumeration TFlags.
       
   208     */
       
   209     TBitFlags32 iAnimFlags;
       
   210     CColumnListBoxData* iListBoxData;
       
   211     TRgb iHighlightedTextColor;
       
   212     TRgb iTextColor;
       
   213 
       
   214     TAknsItemID iAnimIID;
       
   215     MColumnListBoxAnimBackgroundDrawer* iHighlightBgDrawer;
       
   216     TSize iAnimSize; // TODO Deprecating old style anim API and removing this
       
   217     TBool       iUnderlineFlagSet;  // underlining support for more than
       
   218     TBitFlags32 iUnderlineFlags;    // one text subcell
       
   219     TBool iUseLayoutData;
       
   220     TBool iStretchingEnabled;
       
   221     CArrayFix<SRowAndSubCell>* iRowAndSubCellArray;
       
   222     CArrayFix<SSLSubCell>* iSLSubCellArray;
       
   223     TBool iSubCellsMightIntersect;
       
   224     TRect iParent;  // parent for size calculations
       
   225 
       
   226     // colorskin highlight icons
       
   227     CFbsBitmap* iColorBmp;
       
   228     CFbsBitmap* iHiliBmp;
       
   229     TRgb        iIconColor;
       
   230     TRgb        iHiliIconColor;
       
   231     TInt        iConditionalCells;
       
   232 
       
   233     // which columns of highlighted item have clipped text ?
       
   234     TUint32     iClippedColumns;
       
   235     
       
   236     TBool iKineticScrolling;
       
   237 
       
   238    
       
   239     
       
   240     CArrayFix<TColumnExt>* iColumnExtArray; //for column alignment
       
   241     TRect iMarginRect;
       
   242     };
       
   243 
       
   244 /**
       
   245 * High priority is well argumented because running the active object will
       
   246 * result in animation deletion -> results in freeing resources.
       
   247 */
       
   248 CColumnListBoxDataExtension::CColumnListBoxDataExtension():
       
   249     CActive( EPriorityHigh )
       
   250     {}
       
   251 
       
   252 void CColumnListBoxDataExtension::ConstructL(
       
   253     CColumnListBoxData* aListBoxData,
       
   254     const TAknsItemID& aAnimationIID )
       
   255     {
       
   256     _AKNTRACE_FUNC_ENTER;
       
   257 
       
   258     ASSERT( aListBoxData );
       
   259     iListBoxData = aListBoxData;
       
   260     iRowAndColumnArray=new(ELeave) CArrayFixFlat<SRowAndColumn>(4);
       
   261 
       
   262     iSeparatorLinePosition = ENoLine;
       
   263     
       
   264     iAnimIID = aAnimationIID;
       
   265     CActiveScheduler::Add( this );
       
   266     TryCreateAnimation(); // Animations are created by default
       
   267 
       
   268     // try to set ESS text colors here so that they will be set at least somewhere...
       
   269     iTextColor = NULL; // just in case
       
   270     iHighlightedTextColor = NULL; // just in case
       
   271     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   272     TRgb color;
       
   273 
       
   274     // set ESS text color
       
   275     TInt error = AknsUtils::GetCachedColor( skin,
       
   276                                             color,
       
   277                                             KAknsIIDQsnTextColors,
       
   278                                             EAknsCIQsnTextColorsCG6 );
       
   279     if ( !error )
       
   280         {
       
   281         iTextColor = color;
       
   282         }
       
   283 
       
   284     // set ESS highlighted text color
       
   285     error = AknsUtils::GetCachedColor( skin,
       
   286                                        color,
       
   287                                        KAknsIIDQsnTextColors,
       
   288                                        EAknsCIQsnTextColorsCG10 );
       
   289     if ( !error )
       
   290         {
       
   291         iHighlightedTextColor = color;
       
   292         }
       
   293 
       
   294     iRowAndSubCellArray=new(ELeave) CArrayFixFlat<SRowAndSubCell>(4);
       
   295 
       
   296     iSLSubCellArray=new(ELeave) CArrayFixFlat<SSLSubCell>(4);
       
   297     
       
   298     iColumnExtArray = new(ELeave) CArrayFixFlat<TColumnExt>(KColumnListBoxGranularity);
       
   299 
       
   300 #ifdef RD_LIST_STRETCH
       
   301     // check list stretching from cenrep
       
   302     CRepository* cenRep = CRepository::NewL( KCRUidAvkon );
       
   303     cenRep->Get( KAknAutomaticListStretching, iStretchingEnabled );
       
   304     delete cenRep;
       
   305 #endif // RD_LIST_STRETCH
       
   306 
       
   307     
       
   308     iKineticScrolling = CAknPhysics::FeatureEnabled();
       
   309     _AKNTRACE_FUNC_EXIT;
       
   310     }
       
   311 
       
   312 CColumnListBoxDataExtension::~CColumnListBoxDataExtension()
       
   313     {
       
   314 
       
   315     Cancel();
       
   316 
       
   317     // Stop receiving foreground events
       
   318     CCoeEnv* env = CCoeEnv::Static();
       
   319     env->RemoveForegroundObserver( *this );
       
   320 
       
   321     delete iRowAndColumnArray;
       
   322     iRowAndColumnArray = NULL;
       
   323     delete iSkinControlContext;
       
   324     delete iPictoInterface;
       
   325     delete iMarquee;
       
   326     delete i2ndLineMarquee;
       
   327     delete iAnimation;
       
   328     delete iRowAndSubCellArray;
       
   329     delete iSLSubCellArray;
       
   330     delete iColorBmp;
       
   331     delete iHiliBmp;
       
   332     delete  iColumnExtArray;
       
   333     }
       
   334 
       
   335 MAknsControlContext* CColumnListBoxDataExtension::SkinBackgroundContext() const
       
   336     {
       
   337     if ( iSkinEnabled )
       
   338         {
       
   339         return iSkinControlContext;
       
   340         }
       
   341         
       
   342     return NULL;
       
   343     }
       
   344 
       
   345 // -----------------------------------------------------------------------------
       
   346 // CColumnListBoxDataExtension::NoAnimIfError
       
   347 // -----------------------------------------------------------------------------
       
   348 //
       
   349 inline void CColumnListBoxDataExtension::NoAnimIfError( TInt aError )
       
   350     {
       
   351     if( KErrNone != aError )
       
   352         {
       
   353         DeleteAnim();
       
   354         }
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CColumnListBoxDataExtension::TryCreateAnimation
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 void CColumnListBoxDataExtension::TryCreateAnimation()
       
   362     {
       
   363 
       
   364     if( !iControl )
       
   365         {
       
   366         return;
       
   367         }
       
   368 
       
   369 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
       
   370     CEikListBox* list = static_cast<CEikListBox*>( iControl );
       
   371     CListBoxView* view = list->View();
       
   372     if ( !view || !view->ItemDrawer() )
       
   373         {
       
   374         return;
       
   375         }
       
   376     CWindowGc* gc = view->ItemDrawer()->Gc();
       
   377     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( gc );
       
   378     if ( transApi && transApi->VerifyKml() == KErrNone )
       
   379         {
       
   380         return;
       
   381         }
       
   382 #endif //RD_UI_TRANSITION_EFFECTS_LIST      
       
   383 
       
   384     // Ideally we should not create animation if the list has zero items.
       
   385     // Unfortunately, this will cause problems elsewhere as setting item text
       
   386     // array to list requires not calling HandleItemAddition (or similar
       
   387     // method) -> in some situations animation would not be created at all as
       
   388     // we don't receive item change event. Fortunately, creating animation to
       
   389     // empty list doesn't carry much overhead as layer creation is delayed to
       
   390     // first render.
       
   391 
       
   392     if( !iAnimation )
       
   393         {
       
   394         // This must be the first call because animation does not exist.
       
   395         // Animation layers are created when the animation is rendered for the
       
   396         // first time.
       
   397         TRAPD( err, CreateAnimationL() );
       
   398         NoAnimIfError( err );
       
   399         }
       
   400     }
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // CColumnListBoxDataExtension::SyncAnim
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 TBool CColumnListBoxDataExtension::SyncAnim( const TSize& aSize )
       
   407     {
       
   408 
       
   409     if( !iAnimation || aSize.iWidth <= 0 || aSize.iHeight <= 0 )
       
   410         {
       
   411         return EFalse;
       
   412         }
       
   413 
       
   414     if( iAnimation->Size() != aSize || iAnimation->NeedsInputLayer() )
       
   415         {
       
   416         // Resizing will update animation background
       
   417         iAnimFlags.Clear( EFlagUpdateBg );
       
   418 
       
   419         // Animation exists but its size is out of sync or input layers have
       
   420         // been released
       
   421         TRAPD( err, DoResizeL( aSize, iAnimFlags.IsSet( EFlagHasForeground ) ) );
       
   422 
       
   423         if( err )
       
   424             {
       
   425             DeleteAnim();
       
   426             return EFalse;
       
   427             }
       
   428         iAnimFlags.Set( EFlagHasLayers );
       
   429         }
       
   430 
       
   431     // Highlight animation background needs update (current item has changed)
       
   432     if( iAnimFlags.IsSet( EFlagUpdateBg ) )
       
   433         {
       
   434         iAnimFlags.Clear( EFlagUpdateBg );
       
   435 
       
   436         if( iAnimation->InputRgbGc() )
       
   437             {
       
   438             DrawHighlightBackground( *iAnimation->InputRgbGc() );
       
   439             // We need to update the output frame (otherwise the highlight
       
   440             // would drawn with the old output before the next new animation
       
   441             // frame).
       
   442             NoAnimIfError( iAnimation->UpdateOutput() );
       
   443             if( !iAnimation )
       
   444                 {
       
   445                 return EFalse;
       
   446                 }
       
   447             }
       
   448         }
       
   449 
       
   450     return ETrue;
       
   451     }
       
   452 
       
   453 // -----------------------------------------------------------------------------
       
   454 // CColumnListBoxDataExtension::SyncAndDrawAnim
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 TBool CColumnListBoxDataExtension::SyncAndDrawAnim(
       
   458         CBitmapContext& aGc, const TRect& aRect )
       
   459     {
       
   460     if( iAnimation )
       
   461         {
       
   462         // When application loses foreground or has not yet gained foreground
       
   463         // animation is in stopped state and input layers are not present. It
       
   464         // is possible that list is repainted in this situation. Calling
       
   465         // SyncAnim will create the non-present layers -> WSERV flush ->
       
   466         // flicker. To prevent flickering we just render the existing frame.
       
   467         // This can lead to incorrect draw if the current item index is changed
       
   468         // when the app has no foreground (very unlikely). If EFlagHasLayers is
       
   469         // not set we need to do SyncAnim because it is the first call to draw
       
   470         // (and flicker is not an issue).
       
   471         if( EAknsAnimStateStopped == iAnimation->State() &&
       
   472             !iAnimFlags.IsSet( EFlagHasForeground ) &&
       
   473             iAnimFlags.IsSet( EFlagHasLayers )  &&
       
   474             !iAnimFlags.IsSet( EFlagUpdateBg ) )
       
   475             {
       
   476             return iAnimation->Render( aGc, aRect );
       
   477             }
       
   478         }
       
   479 
       
   480     if( SyncAnim( aRect.Size() ) )
       
   481         {
       
   482         return iAnimation->Render( aGc, aRect );
       
   483         }
       
   484 
       
   485     return EFalse;
       
   486     }
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // CColumnListBoxDataExtension::DeleteAnim
       
   490 // -----------------------------------------------------------------------------
       
   491 //
       
   492 void CColumnListBoxDataExtension::DeleteAnim()
       
   493     {
       
   494     // Stop receiving foreground events
       
   495     CCoeEnv* env = CCoeEnv::Static();
       
   496     env->RemoveForegroundObserver( *this );
       
   497 
       
   498     delete iAnimation;
       
   499     iAnimation = NULL;
       
   500     }
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // CColumnListBoxDataExtension::FocusGained
       
   504 // -----------------------------------------------------------------------------
       
   505 //
       
   506 void CColumnListBoxDataExtension::FocusGained()
       
   507     {
       
   508     Play();
       
   509     }
       
   510 
       
   511 // -----------------------------------------------------------------------------
       
   512 // CColumnListBoxDataExtension::FocusLost
       
   513 // -----------------------------------------------------------------------------
       
   514 //
       
   515 void CColumnListBoxDataExtension::FocusLost()
       
   516     {
       
   517     if( iAnimation )
       
   518         {
       
   519         NoAnimIfError( iAnimation->Pause() );
       
   520         }
       
   521     }
       
   522 
       
   523 // -----------------------------------------------------------------------------
       
   524 // CColumnListBoxDataExtension::SkinChanged
       
   525 // -----------------------------------------------------------------------------
       
   526 //
       
   527 void CColumnListBoxDataExtension::SkinChanged()
       
   528     {
       
   529     DeleteAnim();
       
   530     TryCreateAnimation();
       
   531     CreateColorBitmapsL();
       
   532     }
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // CColumnListBoxDataExtension::SetControl
       
   536 // -----------------------------------------------------------------------------
       
   537 //
       
   538 void CColumnListBoxDataExtension::SetControl( CCoeControl* aControl )
       
   539     {
       
   540     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   541     if( iControl )
       
   542         {
       
   543         CEikListBox* list = (CEikListBox*) iControl;
       
   544         list->RemoveItemChangeObserver( this );
       
   545         }
       
   546 
       
   547     iControl = aControl;
       
   548 
       
   549     if( iControl )
       
   550         {
       
   551         CEikListBox* list = (CEikListBox*) iControl;
       
   552         TRAP_IGNORE( list->AddItemChangeObserverL(this) );
       
   553 
       
   554         if( !iAnimation )
       
   555             {
       
   556             TryCreateAnimation();
       
   557             }
       
   558 
       
   559         if( iAnimation )
       
   560             {
       
   561             Play();
       
   562             }
       
   563         }
       
   564     else
       
   565         {
       
   566         DeleteAnim();
       
   567         }
       
   568     }
       
   569 
       
   570 // -----------------------------------------------------------------------------
       
   571 // CColumnListBoxDataExtension::HandleGainingForeground
       
   572 // -----------------------------------------------------------------------------
       
   573 //
       
   574 void CColumnListBoxDataExtension::HandleGainingForeground()
       
   575     {
       
   576     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   577     // Most of the time focus focus events happen between foreground events.
       
   578     // Unfortunately, there are embedded app related cases where this does not
       
   579     // always hold (it is possible to focus in non-foreground application or
       
   580     // gain foreground without getting a focus gained). Therefore animations
       
   581     // must be started here. This causes potential problem case: foreground
       
   582     // events are broadcasted to all animations, if there are multiple lists
       
   583     // that have focus the result will be multiple animations running at the
       
   584     // same time.
       
   585     iAnimFlags.Set( EFlagHasForeground );
       
   586 
       
   587     if( iAnimation )
       
   588         {
       
   589         // Because we are gaining foreground we must restore input layers
       
   590         // (which are released when animation stops to reduce memory usage).
       
   591         SyncAnim( iAnimation->Size() );
       
   592         }
       
   593 
       
   594     if( iControl )
       
   595         {
       
   596         if( iControl->IsFocused() )
       
   597             {
       
   598             Play();
       
   599             }
       
   600         }
       
   601     }
       
   602 
       
   603 // -----------------------------------------------------------------------------
       
   604 // CColumnListBoxDataExtension::HandleLosingForeground
       
   605 // -----------------------------------------------------------------------------
       
   606 //
       
   607 void CColumnListBoxDataExtension::HandleLosingForeground()
       
   608     {
       
   609     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   610     iAnimFlags.Clear( EFlagHasForeground );
       
   611     if( iAnimation )
       
   612         {
       
   613         NoAnimIfError( iAnimation->Stop() );
       
   614         }
       
   615     }
       
   616 
       
   617 // -----------------------------------------------------------------------------
       
   618 // CColumnListBoxDataExtension::AnimFrameReady
       
   619 // -----------------------------------------------------------------------------
       
   620 //
       
   621 void CColumnListBoxDataExtension::AnimFrameReady( TInt aError, TInt )
       
   622     {
       
   623     if( KErrNone != aError )
       
   624         {
       
   625         // Animation has failed to run -> schedule the animation for
       
   626         // deletion to fall back to normal rendering.
       
   627         PostDeleteAnimation();
       
   628         return;
       
   629         }
       
   630 
       
   631     // This situation should never happen because we start/stop animation when
       
   632     // the extension's control is set.
       
   633     if( !iControl )
       
   634         return;
       
   635 
       
   636     // From now on, we have a valid control pointer
       
   637     CEikColumnListBox* list = static_cast<CEikColumnListBox*>( iControl );
       
   638     CListBoxView* view = list->View();
       
   639 
       
   640     if( !view )
       
   641         return;
       
   642 
       
   643     // We should not run animation when control is in certain states. When
       
   644     // control is in these states we idle the animation until the control state
       
   645     // becomes valid again.
       
   646     TBool invalid = !iControl->IsVisible() ||
       
   647                     iControl->IsDimmed() ||
       
   648                     (view->ItemDrawer()->Flags() & CListItemDrawer::EDisableHighlight);
       
   649 
       
   650     // Check for idling
       
   651     if( iAnimation->IsIdling() )
       
   652         {
       
   653         if( invalid )
       
   654             {
       
   655             // We are idling and the control is still invalid -> keep on
       
   656             // idling.
       
   657             return;
       
   658             }
       
   659         else
       
   660             {
       
   661             // Control is in valid state, animation should be continued
       
   662             TInt err = iAnimation->Continue();
       
   663             if( err )
       
   664                 PostDeleteAnimation();
       
   665             return;
       
   666             }
       
   667         }
       
   668     else if( invalid ) // Not idling and invalid control -> start idling
       
   669         {
       
   670         iAnimation->SetIdling( KAknsEffectAnimDefaultIdleInterval );
       
   671         // If the highlight has been disabled, render once to clear the
       
   672         // highlight (not returning in that case).
       
   673         if( !(view->ItemDrawer()->Flags() & CListItemDrawer::EDisableHighlight) )
       
   674             return;
       
   675         }
       
   676 
       
   677     // No items, no drawing
       
   678     if( list->Model()->NumberOfItems() == 0 )
       
   679         {
       
   680         return;
       
   681         }
       
   682 
       
   683     // Column array is not ready yet
       
   684     if( iListBoxData->LastColumn() < 0 )
       
   685         {
       
   686         return;
       
   687         }
       
   688 
       
   689     // Repaint the highlighted cell only
       
   690     view->DrawItem( view->CurrentItemIndex() );
       
   691     }
       
   692 
       
   693 // -----------------------------------------------------------------------------
       
   694 // CColumnListBoxDataExtension::ListBoxItemsChanged
       
   695 
       
   696 // we get here from:
       
   697 // - CEikListBox::Reset()
       
   698 // - CEikListBox::HandleItemRemoval{WithoutSelections}L()
       
   699 // - CEikListBox::HandleItemAdditionL()
       
   700 // - CEikListBox::FireItemChange()
       
   701 // In all cases:
       
   702 // - feedback areas might be invalid
       
   703 // - application is responsible for redrawing the listbox.
       
   704 //
       
   705 // since re-drawing listbox fixes feedback areas, those can be reset here.
       
   706 
       
   707 // -----------------------------------------------------------------------------
       
   708 //
       
   709 void CColumnListBoxDataExtension::ListBoxItemsChanged(
       
   710         CEikListBox* aListBox)
       
   711     {
       
   712     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   713     TInt items = aListBox->Model()->NumberOfItems();
       
   714 
       
   715     if( iAnimation )
       
   716         {
       
   717         if( 0 == items )
       
   718             {
       
   719             DeleteAnim();
       
   720             }
       
   721         else
       
   722             {
       
   723             Play();
       
   724             }
       
   725         }
       
   726     else if( !iAnimation )
       
   727         {
       
   728         // Animation doesn't exist and we have > 0 items
       
   729         TryCreateAnimation();
       
   730         }
       
   731     }
       
   732 
       
   733 // -----------------------------------------------------------------------------
       
   734 // CColumnListBoxDataExtension::DoCancel
       
   735 // -----------------------------------------------------------------------------
       
   736 //
       
   737 void CColumnListBoxDataExtension::DoCancel()
       
   738     {
       
   739     // Required method, but not needed
       
   740     }
       
   741 
       
   742 // -----------------------------------------------------------------------------
       
   743 // CColumnListBoxDataExtension::RunL
       
   744 // Postponed animation deletion is done here.
       
   745 // -----------------------------------------------------------------------------
       
   746 //
       
   747 void CColumnListBoxDataExtension::RunL()
       
   748     {
       
   749     DeleteAnim();
       
   750     }
       
   751 
       
   752 // -----------------------------------------------------------------------------
       
   753 // CColumnListBoxDataExtension::Play
       
   754 // -----------------------------------------------------------------------------
       
   755 //
       
   756 void CColumnListBoxDataExtension::Play()
       
   757     {
       
   758     if( !iAnimation )
       
   759         {
       
   760         return;
       
   761         }
       
   762 
       
   763     // No need to start running/finished animation
       
   764     if( EAknsAnimStateRunning == iAnimation->State() ||
       
   765         EAknsAnimStateFinished == iAnimation->State() )
       
   766         {
       
   767         return;
       
   768         }
       
   769 
       
   770     // Check that application is on foreground because there are cases where
       
   771     // focus changes are done after foreground is lost -> potentially leads to
       
   772     // multiple running animations.
       
   773     if( !iAnimFlags.IsSet( EFlagHasForeground ) )
       
   774         {
       
   775         return;
       
   776         }
       
   777 
       
   778     // Animation cannot run if we don't have control (nowhere to draw)
       
   779     if( !iControl )
       
   780         {
       
   781         return;
       
   782         }
       
   783 
       
   784     // The control must also have the focus
       
   785     if( !iControl->IsFocused() )
       
   786         {
       
   787         return;
       
   788         }
       
   789 
       
   790     // Don't animate empty list
       
   791     CEikColumnListBox* list = static_cast<CEikColumnListBox*>( iControl );
       
   792     if( list->Model()->NumberOfItems() == 0 )
       
   793         {
       
   794         return;
       
   795         }
       
   796 
       
   797     // All preconditions are met: we have animation, foreground, focus, more
       
   798     // than zero items and animation is either paused or stopped. Invisibility,
       
   799     // dimming and disabled highlight are handled by idling the animation (see
       
   800     // AnimFrameReady).
       
   801 
       
   802     if( EAknsAnimStatePaused == iAnimation->State() )
       
   803         {
       
   804         NoAnimIfError( iAnimation->Continue() );
       
   805         }
       
   806     else if( EAknsAnimStateStopped == iAnimation->State() )
       
   807         {
       
   808         NoAnimIfError( iAnimation->Start() );
       
   809         }
       
   810     }
       
   811 
       
   812 // -----------------------------------------------------------------------------
       
   813 // CColumnListBoxDataExtension::DrawHighlightBackground
       
   814 // -----------------------------------------------------------------------------
       
   815 //
       
   816 TBool CColumnListBoxDataExtension::DrawHighlightBackground( CFbsBitGc& aGc )
       
   817     {
       
   818     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   819     if( iHighlightBgDrawer ) // Bg drawing is done externally (in derived class)
       
   820         {
       
   821         return iHighlightBgDrawer->DrawHighlightAnimBackground( aGc );
       
   822         }
       
   823 
       
   824     // Draw the background under the current highlight. This is simplified
       
   825     // drawing, we only grab a piece from the list background bitmap.
       
   826     CEikColumnListBox* list =
       
   827         static_cast<CEikColumnListBox*>( iControl );
       
   828     CListBoxView* view = list->View();
       
   829     TRect itemRect;
       
   830     TInt index = view->CurrentItemIndex();
       
   831 
       
   832     // It is possible that the animation is constructed when the list is
       
   833     // empty. In this case draw the first element background (drawing works ok
       
   834     // even if the list has no items).
       
   835     if( list->Model()->NumberOfItems() == 0 )
       
   836         {
       
   837         index = 0;
       
   838         }
       
   839 
       
   840     itemRect.SetRect( view->ItemPos( index ), iAnimation->Size() );
       
   841 
       
   842     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   843     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iControl );
       
   844 
       
   845     if( !cc )
       
   846         cc = SkinBackgroundContext();
       
   847 
       
   848     return AknsDrawUtils::DrawBackground( skin, cc, iControl, aGc, TPoint(0,0),
       
   849                                           itemRect, KAknsDrawParamBottomLevelRGBOnly );
       
   850     }
       
   851 
       
   852 // -----------------------------------------------------------------------------
       
   853 // CColumnListBoxDataExtension::PostDeleteAnimation
       
   854 // Schedules the animation for deletion by activating the extension itself.
       
   855 // Deletion is postponed because in many error/failure occasions the caller has
       
   856 // been animation and direct deletion is possibly not safe (because function
       
   857 // stack would return through the deleted object).
       
   858 // -----------------------------------------------------------------------------
       
   859 //
       
   860 void CColumnListBoxDataExtension::PostDeleteAnimation()
       
   861     {
       
   862     TRequestStatus* status = &iStatus;
       
   863     User::RequestComplete( status, KErrNone );
       
   864     SetActive();
       
   865     }
       
   866 
       
   867 // -----------------------------------------------------------------------------
       
   868 // CColumnListBoxDataExtension::CreateAnimationL
       
   869 // -----------------------------------------------------------------------------
       
   870 //
       
   871 void CColumnListBoxDataExtension::CreateAnimationL()
       
   872     {
       
   873 
       
   874     DeleteAnim();
       
   875 
       
   876     // Check if derived class wants to disable highligh animation
       
   877     if( KAknsIIDNone == iAnimIID )
       
   878         {
       
   879         return;
       
   880         }
       
   881 
       
   882     // Create animation
       
   883     CCoeEnv* env = CCoeEnv::Static();
       
   884     env->AddForegroundObserverL( *this );
       
   885 
       
   886     iAnimation = CAknsEffectAnim::NewL( this );
       
   887     TBool ok = iAnimation->ConstructFromSkinL( iAnimIID );
       
   888 
       
   889     if( !ok ) // Animation for the ID was not found from the skin
       
   890         {
       
   891         User::Leave( KErrNotFound );
       
   892         }
       
   893 
       
   894     // Sync the local foreground flag state. Foreground state is stored locally
       
   895     // because calling AppUi::IsForeground causes WSERV flush (shocking) and
       
   896     // therefore it cannot be used in draw routines.
       
   897     CAknAppUi* aui = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
       
   898     iAnimFlags.Assign( EFlagHasForeground, aui->IsForeground() );
       
   899 
       
   900     Play();
       
   901     }
       
   902 
       
   903 // -----------------------------------------------------------------------------
       
   904 // CColumnListBoxDataExtension::DoResizeL
       
   905 // -----------------------------------------------------------------------------
       
   906 //
       
   907 void CColumnListBoxDataExtension::DoResizeL(
       
   908     const TSize& aHighlightSize, TBool aAboutToStart )
       
   909     {
       
   910     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   911     iAnimation->BeginConfigInputLayersL( aHighlightSize, aAboutToStart );
       
   912 
       
   913     if( iAnimation->InputRgbGc() )
       
   914         {
       
   915         DrawHighlightBackground( *iAnimation->InputRgbGc() );
       
   916         }
       
   917 
       
   918     iAnimation->EndConfigInputLayersL();
       
   919     }
       
   920 
       
   921 void CColumnListBoxDataExtension::DrawPictographArea()
       
   922     {
       
   923     iControl->DrawNow();
       
   924     }
       
   925 
       
   926 TInt CColumnListBoxDataExtension::RedrawEvent(TAny* aControl)
       
   927     {
       
   928     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   929     if (!((CCoeControl*)aControl)->IsVisible())
       
   930         {
       
   931         return EFalse;
       
   932         }
       
   933     CEikColumnListBox* listBox = 
       
   934             (CEikColumnListBox*)aControl;
       
   935     
       
   936     // HWET-7BDDD4
       
   937     CListBoxView* view = listBox->View();
       
   938     TInt index = listBox->CurrentItemIndex();
       
   939     if ( view->ItemIsVisible( index ) )
       
   940         {
       
   941         listBox->DrawItem( index );
       
   942         }
       
   943      return ETrue;
       
   944     }
       
   945 
       
   946 TBool CColumnListBoxDataExtension::IsMarqueeOn()
       
   947     {
       
   948     TBool isOn = EFalse;
       
   949     if (iMarquee)
       
   950         isOn = iMarquee->IsMarqueeOn();
       
   951     _AKNTRACE( "[%s][%s] isOn = %d",
       
   952                             "CColumnListBoxDataExtension", __FUNCTION__, isOn );
       
   953     return isOn;
       
   954     }
       
   955 void CColumnListBoxDataExtension::AddSLSubCellL(TInt aSubCell)
       
   956     {
       
   957     SSLSubCell subcell;
       
   958     subcell.iSubCell = aSubCell;
       
   959     subcell.iTextLayout = NULL;
       
   960     subcell.iGraphicLayout = NULL;
       
   961     subcell.iSubCellType = 0;
       
   962     subcell.iConditionValue = -1;
       
   963 
       
   964     TKeyArrayFix key(0,ECmpTInt32);
       
   965     iSLSubCellArray->InsertIsqL(subcell,key);
       
   966     }
       
   967 
       
   968 void 
       
   969 CColumnListBoxDataExtension::AddRowAndColumnL(TInt aRow,TInt aColumn)
       
   970     {
       
   971     SRowAndColumn column;
       
   972     column.iIndex = (aRow << 8) | (aColumn & 0xff);
       
   973     TKeyArrayFix key(0,ECmpTInt32);
       
   974     iRowAndColumnArray->InsertIsqL(column,key);
       
   975     }
       
   976 
       
   977 
       
   978 CColumnListBoxDataExtension::SRowAndColumn& 
       
   979 CColumnListBoxDataExtension::At(TInt aArrayIndex)
       
   980     {
       
   981     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iRowAndColumnArray->Count(),Panic(EEikPanicOutOfRange));
       
   982     return(iRowAndColumnArray->At(aArrayIndex));
       
   983     }
       
   984 
       
   985 const CColumnListBoxDataExtension::SRowAndColumn& 
       
   986 CColumnListBoxDataExtension::At(TInt aArrayIndex) const
       
   987     {
       
   988     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iRowAndColumnArray->Count(),Panic(EEikPanicOutOfRange));
       
   989     return(iRowAndColumnArray->At(aArrayIndex));
       
   990     }
       
   991 
       
   992 TInt CColumnListBoxDataExtension::FindRowAndColumnIndex(TInt& aArrayIndex,
       
   993                                                                 TInt aRow,
       
   994                                                                 TInt aColumn) const
       
   995     {
       
   996     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
   997     if (iRowAndColumnArray->Count()==0)
       
   998         return(KErrNotFound);
       
   999     TKeyArrayFix key(0,ECmpTInt32);
       
  1000     SRowAndColumn rowAndColumn;
       
  1001     rowAndColumn.iIndex = (aRow << 8) | (aColumn & 0xff);
       
  1002     return(iRowAndColumnArray->FindIsq(rowAndColumn,key,aArrayIndex));
       
  1003     }
       
  1004 
       
  1005 void CColumnListBoxDataExtension::FindRowAndColumnIndexOrAddL(TInt& aArrayIndex,
       
  1006                                                                       TInt aRow,
       
  1007                                                                       TInt aColumn)
       
  1008     {
       
  1009     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1010     if (FindRowAndColumnIndex(aArrayIndex,aRow,aColumn)!=0) //==KErrNotFound)
       
  1011         {
       
  1012         AddRowAndColumnL(aRow,aColumn);
       
  1013         FindRowAndColumnIndex(aArrayIndex,aRow,aColumn);
       
  1014         }
       
  1015     }
       
  1016     
       
  1017 /////////////handling TColumnExt,start
       
  1018 
       
  1019 TInt CColumnListBoxDataExtension::AddColumnExtL(TInt aColumn)
       
  1020     {
       
  1021     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1022     TColumnExt column;
       
  1023     column.iColumn=aColumn;
       
  1024     column.iLayoutAlign = ETrue;
       
  1025     TKeyArrayFix key(0,ECmpTInt);
       
  1026     return iColumnExtArray->InsertIsqL(column,key);
       
  1027     }
       
  1028 void CColumnListBoxDataExtension::FindColumnExtIndexOrAddL(TInt& aArrayIndex,TInt aColumn)
       
  1029     {
       
  1030     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1031     if (!FindColumnExtIndex(aArrayIndex,aColumn))
       
  1032         {
       
  1033         aArrayIndex = AddColumnExtL(aColumn);
       
  1034         
       
  1035         }
       
  1036     }
       
  1037     
       
  1038 void CColumnListBoxDataExtension::SetColumnLayoutAlignmentL(TInt aColumn)
       
  1039     {
       
  1040     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1041     TInt index;
       
  1042     FindColumnExtIndexOrAddL(index,aColumn);  
       
  1043     iColumnExtArray->At(index).iLayoutAlign = EFalse;
       
  1044     }
       
  1045     
       
  1046     
       
  1047 TBool CColumnListBoxDataExtension::FindColumnExtIndex(TInt& aArrayIndex,TInt aColumn) const
       
  1048     {
       
  1049     if (aColumn<0 || iColumnExtArray->Count()==0)
       
  1050         return EFalse;
       
  1051     TKeyArrayFix key(0,ECmpTInt);
       
  1052     TColumnExt column;
       
  1053     column.iColumn=aColumn;
       
  1054 
       
  1055     // Returns zero if key was found, otherwise non-zero
       
  1056     TInt ret = iColumnExtArray->FindIsq(column,key,aArrayIndex);
       
  1057     return (ret == 0);
       
  1058     }
       
  1059         
       
  1060 TBool CColumnListBoxDataExtension::ColumnLayoutAlignment(TInt aColumn) const
       
  1061     {
       
  1062     TInt index;
       
  1063     if (!FindColumnExtIndex(index,aColumn))
       
  1064         return(ETrue);
       
  1065     return(iColumnExtArray->At(index).iLayoutAlign); 
       
  1066     }    
       
  1067     
       
  1068 /////////////handling TColumnExt,end    
       
  1069 CColumnListBoxDataExtension::SSLSubCell& 
       
  1070 CColumnListBoxDataExtension::AtSL(TInt aArrayIndex)
       
  1071     {
       
  1072     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EEikPanicOutOfRange));
       
  1073     return(iSLSubCellArray->At(aArrayIndex));
       
  1074     }
       
  1075 
       
  1076 const CColumnListBoxDataExtension::SSLSubCell& 
       
  1077 CColumnListBoxDataExtension::AtSL(TInt aArrayIndex) const
       
  1078     {
       
  1079     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EEikPanicOutOfRange));
       
  1080     return(iSLSubCellArray->At(aArrayIndex));
       
  1081     }
       
  1082 
       
  1083 TInt CColumnListBoxDataExtension::FindSLSubCellIndex(TInt& aArrayIndex,
       
  1084                                                             TInt aSubCell) const
       
  1085     {
       
  1086     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1087     if (iSLSubCellArray->Count()==0)
       
  1088         return(KErrNotFound);
       
  1089     TKeyArrayFix key(0,ECmpTInt32);
       
  1090     SSLSubCell SLSubCell;
       
  1091     SLSubCell.iSubCell = aSubCell;
       
  1092     return(iSLSubCellArray->FindIsq(SLSubCell,key,aArrayIndex));
       
  1093     }
       
  1094 
       
  1095 void CColumnListBoxDataExtension::FindSLSubCellIndexOrAddL(TInt& aArrayIndex,
       
  1096                                                                   TInt aSubCell)
       
  1097     {
       
  1098     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1099     if (FindSLSubCellIndex(aArrayIndex, aSubCell)!=0) //==KErrNotFound)
       
  1100         {
       
  1101         AddSLSubCellL(aSubCell);
       
  1102         FindSLSubCellIndex(aArrayIndex,aSubCell);
       
  1103         }
       
  1104     }
       
  1105 
       
  1106 void CColumnListBoxDataExtension::ResetSLSubCellArray()
       
  1107     {
       
  1108     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  1109     iSLSubCellArray->Reset();
       
  1110     iRowAndSubCellArray->Reset();
       
  1111     }
       
  1112 
       
  1113 TBool CColumnListBoxDataExtension::DrawPressedDownEffectL( MAknsSkinInstance* aInstance, 
       
  1114                                                           CWindowGc& aGc,const TRect& aOutRect, 
       
  1115                                                           const TRect& aInnerRect ) const
       
  1116     {
       
  1117     return AknsDrawUtils::DrawFrame( aInstance,
       
  1118                                      aGc,
       
  1119                                      aOutRect,
       
  1120                                      aInnerRect,
       
  1121                                      KAknsIIDQsnFrListPressed,
       
  1122                                      KAknsIIDQsnFrListCenterPressed );
       
  1123     }
       
  1124 
       
  1125 EXPORT_C CCoeControl *CColumnListBoxData::Control() const 
       
  1126     {
       
  1127     return iExtension->iControl;
       
  1128     }
       
  1129 
       
  1130 EXPORT_C void CColumnListBoxData::SetControl(CCoeControl *aControl)
       
  1131     {
       
  1132     iExtension->SetControl( aControl );
       
  1133     }
       
  1134 
       
  1135 
       
  1136 EXPORT_C MAknsControlContext* CColumnListBoxData::SkinBackgroundContext() const
       
  1137     {
       
  1138     if (iExtension->iSkinEnabled)
       
  1139         {
       
  1140         return iExtension->iSkinControlContext;
       
  1141         }
       
  1142         
       
  1143     return NULL;
       
  1144     }
       
  1145 
       
  1146 void CColumnListBoxData::SetSkinBackgroundContext(CAknsListBoxBackgroundControlContext *aContext)
       
  1147     {
       
  1148     delete iExtension->iSkinControlContext;
       
  1149     iExtension->iSkinControlContext = aContext;
       
  1150     }
       
  1151 
       
  1152 void CColumnListBoxData::CreatePictographInterfaceL()
       
  1153     {
       
  1154     if ( !iExtension->iPictoInterface )
       
  1155         {
       
  1156         iExtension->iPictoInterface = CAknPictographInterface::NewL(
       
  1157             *iExtension->iControl, *iExtension );
       
  1158         }
       
  1159     }
       
  1160 
       
  1161 EXPORT_C void CColumnListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
       
  1162     {
       
  1163     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1164     iExtension->iSkinHighlightFrameId = aFrameId;
       
  1165     iExtension->iSkinHighlightFrameCenterId = aFrameCenterId;
       
  1166     }
       
  1167 
       
  1168 EXPORT_C void CColumnListBoxData::SetSkinEnabledL(TBool aEnabled)
       
  1169     {
       
  1170     CListBoxData::SetSkinEnabledL(aEnabled);
       
  1171     iExtension->iSkinEnabled = aEnabled;
       
  1172     }
       
  1173 
       
  1174 EXPORT_C void CColumnListBoxData::SetSkinStyle(const TAknsItemID *aId, const TRect &aTileRect)
       
  1175     {
       
  1176     if (iExtension->iSkinControlContext)
       
  1177         {
       
  1178         iExtension->iSkinControlContext->SetTiledBitmap(*aId);
       
  1179         iExtension->iSkinControlContext->SetTiledRect(aTileRect);
       
  1180         }
       
  1181     }
       
  1182 
       
  1183 EXPORT_C void CColumnListBoxData::SetListEndSkinStyle(const TAknsItemID *aId, const TRect &aTileRect)
       
  1184     {
       
  1185     if (iExtension->iSkinControlContext)
       
  1186         {
       
  1187         iExtension->iSkinControlContext->SetBottomBitmap(*aId);
       
  1188         iExtension->iSkinControlContext->SetBottomRect(aTileRect);
       
  1189         }
       
  1190     }
       
  1191 
       
  1192 void CColumnListBoxData::CreateMarqueeControlL()
       
  1193     {
       
  1194     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1195     if ( !iExtension->iMarquee )
       
  1196         {
       
  1197         iExtension->iMarquee = CAknMarqueeControl::NewL();
       
  1198         }
       
  1199     
       
  1200      if ( !iExtension->i2ndLineMarquee )
       
  1201         {
       
  1202         iExtension->i2ndLineMarquee = CAknMarqueeControl::NewL();
       
  1203         }
       
  1204     
       
  1205     TCallBack callBack(CColumnListBoxDataExtension::RedrawEvent, 
       
  1206                         iExtension->iControl);
       
  1207     iExtension->iMarquee->SetRedrawCallBack(callBack);
       
  1208     iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack);
       
  1209     }
       
  1210 
       
  1211 void CColumnListBoxData::ResetMarquee()
       
  1212     {
       
  1213     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1214     if (iExtension->iMarquee)
       
  1215         {
       
  1216         iExtension->iMarquee->Reset();
       
  1217         }
       
  1218     if (iExtension->i2ndLineMarquee)
       
  1219         {
       
  1220         iExtension->i2ndLineMarquee->Reset();
       
  1221         }
       
  1222     }
       
  1223 
       
  1224 TInt CColumnListBoxData::CurrentMarqueeItemIndex()
       
  1225     {
       
  1226     return iExtension->iCurrentItem;
       
  1227     }
       
  1228 
       
  1229 void CColumnListBoxData::SetCurrentMarqueeItemIndex(TInt aIndex)
       
  1230     {
       
  1231     iExtension->iCurrentItem = aIndex;
       
  1232     }
       
  1233 
       
  1234 //
       
  1235 // Enables or disables marquee.
       
  1236 //
       
  1237 EXPORT_C void CColumnListBoxData::EnableMarqueeL(TBool aEnable)
       
  1238     {
       
  1239     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1240     // CreateMarqueeControlL does nothing if marquee already exists,
       
  1241     // so let's just call it just in case.
       
  1242     CreateMarqueeControlL();
       
  1243     iExtension->iMarquee->EnableMarquee(aEnable);
       
  1244     iExtension->i2ndLineMarquee->EnableMarquee(aEnable);
       
  1245     }
       
  1246 
       
  1247 EXPORT_C void CColumnListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition)
       
  1248     {
       
  1249     if (iExtension)
       
  1250         iExtension->iSeparatorLinePosition = aPosition;
       
  1251     }
       
  1252 EXPORT_C TAknSeparatorLinePosition CColumnListBoxData::SeparatorLinePosition() const
       
  1253     {
       
  1254     if (iExtension)
       
  1255         return iExtension->iSeparatorLinePosition;
       
  1256     else
       
  1257         return ENoLine;
       
  1258     }
       
  1259 EXPORT_C CAknLayoutData *CColumnListBoxData::LayoutData() const
       
  1260     {
       
  1261     return NULL;
       
  1262     }
       
  1263 
       
  1264 EXPORT_C TBool CColumnListBoxData::LayoutInit() const
       
  1265     {
       
  1266     return EFalse;
       
  1267     }
       
  1268 
       
  1269 EXPORT_C void CColumnListBoxData::SetLayoutInit(TBool /*aValue*/) const
       
  1270     {
       
  1271     }
       
  1272 
       
  1273 
       
  1274 //
       
  1275 //    Class CColumnListBoxData::TColors
       
  1276 //
       
  1277 
       
  1278 /**
       
  1279  * Constructs and intialises the data colors to blacks and whites.
       
  1280  */
       
  1281 EXPORT_C CColumnListBoxData::TColors::TColors()
       
  1282     : iText(KRgbBlack), iBack(KRgbWhite), iHighlightedText(KRgbWhite), iHighlightedBack(KRgbBlack)
       
  1283     {
       
  1284     }
       
  1285 
       
  1286 //
       
  1287 //    Class CColumnListBoxData
       
  1288 //
       
  1289 
       
  1290 EXPORT_C CColumnListBoxData* CColumnListBoxData::NewL()
       
  1291 //
       
  1292 //    Public c'tor
       
  1293 //
       
  1294     {
       
  1295     CColumnListBoxData* self=new(ELeave) CColumnListBoxData();
       
  1296     self->ConstructLD();
       
  1297     return(self);
       
  1298     }
       
  1299 
       
  1300 EXPORT_C CColumnListBoxData::CColumnListBoxData()
       
  1301                 : CListBoxData()
       
  1302 //
       
  1303 //  Protected c'tor
       
  1304 //
       
  1305     {
       
  1306     __DECLARE_NAME(_S("CColumnListBoxData"));
       
  1307     }
       
  1308 
       
  1309 EXPORT_C CColumnListBoxData::~CColumnListBoxData()
       
  1310 //
       
  1311 //    D'tor
       
  1312 //
       
  1313     {
       
  1314     delete iColumnArray;
       
  1315     if (IconArray())
       
  1316         {
       
  1317         IconArray()->ResetAndDestroy();
       
  1318         if (iExtension)
       
  1319             delete iExtension->iIconArray;
       
  1320         }
       
  1321     delete iExtension;
       
  1322     }
       
  1323 
       
  1324 EXPORT_C void CColumnListBoxData::ConstructLD()
       
  1325     {
       
  1326     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1327     TRAPD( err, DoConstructL( KAknsIIDQsnAnimList ) );
       
  1328     if( err )
       
  1329         {
       
  1330         delete(this);
       
  1331         User::Leave( err );
       
  1332         }
       
  1333     }
       
  1334 
       
  1335 EXPORT_C void CColumnListBoxData::ConstructLD(
       
  1336     const TAknsItemID& aAnimationIID )
       
  1337     {
       
  1338     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1339     TRAPD( err, DoConstructL( aAnimationIID ) );
       
  1340     if( err )
       
  1341         {
       
  1342         delete(this);
       
  1343         User::Leave( err );
       
  1344         }
       
  1345     }
       
  1346 
       
  1347 void CColumnListBoxData::DoConstructL( const TAknsItemID& aAnimationIID )
       
  1348     {
       
  1349     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1350     iColumnArray = new(ELeave) CArrayFixFlat<SColumn>(KColumnListBoxGranularity);
       
  1351     iExtension = new(ELeave) CColumnListBoxDataExtension;
       
  1352 
       
  1353     iExtension->iSkinEnabled = AknsUtils::AvkonSkinEnabled();
       
  1354     SetupSkinContextL();
       
  1355 
       
  1356     iExtension->ConstructL( this, aAnimationIID );
       
  1357 
       
  1358     CListBoxData::SetSkinBackgroundControlContextL(iExtension->iSkinControlContext);
       
  1359 
       
  1360     // preallocate columns so that we dont need to leave on
       
  1361     // SizeChanged().
       
  1362     // AddColumnL(0);
       
  1363     // AddColumnL(1);
       
  1364     // AddColumnL(2);
       
  1365     // AddColumnL(3);
       
  1366     // AddColumnL(4);
       
  1367     }
       
  1368 
       
  1369 EXPORT_C TInt CColumnListBoxData::LastColumn() const
       
  1370 //
       
  1371 //    The last column defined
       
  1372 //
       
  1373     {
       
  1374     TInt count=iColumnArray->Count();
       
  1375     if (!count)
       
  1376         return(KErrNotFound);
       
  1377     return(At(count-1).iColumn);
       
  1378     }
       
  1379 
       
  1380 EXPORT_C TInt CColumnListBoxData::ColumnWidthPixel(TInt aColumn) const
       
  1381 //
       
  1382 //    Return the width for a column
       
  1383 //
       
  1384     {
       
  1385     TInt index;
       
  1386     if (!FindColumnIndex(index,aColumn))
       
  1387         return(0);
       
  1388     return(At(index).iWidth);
       
  1389     }
       
  1390 
       
  1391 EXPORT_C void CColumnListBoxData::SetColumnWidthPixelL(TInt aColumn,TInt aWidth)
       
  1392 //
       
  1393 //    Set a columns width
       
  1394 //
       
  1395     {
       
  1396     TInt index;
       
  1397     FindColumnIndexOrAddL(index,aColumn);
       
  1398     At(index).iWidth=aWidth;
       
  1399     if ( iExtension && iExtension->iUseLayoutData )
       
  1400         {
       
  1401         iExtension->iUseLayoutData = EFalse;
       
  1402         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  1403 #ifdef RD_UI_TRANSITION_EFFECTS_LIST 
       
  1404         MAknListBoxTfxInternal* transApi =
       
  1405              CAknListLoader::TfxApiInternal( view->ItemDrawer()->Gc() );
       
  1406         if ( transApi )
       
  1407             {
       
  1408             transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
       
  1409             transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
       
  1410             }
       
  1411 #endif
       
  1412         }
       
  1413     }
       
  1414 
       
  1415 EXPORT_C TInt CColumnListBoxData::ColumnHorizontalGap(TInt aColumn) const
       
  1416 //
       
  1417 //  Return the vertical for a column
       
  1418 //
       
  1419     {
       
  1420     TInt index;
       
  1421     if (!FindColumnIndex(index,aColumn))
       
  1422         return(0);
       
  1423     return(At(index).iVerticalCap);
       
  1424     }
       
  1425 
       
  1426 EXPORT_C void CColumnListBoxData::SetColumnHorizontalGapL(TInt aColumn,TInt aGap)
       
  1427 //
       
  1428 //  Set a columns vertical cap
       
  1429 //
       
  1430     {
       
  1431     TInt index;
       
  1432     FindColumnIndexOrAddL(index,aColumn);
       
  1433     At(index).iVerticalCap=aGap;
       
  1434     }
       
  1435 
       
  1436 
       
  1437 EXPORT_C TInt 
       
  1438 CColumnListBoxData::ColumnTextClipGap(TInt aColumnIndex) const
       
  1439     {
       
  1440     TInt index;
       
  1441     if (!FindColumnIndex(index,aColumnIndex))
       
  1442         return TInt(0);
       
  1443     return(iColumnArray->At(index).iTextClipGap);
       
  1444     }
       
  1445 
       
  1446 EXPORT_C void 
       
  1447 CColumnListBoxData::SetColumnTextClipGapL(TInt aColumnIndex, TInt aGap)
       
  1448     {
       
  1449     TInt index;
       
  1450     FindColumnIndexOrAddL(index,aColumnIndex);
       
  1451     At(index).iTextClipGap=aGap;
       
  1452     }
       
  1453 
       
  1454 EXPORT_C TInt CColumnListBoxData::ColumnBaselinePos(TInt aColumn) const
       
  1455 //
       
  1456 //  Return the vertical for a column
       
  1457 //
       
  1458     {
       
  1459     TInt index;
       
  1460     if (!FindColumnIndex(index,aColumn))
       
  1461         return(0);
       
  1462     return(At(index).iBaseline);
       
  1463     }
       
  1464 
       
  1465 EXPORT_C void CColumnListBoxData::SetColumnBaselinePosL(TInt aColumn,TInt aPos)
       
  1466 //
       
  1467 //  Set a columns baseline position
       
  1468 //
       
  1469     {
       
  1470     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1471     TInt index;
       
  1472     FindColumnIndexOrAddL(index,aColumn);
       
  1473     At(index).iBaseline=aPos;
       
  1474     
       
  1475     // can not be nicely supported by new drawing system
       
  1476     // --> revert to Symbian style drawing
       
  1477     if ( iExtension && iExtension->iUseLayoutData )
       
  1478         {
       
  1479         iExtension->iUseLayoutData = EFalse;
       
  1480 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1481         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  1482         MAknListBoxTfxInternal* transApi =
       
  1483              CAknListLoader::TfxApiInternal( view->ItemDrawer()->Gc() );
       
  1484         if ( transApi )
       
  1485             {
       
  1486             transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
       
  1487             transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
       
  1488             } 
       
  1489 #endif
       
  1490         }
       
  1491     }
       
  1492 
       
  1493 EXPORT_C TMargins CColumnListBoxData::ColumnMargins(TInt aColumn) const
       
  1494 //
       
  1495 //  Return the vertical for a column
       
  1496 //
       
  1497     {
       
  1498     TInt index;
       
  1499     if (!FindColumnIndex(index,aColumn))
       
  1500         {    
       
  1501         TMargins m = {0,0,0,0};
       
  1502         return m;
       
  1503         }
       
  1504     return(At(index).iMargins);
       
  1505     }
       
  1506 
       
  1507 EXPORT_C void CColumnListBoxData::SetColumnMarginsL(TInt aColumn,TMargins aMargins)
       
  1508 //
       
  1509 //  Set a columns vertical cap
       
  1510 //
       
  1511     {
       
  1512     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1513     TInt index;
       
  1514     FindColumnIndexOrAddL(index,aColumn);
       
  1515     At(index).iMargins=aMargins;
       
  1516 
       
  1517     // can not be nicely supported by new drawing system
       
  1518     // --> revert to Symbian style drawing
       
  1519     if ( iExtension && iExtension->iUseLayoutData )
       
  1520         {
       
  1521         iExtension->iUseLayoutData = EFalse;
       
  1522 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1523         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  1524         MAknListBoxTfxInternal* transApi =
       
  1525              CAknListLoader::TfxApiInternal( view->ItemDrawer()->Gc() );
       
  1526         if ( transApi )
       
  1527             {
       
  1528             transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
       
  1529             transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
       
  1530             } 
       
  1531 #endif
       
  1532         }
       
  1533     }
       
  1534 
       
  1535 
       
  1536 EXPORT_C TInt CColumnListBoxData::ColumnX(TInt aColumn) const
       
  1537     {
       
  1538     TInt index;
       
  1539     if (!FindColumnIndex(index,aColumn))
       
  1540         {    
       
  1541         return 0;
       
  1542 
       
  1543         }
       
  1544     return(At(index).iX);
       
  1545     }
       
  1546 
       
  1547 EXPORT_C void CColumnListBoxData::SetColumnXL(TInt aColumn,TInt aX) const
       
  1548     {
       
  1549     TInt index;
       
  1550     MUTABLE_CAST(CColumnListBoxData*,this)->FindColumnIndexOrAddL(index,aColumn);
       
  1551     MUTABLE_CAST(TInt&,At(index).iX)=aX;
       
  1552     }
       
  1553 
       
  1554 
       
  1555 EXPORT_C TInt CColumnListBoxData::ColumnEndX(TInt aColumn) const
       
  1556     {
       
  1557     TInt index;
       
  1558     if (!FindColumnIndex(index,aColumn))
       
  1559         {    
       
  1560         return 0;
       
  1561         }
       
  1562     return(At(index).iEndX);
       
  1563     }
       
  1564 
       
  1565 EXPORT_C void CColumnListBoxData::SetColumnEndXL(TInt aColumn,TInt aEndX) const
       
  1566     {
       
  1567     TInt index;
       
  1568     MUTABLE_CAST(CColumnListBoxData*,this)->FindColumnIndexOrAddL(index,aColumn);
       
  1569     MUTABLE_CAST(TInt&,At(index).iEndX)=aEndX;
       
  1570     }
       
  1571 
       
  1572 EXPORT_C const CFont* CColumnListBoxData::ColumnFont(TInt aColumn) const
       
  1573 //
       
  1574 //    Return the font for a column
       
  1575 //
       
  1576     {
       
  1577     TInt index;
       
  1578     if (!FindColumnIndex(index,aColumn))
       
  1579         return(NULL);
       
  1580     return(iColumnArray->At(index).iBaseFont);
       
  1581     }
       
  1582 
       
  1583 EXPORT_C void CColumnListBoxData::SetColumnFontL(TInt aColumn,const CFont* aFont)
       
  1584 //
       
  1585 //    Set a font for a column
       
  1586 //
       
  1587     {
       
  1588 // This corrects error report KBAA-53GEQ5.
       
  1589 #if NOT_NEEDED_IN_SERIES60
       
  1590     TInt columns=iColumnArray->Count();
       
  1591 #endif
       
  1592     TInt index;
       
  1593     FindColumnIndexOrAddL(index,aColumn);
       
  1594     if (!At(index).iBaseFont)
       
  1595         {
       
  1596 // This corrects error report KBAA-53GEQ5.
       
  1597 #if NOT_NEEDED_IN_SERIES60
       
  1598         TInt actualFontIndex=0;
       
  1599         TRAPD(err, actualFontIndex=AddActualFontL(aFont));
       
  1600         if (err)
       
  1601             {
       
  1602             if (columns!=iColumnArray->Count())
       
  1603                 {
       
  1604                 iColumnArray->Delete(index);
       
  1605                 }
       
  1606             User::Leave(err);
       
  1607             }
       
  1608         At(index).iActualFontIndex=actualFontIndex;
       
  1609 #endif
       
  1610         // TPFIX(moved down) At(index).iBaseFont=aFont;
       
  1611         }
       
  1612     At(index).iBaseFont=aFont;
       
  1613     }
       
  1614 
       
  1615 EXPORT_C CGraphicsContext::TTextAlign CColumnListBoxData::ColumnAlignment(TInt aColumn) const
       
  1616 //
       
  1617 //    Return a columns alignment
       
  1618 //
       
  1619     {
       
  1620     TInt index;
       
  1621     if (!FindColumnIndex(index,aColumn))
       
  1622         return(CGraphicsContext::ELeft);
       
  1623     return(iColumnArray->At(index).iAlign);
       
  1624     }
       
  1625 
       
  1626 EXPORT_C void CColumnListBoxData::SetColumnAlignmentL(TInt aColumn,CGraphicsContext::TTextAlign aAlign)
       
  1627 //
       
  1628 //    Set a columns alignment
       
  1629 //
       
  1630     {
       
  1631     TInt index;
       
  1632     FindColumnIndexOrAddL(index,aColumn);
       
  1633     At(index).iAlign=aAlign;
       
  1634     iExtension->SetColumnLayoutAlignmentL( aColumn);  
       
  1635     }
       
  1636 
       
  1637 
       
  1638 EXPORT_C CGraphicsContext::TPenStyle CColumnListBoxData::ColumnSeparatorStyle(TInt aColumn) const
       
  1639 //
       
  1640 //    Return a columns separator style
       
  1641 //
       
  1642     {
       
  1643     TInt index;
       
  1644     if (!FindColumnIndex(index,aColumn))
       
  1645         return(CGraphicsContext::ENullPen);
       
  1646     return(iColumnArray->At(index).iSeparator);
       
  1647     }
       
  1648 
       
  1649 EXPORT_C void CColumnListBoxData::SetColumnSeparatorStyleL(TInt aColumn,CGraphicsContext::TPenStyle aSeparator)
       
  1650 //
       
  1651 //    Set a columns separator style
       
  1652 //
       
  1653     {
       
  1654     TInt index;
       
  1655     FindColumnIndexOrAddL(index,aColumn);
       
  1656     At(index).iSeparator=aSeparator;
       
  1657     }
       
  1658 
       
  1659 
       
  1660 EXPORT_C TBool CColumnListBoxData::ColumnIsGraphics(TInt aColumn) const
       
  1661 //
       
  1662 //    Return true if the column contains graphics
       
  1663 //
       
  1664     {
       
  1665     TInt index;
       
  1666     if (!FindColumnIndex(index,aColumn))
       
  1667         return(EFalse);
       
  1668     return(iColumnArray->At(index).iGraphics);
       
  1669     }
       
  1670 
       
  1671 EXPORT_C void CColumnListBoxData::SetGraphicsColumnL(TInt aColumn,TBool aIsGraphics)
       
  1672 //
       
  1673 //    Sets whether a column shows graphics
       
  1674 //
       
  1675     {
       
  1676     TInt index;
       
  1677     FindColumnIndexOrAddL(index,aColumn);
       
  1678     At(index).iGraphics=aIsGraphics;
       
  1679     }
       
  1680 
       
  1681 EXPORT_C TBool CColumnListBoxData::ColumnIsNumber(TInt aColumn) const
       
  1682 //
       
  1683 //    Return true if the column contains graphics
       
  1684 //
       
  1685     {
       
  1686     TInt index;
       
  1687     if (!FindColumnIndex(index,aColumn))
       
  1688         return(EFalse);
       
  1689     return(iColumnArray->At(index).iNumberColumn);
       
  1690     }
       
  1691 
       
  1692 EXPORT_C void CColumnListBoxData::SetNumberColumnL(TInt aColumn,TBool aIsNumber)
       
  1693 //
       
  1694 //    Sets whether a column shows graphics
       
  1695 //
       
  1696     {
       
  1697     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1698     TInt index;
       
  1699     FindColumnIndexOrAddL(index,aColumn);
       
  1700     At(index).iNumberColumn=aIsNumber;
       
  1701     }
       
  1702 
       
  1703 
       
  1704 EXPORT_C TBool CColumnListBoxData::ColumnIsOptional(TInt aColumn) const
       
  1705 //
       
  1706 //    Return true if the column contains graphics
       
  1707 //
       
  1708     {
       
  1709     TInt index;
       
  1710     if (!FindColumnIndex(index,aColumn))
       
  1711         return(EFalse);
       
  1712     return(iColumnArray->At(index).iOptional);
       
  1713     }
       
  1714 
       
  1715 EXPORT_C void CColumnListBoxData::SetOptionalColumnL(TInt aColumn,TBool aIsOptional)
       
  1716 //
       
  1717 //    Sets whether a column shows graphics
       
  1718 //
       
  1719     {
       
  1720     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1721     TInt index;
       
  1722     FindColumnIndexOrAddL(index,aColumn);
       
  1723     At(index).iOptional=aIsOptional;
       
  1724     }
       
  1725 
       
  1726 EXPORT_C CArrayPtr<CGulIcon>* CColumnListBoxData::IconArray() const
       
  1727 //
       
  1728 //    Return the list of icons
       
  1729 //
       
  1730     {
       
  1731     if (iExtension)
       
  1732         return iExtension->iIconArray;
       
  1733     else
       
  1734         return 0;
       
  1735     }
       
  1736 
       
  1737 EXPORT_C void CColumnListBoxData::SetIconArray(CArrayPtr<CGulIcon>* aArray)
       
  1738 //
       
  1739 //    Passes ownership of the icon list aArray (assumes any previous list has been deleted by the caller)
       
  1740 //
       
  1741     {
       
  1742     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1743     if (iExtension)
       
  1744         iExtension->iIconArray=aArray;
       
  1745     else
       
  1746         {
       
  1747         aArray->ResetAndDestroy();
       
  1748         delete aArray;
       
  1749         }    
       
  1750     }
       
  1751 
       
  1752 EXPORT_C CFont* CColumnListBoxData::Font(const TListItemProperties& /*aItemProperties*/, TInt aColumn) const
       
  1753     {
       
  1754     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  1755     return const_cast<CFont*>(this->ColumnFont(aColumn));
       
  1756 #if NOT_NEEDED_IN_SERIES60
       
  1757     TInt index;
       
  1758     if (!FindColumnIndex(index,aColumn))
       
  1759         return(NULL);
       
  1760     TInt actualFontIndex=iColumnArray->At(index).iActualFontIndex;
       
  1761     if (actualFontIndex==KNoActualColumnFont)
       
  1762         return(NULL);
       
  1763     if ((aItemProperties.IsBold()) && (aItemProperties.IsItalics()))
       
  1764         {
       
  1765         return iBoldItalicFont.iFonts->At(actualFontIndex);
       
  1766         }
       
  1767     else if (aItemProperties.IsBold())
       
  1768         {
       
  1769         return iBoldFont.iFonts->At(actualFontIndex);
       
  1770         }
       
  1771     else if (aItemProperties.IsItalics())
       
  1772         {
       
  1773         return iItalicFont.iFonts->At(actualFontIndex);
       
  1774         }
       
  1775     else return iNormalFont.iFonts->At(actualFontIndex);
       
  1776 #endif
       
  1777     }
       
  1778 
       
  1779 void CColumnListBoxData::DrawHighLight( CWindowGc& aGc, const TRect& aRect, TBool aHighlight, MAknsSkinInstance* aSkin ) const
       
  1780     {
       
  1781     // SERIES60 Highlight drawing.
       
  1782     if( aHighlight )
       
  1783         {
       
  1784         // same as CFormattedCellListBoxData::DrawDefaultHighlight
       
  1785         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  1786         TBool pressedDown = view->ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState;
       
  1787 
       
  1788 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1789         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &aGc );
       
  1790         if ( transApi )
       
  1791             {
       
  1792             transApi->Invalidate(MAknListBoxTfxInternal::EListHighlight ); // This will remove the old bitmap
       
  1793             transApi->BeginRedraw( MAknListBoxTfxInternal::EListHighlight, aRect );
       
  1794             transApi->StartDrawing( MAknListBoxTfxInternal::EListHighlight );
       
  1795             aGc.SetClippingRect( view->ViewRect() );
       
  1796             }
       
  1797 #endif //RD_UI_TRANSITION_EFFECTS_LIST      
       
  1798         // Try drawing the animated highlight
       
  1799         TBool highlightDrawn = EFalse;
       
  1800         if ( iExtension->iAnimation )
       
  1801             {
       
  1802 #ifdef RD_UI_TRANSITION_EFFECTS_LIST        
       
  1803             if ( transApi && transApi->VerifyKml() == KErrNone )
       
  1804                 {
       
  1805                 iExtension->DeleteAnim();
       
  1806                 }
       
  1807             else
       
  1808                 {
       
  1809 #endif
       
  1810             TAknLayoutRect topLeft;
       
  1811             topLeft.LayoutRect(aRect, SkinLayout::List_highlight_skin_placing__general__Line_2());
       
  1812             
       
  1813             TAknLayoutRect bottomRight;
       
  1814             bottomRight.LayoutRect(aRect, SkinLayout::List_highlight_skin_placing__general__Line_5());
       
  1815             
       
  1816             TRect outerRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
  1817             
       
  1818             aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
  1819             highlightDrawn = iExtension->SyncAndDrawAnim( aGc, outerRect );
       
  1820 #ifdef RD_UI_TRANSITION_EFFECTS_LIST        
       
  1821                 }
       
  1822 #endif
       
  1823             }
       
  1824         
       
  1825         if (!highlightDrawn)
       
  1826             {
       
  1827             // Animated highlight was not available, use normal skinned
       
  1828             // rendering.
       
  1829             MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
       
  1830             if (!cc) cc = SkinBackgroundContext();
       
  1831             if (cc)
       
  1832                 {
       
  1833                 TAknLayoutRect topLeft;
       
  1834                 topLeft.LayoutRect(aRect, SkinLayout::List_highlight_skin_placing__general__Line_2());
       
  1835                 
       
  1836                 TAknLayoutRect bottomRight;
       
  1837                 bottomRight.LayoutRect(aRect, SkinLayout::List_highlight_skin_placing__general__Line_5());
       
  1838                 
       
  1839                 TRect outerRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
  1840                 TRect innerRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
  1841                 aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
  1842 
       
  1843                 
       
  1844                 if ( pressedDown )
       
  1845                     {
       
  1846                     highlightDrawn = iExtension->DrawPressedDownEffectL( aSkin, aGc, outerRect, innerRect );
       
  1847                     //view->ItemDrawer()->ClearFlags( CListItemDrawer::EItemPressedDown );
       
  1848                     }
       
  1849                 else
       
  1850                     {
       
  1851                     highlightDrawn = AknsDrawUtils::DrawFrame( aSkin,
       
  1852                                                            aGc,
       
  1853                                                            outerRect,
       
  1854                                                            innerRect,
       
  1855                                                            *iExtension->iSkinHighlightFrameId,
       
  1856                                                            *iExtension->iSkinHighlightFrameCenterId );
       
  1857                     }
       
  1858                 }
       
  1859             }
       
  1860         
       
  1861         // Both animated highlight and normal highlight drawing have failed.
       
  1862         if (!highlightDrawn)
       
  1863             {
       
  1864             TAknLayoutRect highlightshadow;
       
  1865             TAknLayoutRect highlight;
       
  1866             highlightshadow.LayoutRect(aRect, AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_1(aRect));
       
  1867             highlight.LayoutRect(aRect, AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_2(aRect));
       
  1868             highlightshadow.DrawRect(aGc);
       
  1869             highlight.DrawRect(aGc);
       
  1870         }
       
  1871 #ifdef RD_UI_TRANSITION_EFFECTS_LIST    
       
  1872         if ( transApi )
       
  1873             {
       
  1874             aGc.CancelClippingRect();
       
  1875             transApi->StopDrawing();
       
  1876             transApi->EndRedraw( MAknListBoxTfxInternal::EListHighlight );
       
  1877             }
       
  1878 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  1879         }
       
  1880     }
       
  1881 
       
  1882     
       
  1883 void CColumnListBoxData::BitBltColored( CWindowGc&      aGc,
       
  1884                                         TBool           aHighlight,
       
  1885                                         const CGulIcon* aIcon,
       
  1886                                         TInt            aSubcell,
       
  1887                                         TBool           aColorIcon,
       
  1888                                         const TRect&    aGraphicRect ) const
       
  1889     {
       
  1890     // see also eikfrlbd.cpp ( sigh ).
       
  1891     CFbsBitmap* bitmap( aIcon->Bitmap() );
       
  1892     CFbsBitmap* mask( aIcon->Mask() );
       
  1893 
       
  1894     // possibly colorskinnable icon. Check must be after SetSize()
       
  1895     TBool bw( bitmap->DisplayMode() == EGray2 ); 
       
  1896     
       
  1897     // center graphics
       
  1898     TSize size=bitmap->SizeInPixels();
       
  1899     TInt yDiff = ( aGraphicRect.Height() - size.iHeight ) / 2;
       
  1900     TInt xDiff = ( aGraphicRect.Width()  - size.iWidth )  / 2;
       
  1901     TPoint posInBitmap( 0,0 );
       
  1902 
       
  1903     if (xDiff < 0) // icon's width bigger than subcell's width
       
  1904         {          // possible, if icon is not a aknicon
       
  1905         posInBitmap.iX = -xDiff;
       
  1906         xDiff = 0;
       
  1907         }
       
  1908     
       
  1909     if (yDiff < 0) // icon's height bigger than subcell's height
       
  1910         {
       
  1911         posInBitmap.iY = -yDiff;
       
  1912         yDiff = 0;
       
  1913         }
       
  1914     
       
  1915     TPoint bmpPos( aGraphicRect.iTl + TPoint( xDiff, yDiff ) );
       
  1916     TRect sourcerect( posInBitmap, aGraphicRect.Size() );
       
  1917 
       
  1918     if ( mask )
       
  1919         {
       
  1920         TInt i( 0x01 );
       
  1921         i = i << aSubcell;
       
  1922         if ( ((i & iExtension->iConditionalCells) && bw) || aColorIcon  )
       
  1923             {
       
  1924             aGc.BitBltMasked( bmpPos,
       
  1925                               aHighlight ? iExtension->iHiliBmp : iExtension->iColorBmp,
       
  1926                               TRect(posInBitmap, size), mask, ETrue );
       
  1927             }
       
  1928         else
       
  1929             {
       
  1930             aGc.BitBltMasked( bmpPos, bitmap, sourcerect, mask, ETrue );
       
  1931             }
       
  1932         }
       
  1933     else
       
  1934         {
       
  1935         aGc.BitBlt( bmpPos, bitmap ,sourcerect );
       
  1936         }
       
  1937     }
       
  1938 
       
  1939 void CColumnListBoxData::DrawSimple( const TListItemProperties& aItemProperties,
       
  1940                                      CWindowGc& aGc,
       
  1941                                      const TDesC* aText,
       
  1942                                      const TRect& aRect,
       
  1943                                      TBool aHighlight,
       
  1944                                      const TColors& aColors ) const
       
  1945     {
       
  1946     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );    
       
  1947 
       
  1948     TInt lastColumn = Min( LastColumn(), KMaxColumn );
       
  1949     TInt column=0;
       
  1950     TPtrC text;
       
  1951     TPtrC tempText;
       
  1952 
       
  1953     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
       
  1954 
       
  1955     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
       
  1956     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
       
  1957     if (!cc)
       
  1958         {
       
  1959         cc = SkinBackgroundContext();
       
  1960         }
       
  1961 
       
  1962     TAknTextLineLayout textLines[KMaxColumn];
       
  1963     TBool rectClipped[KMaxColumn];
       
  1964     
       
  1965     Mem::FillZ( &rectClipped[0], KMaxColumn * sizeof( TBool ) );
       
  1966     
       
  1967     if ( iExtension->iSubCellsMightIntersect )
       
  1968         {
       
  1969         CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aRect );
       
  1970         }
       
  1971 
       
  1972     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
       
  1973 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1974     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
       
  1975 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  1976 
       
  1977     if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
       
  1978         {
       
  1979 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1980         if ( transApi )
       
  1981             {
       
  1982             transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
       
  1983             }
       
  1984 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  1985 
       
  1986         aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1987         aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
  1988 
       
  1989         if ( listbox )
       
  1990             {
       
  1991             AknsDrawUtils::Background( skin, cc, listbox, aGc, aRect );
       
  1992             }
       
  1993         else
       
  1994             {
       
  1995             aGc.Clear(aRect);
       
  1996             }
       
  1997 
       
  1998 #ifdef RD_UI_TRANSITION_EFFECTS_LIST   
       
  1999         if ( transApi )
       
  2000             {
       
  2001             transApi->StopDrawing();
       
  2002             }
       
  2003 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2004         }
       
  2005 
       
  2006     DrawHighLight( aGc, aRect, aHighlight, skin );
       
  2007     
       
  2008     // The column draw loop
       
  2009     column = 0;
       
  2010     TInt subCellIndex = 0;
       
  2011 
       
  2012     if ( !iExtension ) { return; }
       
  2013     
       
  2014 #ifdef RD_UI_TRANSITION_EFFECTS_LIST   
       
  2015     if ( transApi )
       
  2016         {
       
  2017         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
       
  2018         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  2019         aGc.SetClippingRect( view->ViewRect() );
       
  2020         }
       
  2021 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2022     
       
  2023     for( column = 0; column <= lastColumn; column++ )
       
  2024         {
       
  2025         TextUtils::ColumnText( text, column, aText );
       
  2026         if ( text == KNullDesC ) { continue; }
       
  2027 
       
  2028         if ( iExtension->FindSLSubCellIndex( subCellIndex, column )!=0 ) { continue; }
       
  2029         
       
  2030         CGraphicsContext::TTextAlign align=ColumnAlignment(column);
       
  2031         TBool isLayoutAlignment = iExtension->ColumnLayoutAlignment(column);
       
  2032         
       
  2033         if ( iExtension->AtSL(subCellIndex).iSubCellType == CColumnListBoxDataExtension::EEikSLText )
       
  2034             {
       
  2035             aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
  2036             
       
  2037             TRgb textColor( aTextColor );
       
  2038             
       
  2039             if (aHighlight)
       
  2040                 {
       
  2041                 textColor = aColors.iHighlightedText;
       
  2042                 aGc.SetBrushColor(aColors.iHighlightedBack);    
       
  2043                 }
       
  2044             if (AknsUtils::AvkonSkinEnabled())
       
  2045                 {
       
  2046                 if (iExtension->iTextColor != NULL)
       
  2047                     {
       
  2048                     textColor = iExtension->iTextColor;
       
  2049                     }
       
  2050                 
       
  2051                 if (aHighlight && iExtension->iHighlightedTextColor != NULL)
       
  2052                     {
       
  2053                     textColor = iExtension->iHighlightedTextColor;
       
  2054                     }
       
  2055                 }
       
  2056                 
       
  2057             const CFont* rowAndColFont=RowAndColumnFont(iExtension->iCurrentRow,column);
       
  2058             const CFont* colFont=Font(aItemProperties, column);
       
  2059             const CFont* tempFont=(colFont) ? colFont : NULL;
       
  2060             const CFont* usedFont=(rowAndColFont) ? rowAndColFont : tempFont;
       
  2061             
       
  2062             TAknTextLineLayout textLineLayout = NULL;
       
  2063 
       
  2064             if ( rectClipped[column] )
       
  2065                 {
       
  2066                 textLineLayout = textLines[column];
       
  2067                 }
       
  2068             else
       
  2069                 {
       
  2070                 // check if there are icons affecting this text layout
       
  2071                 TInt gSC = iExtension->AtSL(subCellIndex).iConditionValue; // graphical subcell which might affect this text subcell
       
  2072                 
       
  2073                 if (gSC > -1)
       
  2074                     {
       
  2075                     TInt tempIndex;
       
  2076                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
       
  2077                         {
       
  2078                         if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
       
  2079                         TextUtils::ColumnText(tempText,gSC, aText);
       
  2080                         if (tempText != KNullDesC)
       
  2081                             {
       
  2082                             textLineLayout = iExtension->AtSL(tempIndex).iTextLayout;
       
  2083                             break;                      
       
  2084                             }
       
  2085                         gSC = iExtension->AtSL(tempIndex).iConditionValue;
       
  2086                         }
       
  2087                     }
       
  2088                     
       
  2089                 if (gSC == -1) // no affecting icons -> use default layout
       
  2090                     {
       
  2091                     textLineLayout = iExtension->AtSL(subCellIndex).iTextLayout;
       
  2092                     }
       
  2093                 }
       
  2094             
       
  2095   
       
  2096             if( !isLayoutAlignment )
       
  2097                 { 
       
  2098                 switch(align) 
       
  2099                     {
       
  2100                     case CGraphicsContext::ELeft : 
       
  2101                         {
       
  2102                         textLineLayout.iJ = ELayoutAlignLeft;    
       
  2103                         }
       
  2104                         break; 
       
  2105                     case CGraphicsContext::ECenter: 
       
  2106                         {
       
  2107                         textLineLayout.iJ = ELayoutAlignCenter;
       
  2108                         }
       
  2109                         break; 
       
  2110                     case CGraphicsContext::ERight:  
       
  2111                         {
       
  2112                         textLineLayout.iJ = ELayoutAlignRight;
       
  2113                         }
       
  2114                         break; 
       
  2115                     default:  break;
       
  2116                     };
       
  2117                 }
       
  2118             
       
  2119             TAknLayoutText textLayout;
       
  2120             textLayout.LayoutText( aRect, textLineLayout, usedFont );
       
  2121             // *2 == leave some room for marquee
       
  2122             const TInt maxlen( KMaxColumnDataLength * 2 ); 
       
  2123             TBuf<maxlen> convBuf = text.Left(maxlen);
       
  2124 
       
  2125             // Note that this potentially modifies the text so its lenght in pixels
       
  2126             // might increase. Therefore, this should always be done before
       
  2127             // wrapping/clipping text. In some cases, WordWrapListItem is called
       
  2128             // before coming here. Is it certain that it is not done for number subcells?
       
  2129 
       
  2130             // Do number conversion if required.
       
  2131             if ( ColumnIsNumber( column ) )
       
  2132                 {
       
  2133                 AknTextUtils::LanguageSpecificNumberConversion( convBuf );
       
  2134                 }
       
  2135 
       
  2136             // Check whether logical to visual conversion should be done here or not.
       
  2137             TBool bidiConv = ETrue;  // TODO
       
  2138 
       
  2139 //             if (ColumnIsNumber(column))
       
  2140 //                 {
       
  2141 //                 AknTextUtils::LanguageSpecificNumberConversion( convBuf );
       
  2142 //                }
       
  2143 
       
  2144             // marquee & clipping detection
       
  2145             TBool doesNotFit( aHighlight &&
       
  2146                               textLayout.Font()->TextWidthInPixels( convBuf ) > textLayout.TextRect().Width() );
       
  2147 
       
  2148             // iClippedColumns was cleared in ::Draw() so no need to
       
  2149             // clear anything here
       
  2150             if ( doesNotFit )
       
  2151                 {
       
  2152                 iExtension->iClippedColumns |= ( 1 << column );
       
  2153                 }
       
  2154 
       
  2155             TBool marqueeDisabled(EFalse);
       
  2156             if (listbox != NULL && 
       
  2157                 listbox->View() != NULL && 
       
  2158                 listbox->View()->ItemDrawer() != NULL)
       
  2159                 {
       
  2160                 marqueeDisabled = listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
       
  2161                 }
       
  2162             
       
  2163             if ( iExtension->IsMarqueeOn() && doesNotFit && !marqueeDisabled )
       
  2164                 {
       
  2165                 iExtension->iMarquee->UseLogicalToVisualConversion( bidiConv );
       
  2166                 
       
  2167                 if ( iExtension->iMarquee->DrawText( aGc, aRect, textLineLayout, convBuf, usedFont, textColor ) )
       
  2168                     {
       
  2169                     // all the loops have been executed
       
  2170                     textLayout.DrawText( aGc, convBuf, bidiConv, textColor );
       
  2171                     }
       
  2172                 }
       
  2173             else
       
  2174                 {
       
  2175                 if ( iExtension->iMarquee && marqueeDisabled )
       
  2176                     {
       
  2177                     iExtension->iMarquee->Stop();
       
  2178                     }
       
  2179 
       
  2180                 textLayout.DrawText( aGc, convBuf, bidiConv, textColor );
       
  2181                 }
       
  2182             
       
  2183             
       
  2184             if ( iExtension->iPictoInterface )
       
  2185                 {                
       
  2186                 TRect  pictoRect = textLayout.TextRect();
       
  2187                 pictoRect.Normalize();
       
  2188                 if ( convBuf.Length() && bidiConv )
       
  2189                     {                      
       
  2190                     TInt maxWidth = pictoRect.Size().iWidth; 
       
  2191                     TInt charsCanBeDisplayed = textLayout.Font()->TextCount( 
       
  2192                                                 convBuf, maxWidth );  
       
  2193                     if ( charsCanBeDisplayed < convBuf.Length() )
       
  2194                         {
       
  2195                         TInt clipCharWidth = textLayout.Font()->CharWidthInPixels( 
       
  2196                                                 KEllipsis /*aClipChar*/ ); 
       
  2197                          // Check how many characters fit in given space with truncation char. 
       
  2198                          charsCanBeDisplayed = textLayout.Font()->TextCount( 
       
  2199                          convBuf, maxWidth - clipCharWidth );
       
  2200 
       
  2201                         // This is "avkon rule": should not insert ellipsis right after a space.
       
  2202                         if ( charsCanBeDisplayed > 1 && 
       
  2203                              convBuf[charsCanBeDisplayed - 1] == ' ' &&
       
  2204                              convBuf[charsCanBeDisplayed - 2] != ' ' )
       
  2205                             {
       
  2206                             charsCanBeDisplayed--;
       
  2207                             }
       
  2208 
       
  2209                         TInt pictoRectWidth = textLayout.Font()->TextWidthInPixels( 
       
  2210                         convBuf.Left( charsCanBeDisplayed ) );
       
  2211                         pictoRect.SetWidth( pictoRectWidth );
       
  2212                         } 
       
  2213                     } 
       
  2214 
       
  2215                
       
  2216                 iExtension->iPictoInterface->Interface()->DrawPictographsInText(
       
  2217                     aGc, *usedFont, convBuf,
       
  2218                     pictoRect,
       
  2219                     usedFont->AscentInPixels(),
       
  2220                     textLayout.Align(), 0 );
       
  2221                 }
       
  2222 
       
  2223             aGc.SetUnderlineStyle(EUnderlineOff); // disable underline after first text.
       
  2224             }
       
  2225         else if ( iExtension->AtSL(subCellIndex).iSubCellType == CColumnListBoxDataExtension::EEikSLGraphic ) 
       
  2226             {
       
  2227             TLex lex(text);
       
  2228             TInt index;
       
  2229             __ASSERT_ALWAYS(lex.Val(index)==KErrNone,Panic(EEikPanicColumnListInvalidBitmapIndex));
       
  2230 
       
  2231             TBool colorIcon( EFalse );
       
  2232             if ( index == KColorIconFlag )
       
  2233                 {
       
  2234                 if ( iExtension->iColorBmp && iExtension->iHiliBmp )
       
  2235                     {
       
  2236                     colorIcon = ETrue;
       
  2237                     }
       
  2238                 index = KColorIconIdx;
       
  2239                 }
       
  2240 
       
  2241             if ( !IconArray() )
       
  2242                 {
       
  2243                 continue;
       
  2244                 }
       
  2245 
       
  2246             if (aHighlight && (index > 0xffff))
       
  2247                 {
       
  2248                 index = index >> 16; // we have different icon for highlight
       
  2249                 }
       
  2250 
       
  2251              index = index & 0xffff; // mask off possible highlight icon
       
  2252             __ASSERT_DEBUG((index>=0 && index<IconArray()->Count()),Panic(EEikPanicColumnListInvalidBitmapIndex));
       
  2253             
       
  2254             TAknWindowLineLayout graphicLayout = iExtension->AtSL(subCellIndex).iGraphicLayout;
       
  2255             TAknLayoutRect graphicRect; 
       
  2256             
       
  2257             graphicRect.LayoutRect(aRect,graphicLayout);
       
  2258             TSize graphicSize( graphicRect.Rect().Size() );
       
  2259             
       
  2260             if (index>=0 && IconArray())
       
  2261                 {
       
  2262                 CGulIcon* icon=(*IconArray())[index];
       
  2263                 CFbsBitmap* bitmap=icon->Bitmap();
       
  2264                 // Sometimes we get fake bitmap...
       
  2265                 if ( bitmap )
       
  2266                     {
       
  2267                     TSize size( bitmap->SizeInPixels() );
       
  2268                     
       
  2269                     if (size.iWidth != graphicSize.iWidth &&
       
  2270                         size.iHeight != graphicSize.iHeight )
       
  2271                         {
       
  2272                         AknIconUtils::SetSize( bitmap,
       
  2273                                                graphicSize,
       
  2274                                                EAspectRatioPreservedAndUnusedSpaceRemoved );
       
  2275                         }
       
  2276 
       
  2277                     BitBltColored( aGc, aHighlight, icon, column, colorIcon, graphicRect.Rect() );
       
  2278                     }
       
  2279                 }
       
  2280             aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
  2281             }
       
  2282         }
       
  2283 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  2284     if ( transApi )
       
  2285         {
       
  2286         aGc.CancelClippingRect();
       
  2287         transApi->StopDrawing();
       
  2288         }
       
  2289 #endif //RD_UI_TRANSITION_EFFECTS_LIST
       
  2290     }
       
  2291 
       
  2292 EXPORT_C
       
  2293 void CColumnListBoxData::Draw( const TListItemProperties& aItemProperties,
       
  2294                                CWindowGc& aGc,
       
  2295                                const TDesC* aText,
       
  2296                                const TRect& aRect,
       
  2297                                TBool aHighlight,
       
  2298                                const TColors& aColors ) const
       
  2299     {
       
  2300     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ ); 
       
  2301 
       
  2302     if ( aHighlight )
       
  2303         {
       
  2304         iExtension->iClippedColumns = 0;
       
  2305         }
       
  2306 
       
  2307     if ( UsesScalableLayoutData() )
       
  2308         {
       
  2309         DrawSimple( aItemProperties, aGc, aText, aRect, aHighlight, aColors );
       
  2310         return;
       
  2311         }
       
  2312     
       
  2313     const CFont* font=ColumnFont(0);
       
  2314     CEikonEnv* eikonEnv=CEikonEnv::Static();
       
  2315     if (font==NULL)
       
  2316         {
       
  2317         font=eikonEnv->NormalFont();
       
  2318         }
       
  2319 
       
  2320     TInt lastColumn=LastColumn();
       
  2321     if (lastColumn==KErrNotFound)
       
  2322         {
       
  2323         if ( font )
       
  2324             {
       
  2325             // use draw text so that dont need to change pen color/style
       
  2326             aGc.UseFont( font );
       
  2327             aGc.DrawText(TPtrC(),aRect,0);
       
  2328             aGc.DiscardFont();
       
  2329             }
       
  2330         return;
       
  2331         }
       
  2332 
       
  2333     TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels());
       
  2334     TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels();
       
  2335     TRect textRect( aRect );
       
  2336     TRect textMRect; // textrect with margins.
       
  2337     textRect.iBr.iX=aRect.iTl.iX;
       
  2338     TInt column=0;
       
  2339     TPtrC text;
       
  2340 
       
  2341     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
       
  2342 
       
  2343     // Turned the drawing to multipass algorithm, because optionalcolumns drawing will
       
  2344     // be too difficult to do without - and this is cleaner solution.
       
  2345     
       
  2346     // pass 1, figures out x-coordinates for columns.
       
  2347     TInt x = aRect.iTl.iX;
       
  2348     TBool mirror = AknLayoutUtils::LayoutMirrored();
       
  2349     if (mirror)
       
  2350         {
       
  2351         x = aRect.iBr.iX;
       
  2352         }
       
  2353     TInt maxx = x;
       
  2354     while(column <= lastColumn)
       
  2355         {
       
  2356         // order of instructions is important here, do not change.
       
  2357         if (!ColumnIsOptional(column)) 
       
  2358             {
       
  2359             TRAP_IGNORE(SetColumnXL(column,maxx));
       
  2360 
       
  2361             if (!mirror)
       
  2362                 x = maxx + ColumnWidthPixel(column);
       
  2363             else
       
  2364                 x = maxx - ColumnWidthPixel(column);
       
  2365 
       
  2366             maxx = x;
       
  2367             }
       
  2368         else
       
  2369             {
       
  2370             if (!mirror)
       
  2371                 x -= ColumnWidthPixel(column);
       
  2372             else
       
  2373                 x += ColumnWidthPixel(column);
       
  2374 
       
  2375             TRAP_IGNORE(SetColumnXL(column,x));
       
  2376             }
       
  2377         column++;
       
  2378         }
       
  2379 
       
  2380     // pass 2, figures out the end x coordinates
       
  2381     column = 0;
       
  2382     TInt endx;
       
  2383     TInt tmpcolumn;
       
  2384     while(column <= lastColumn)
       
  2385         {
       
  2386         if (!mirror)
       
  2387             endx = ColumnX(column) + ColumnWidthPixel(column);
       
  2388         else
       
  2389             endx = ColumnX(column) - ColumnWidthPixel(column);
       
  2390         
       
  2391         if (!ColumnIsOptional(column)) 
       
  2392             {
       
  2393             tmpcolumn = column+1;
       
  2394             while(ColumnIsOptional(tmpcolumn))
       
  2395                 {
       
  2396                 TextUtils::ColumnText(text,tmpcolumn,aText);
       
  2397                 if (text!=KNullDesC) endx = ColumnX(tmpcolumn);
       
  2398                 tmpcolumn++;
       
  2399                 }
       
  2400             }
       
  2401         if (!mirror) 
       
  2402             {
       
  2403             __ASSERT_ALWAYS(ColumnX(column)<endx,Panic(EEikPanicColumnListLayoutError));
       
  2404             }
       
  2405         else
       
  2406             {
       
  2407             __ASSERT_ALWAYS(ColumnX(column)>endx,Panic(EEikPanicColumnListLayoutError));
       
  2408             }
       
  2409         TRAP_IGNORE(SetColumnEndXL(column,endx));
       
  2410         
       
  2411         column++;
       
  2412         }
       
  2413 
       
  2414     // pass 3 drawing
       
  2415 
       
  2416     // SERIES60 Background drawing.
       
  2417     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
       
  2418     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
       
  2419     if (!cc)
       
  2420         {
       
  2421         cc = SkinBackgroundContext();
       
  2422         }
       
  2423 
       
  2424     // aRect is list item's rect, width of which is smaller than width of the list
       
  2425     // with a scroll bar. List needs to draw under scroll bar anyway, so we need to
       
  2426     // modify given rect here.
       
  2427     TRect r(aRect);
       
  2428     
       
  2429     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
       
  2430 
       
  2431 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  2432 
       
  2433     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
       
  2434 
       
  2435 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2436 
       
  2437     if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
       
  2438         {
       
  2439 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  2440         if ( transApi )
       
  2441             {
       
  2442             transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
       
  2443             }
       
  2444 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2445 
       
  2446         aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  2447         aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
  2448 
       
  2449         if ( listbox )
       
  2450             {
       
  2451             AknsDrawUtils::Background( skin, cc, listbox, aGc, aRect );
       
  2452             }
       
  2453         else
       
  2454             {
       
  2455             aGc.Clear(aRect);
       
  2456             }
       
  2457 
       
  2458 #ifdef RD_UI_TRANSITION_EFFECTS_LIST   
       
  2459         if ( transApi )
       
  2460             {
       
  2461             transApi->StopDrawing();
       
  2462             }
       
  2463 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2464         }
       
  2465     
       
  2466  // LISTBOX LINES NEED TO BE DRAWN HERE.
       
  2467     DrawHighLight( aGc, aRect, aHighlight, skin );
       
  2468 
       
  2469 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  2470     if ( transApi )
       
  2471         {
       
  2472         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
       
  2473         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  2474         aGc.SetClippingRect( view->ViewRect() );
       
  2475         }
       
  2476 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  2477 
       
  2478     // The column draw loop
       
  2479     column = 0;
       
  2480     FOREVER
       
  2481         {
       
  2482         if (column > lastColumn) break;
       
  2483 
       
  2484         if (!mirror)
       
  2485             {
       
  2486             textRect.iTl.iX = ColumnX(column);
       
  2487             textRect.iBr.iX = ColumnEndX(column);
       
  2488             }
       
  2489         else
       
  2490             {
       
  2491             textRect.iBr.iX = ColumnX(column);
       
  2492             textRect.iTl.iX = ColumnEndX(column);
       
  2493             }
       
  2494 
       
  2495         TextUtils::ColumnText(text,column,aText);
       
  2496 
       
  2497         TBool exit_condition = textRect.iBr.iX==textRect.iTl.iX;
       
  2498         if (ColumnIsOptional(column) && text == KNullDesC)
       
  2499             {
       
  2500             exit_condition = ETrue;
       
  2501             }
       
  2502 
       
  2503         if (!exit_condition)
       
  2504             {
       
  2505             // Margins support.
       
  2506             TMargins m = ColumnMargins(column);
       
  2507             textMRect.SetRect(textRect.iTl+TSize(m.iLeft,m.iTop),textRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
       
  2508             // end of margins support.
       
  2509             
       
  2510             CGraphicsContext::TTextAlign align=ColumnAlignment(column);
       
  2511 
       
  2512             if (!ColumnIsGraphics(column))
       
  2513                 {
       
  2514 
       
  2515                 //if (align == CGraphicsContext::ECenter || align == CGraphicsContext::ERight)
       
  2516                 //    {
       
  2517                 //    textMRect.iTl.iX+=1;
       
  2518                 //    textMRect.iBr.iX+=1;
       
  2519                 //    }
       
  2520                 aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
  2521                 aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
  2522                 aGc.SetPenColor(aTextColor);
       
  2523                 SetUnderlineStyle( aItemProperties, aGc, column );
       
  2524 
       
  2525                 if (aHighlight)
       
  2526                     {
       
  2527                     aGc.SetPenColor(aColors.iHighlightedText);
       
  2528                     aGc.SetBrushColor(aColors.iHighlightedBack);    
       
  2529                     }
       
  2530 
       
  2531                 if (AknsUtils::AvkonSkinEnabled() && iExtension)
       
  2532                     {
       
  2533                     if (iExtension->iTextColor != NULL)
       
  2534                         {
       
  2535                         aGc.SetPenColor(iExtension->iTextColor);
       
  2536                         }
       
  2537 
       
  2538                     if (aHighlight && iExtension->iHighlightedTextColor != NULL)
       
  2539                         {
       
  2540                         aGc.SetPenColor(iExtension->iHighlightedTextColor);
       
  2541                         }
       
  2542                     }
       
  2543 
       
  2544                 const CFont* rowAndColFont=RowAndColumnFont(iExtension->iCurrentRow,column);
       
  2545                 const CFont* colFont=Font(aItemProperties, column);
       
  2546                 const CFont* tempFont=(colFont) ? colFont : font;
       
  2547                 const CFont* usedFont=(rowAndColFont) ? rowAndColFont : tempFont;
       
  2548 
       
  2549                 aGc.UseFont(usedFont);
       
  2550 
       
  2551                 // baseline calc needed for each column because of margins.
       
  2552                 baseLineOffset = ColumnBaselinePos(column);
       
  2553                 if (!baseLineOffset)
       
  2554                     {
       
  2555                     baseLineOffset = (textMRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels();
       
  2556                     }
       
  2557                 baseLineOffset -= m.iTop;
       
  2558 
       
  2559                 // SERIES60 LAF
       
  2560                 TBuf<200+KAknBidiExtraSpacePerLine> clipbuf;
       
  2561                 
       
  2562                 TInt clipgap = ColumnTextClipGap(column);
       
  2563                                    
       
  2564                 TBool clipped = AknBidiTextUtils::ConvertToVisualAndClip(
       
  2565                     text.Left(200), 
       
  2566                     clipbuf,
       
  2567                     *usedFont,
       
  2568                     textMRect.Size().iWidth, 
       
  2569                     textMRect.Size().iWidth+clipgap);
       
  2570 
       
  2571                 if (clipped)
       
  2572                     {
       
  2573                     if (!mirror)
       
  2574                         {
       
  2575                         textMRect.iBr.iX+=clipgap;
       
  2576                         }
       
  2577                     else
       
  2578                         {
       
  2579                         textMRect.iTl.iX-=clipgap;
       
  2580                         }
       
  2581                     
       
  2582                     if ( aHighlight )
       
  2583                         {
       
  2584                         iExtension->iClippedColumns |= ( 1 << column );
       
  2585                         }
       
  2586                     }
       
  2587 
       
  2588                 if (ColumnIsNumber(column))
       
  2589                     {
       
  2590                     AknTextUtils::LanguageSpecificNumberConversion(clipbuf);
       
  2591                     }
       
  2592 
       
  2593                 // end of SERIES60 LAF
       
  2594 
       
  2595                 CAknMarqueeControl* marquee =
       
  2596                     column == 1 || column == 3 ? iExtension->iMarquee :
       
  2597                                                  iExtension->i2ndLineMarquee;
       
  2598                                                  
       
  2599                 TBool marqueeDisabled =
       
  2600                     listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
       
  2601 
       
  2602                 if ( iExtension->IsMarqueeOn() && aHighlight && clipped && !marqueeDisabled )
       
  2603                     {
       
  2604                     // Bidi conversion has already been done.
       
  2605                     marquee->UseLogicalToVisualConversion( EFalse );
       
  2606                     
       
  2607                     if ( marquee->DrawText( aGc, textMRect, text, baseLineOffset, align, *usedFont ) )
       
  2608                         {
       
  2609                         // All the loops have been executed -> the text needs to be truncated.
       
  2610                         aGc.DrawText( clipbuf, textMRect, baseLineOffset, align, 0 );
       
  2611                         }
       
  2612                     }
       
  2613                 else
       
  2614                     {
       
  2615                     if ( marquee && marqueeDisabled )
       
  2616                         {
       
  2617                         marquee->Stop();
       
  2618                         }
       
  2619 
       
  2620                     aGc.DrawText( clipbuf, textMRect, baseLineOffset, align, 0 );
       
  2621                     }
       
  2622 
       
  2623                 if ( iExtension->iPictoInterface )
       
  2624                     {
       
  2625                     iExtension->iPictoInterface->Interface()->DrawPictographsInText(
       
  2626                         aGc, *usedFont, clipbuf, textMRect, baseLineOffset, align, 0 );
       
  2627                     }
       
  2628 
       
  2629                 aGc.SetUnderlineStyle(EUnderlineOff); // disable underline after first text.
       
  2630                 }
       
  2631             else
       
  2632                 {
       
  2633                 aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
  2634                 if (aHighlight  /*&&  (LastColumn()==0) */ )
       
  2635                     {
       
  2636                     aGc.SetBrushColor(aColors.iHighlightedBack);
       
  2637                     }
       
  2638 
       
  2639                 TLex lex(text);
       
  2640                 TInt index;
       
  2641                 TInt err = lex.Val(index);
       
  2642                 __ASSERT_DEBUG(err==KErrNone,Panic(EEikPanicColumnListInvalidBitmapIndex));
       
  2643                 
       
  2644                 if ( index == KColorIconFlag )
       
  2645                     {
       
  2646                     index = KColorIconIdx;
       
  2647                     }
       
  2648 
       
  2649                 if ( !err )
       
  2650                     {
       
  2651                     if ( !IconArray() )
       
  2652                         {
       
  2653                         ++column;
       
  2654                         continue;
       
  2655                         }
       
  2656 
       
  2657                     __ASSERT_DEBUG((index>=0 && index<IconArray()->Count()),Panic(EEikPanicColumnListInvalidBitmapIndex));
       
  2658                     TRect bmpRect;
       
  2659                     bmpRect.iTl=textMRect.iTl;
       
  2660                     if (index>=0 && IconArray())
       
  2661                         {
       
  2662                         CGulIcon* icon=(*IconArray())[index];
       
  2663                         
       
  2664                         if ( iExtension
       
  2665                              && iExtension->iSubCellIconSize[column] != TSize(0,0) )
       
  2666                             {
       
  2667                             TSize wanted( iExtension->iSubCellIconSize[column] );
       
  2668                             TSize got( icon->Bitmap()->SizeInPixels() );
       
  2669                             
       
  2670                             // correct w or h is enough
       
  2671                             if ( wanted.iWidth != got.iWidth
       
  2672                                  && wanted.iHeight != got.iHeight )
       
  2673                                 {
       
  2674                                 AknIconUtils::SetSize( icon->Bitmap(),
       
  2675                                                        wanted,
       
  2676                                                        EAspectRatioPreservedAndUnusedSpaceRemoved );
       
  2677                                 }
       
  2678                             }
       
  2679 
       
  2680                         CFbsBitmap* bitmap=icon->Bitmap();
       
  2681                         
       
  2682                         TSize size(bitmap->SizeInPixels());
       
  2683                         
       
  2684                         // next two lines are SERIES60 additions
       
  2685                         if (size.iWidth>textMRect.Size().iWidth) size.iWidth = textMRect.Size().iWidth;
       
  2686                         if (size.iHeight>textMRect.Size().iHeight) size.iHeight = textMRect.Size().iHeight;
       
  2687                         
       
  2688                         TPoint bmpPos(textMRect.iTl); // was aRect, I dunno why
       
  2689                         bmpPos.iY+=(textMRect.Height()-size.iHeight)>>1; // was aRect too...
       
  2690                         switch (align)
       
  2691                             {
       
  2692                             case ELeft:
       
  2693                                 break;
       
  2694                             case ECenter:
       
  2695                                 bmpPos.iX+=(textMRect.Width()-size.iWidth)>>1;
       
  2696                                 break;
       
  2697                             case ERight:
       
  2698                                 bmpPos.iX=textMRect.iBr.iX-size.iWidth;
       
  2699                                 break;
       
  2700                             }
       
  2701                         bmpRect.SetRect(bmpPos,size);
       
  2702                         TPoint posInBitmap;
       
  2703                         posInBitmap += bitmap->SizeInPixels() - textMRect.Size();
       
  2704                         posInBitmap.iX >>= 1;
       
  2705                         posInBitmap.iY >>= 1;
       
  2706                         if (posInBitmap.iX < 0) posInBitmap.iX = 0;
       
  2707                         if (posInBitmap.iY < 0) posInBitmap.iY = 0;
       
  2708                         TRect rect(posInBitmap,textMRect.Size());
       
  2709 
       
  2710                         
       
  2711                         if (icon->Mask())
       
  2712                             {
       
  2713                             aGc.BitBltMasked( bmpPos, bitmap, rect, icon->Mask(), ETrue );
       
  2714                             }
       
  2715                         else
       
  2716                             {
       
  2717                             aGc.BitBlt(bmpPos, bitmap,rect);
       
  2718                             }
       
  2719                         }
       
  2720                     aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  2721                     aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
  2722                     }
       
  2723                 }
       
  2724             }
       
  2725         
       
  2726         ++column;
       
  2727         }
       
  2728     
       
  2729 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  2730     if ( transApi )
       
  2731         {
       
  2732         aGc.CancelClippingRect();
       
  2733         transApi->StopDrawing();
       
  2734         }
       
  2735 #endif //RD_UI_TRANSITION_EFFECTS_LIST
       
  2736     }
       
  2737 
       
  2738 
       
  2739 void CColumnListBoxData::AddColumnL(TInt aColumn)
       
  2740 //
       
  2741 //    Add a column's worth of data
       
  2742 //
       
  2743     {
       
  2744     SColumn column;
       
  2745     column.iColumn=aColumn;
       
  2746     column.iWidth=0;
       
  2747     TMargins m = {0,0,0,0};
       
  2748     column.iMargins=m;
       
  2749     column.iBaseFont=NULL;
       
  2750     column.iActualFontIndex=KNoActualColumnFont;
       
  2751     column.iGraphics=EFalse;
       
  2752     column.iNumberColumn = EFalse;
       
  2753     column.iOptional=EFalse;
       
  2754     column.iBaseline = 0;
       
  2755     column.iAlign=CGraphicsContext::ELeft;
       
  2756     column.iSeparator=CGraphicsContext::ENullPen;
       
  2757     column.iTextClipGap = 0;
       
  2758     TKeyArrayFix key(0,ECmpTInt);
       
  2759     iColumnArray->InsertIsqL(column,key);
       
  2760     }
       
  2761 
       
  2762 CColumnListBoxData::SColumn& CColumnListBoxData::At(TInt aArrayIndex)
       
  2763 //
       
  2764 //    Return a column of data
       
  2765 //
       
  2766     {
       
  2767     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iColumnArray->Count(),Panic(EEikPanicOutOfRange));
       
  2768     return(iColumnArray->At(aArrayIndex));
       
  2769     }
       
  2770 
       
  2771 const CColumnListBoxData::SColumn& CColumnListBoxData::At(TInt aArrayIndex) const
       
  2772 //
       
  2773 //    Return a column of data
       
  2774 //
       
  2775     {
       
  2776     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iColumnArray->Count(),Panic(EEikPanicOutOfRange));
       
  2777     return(iColumnArray->At(aArrayIndex));
       
  2778     }
       
  2779 
       
  2780 TBool CColumnListBoxData::FindColumnIndex(TInt& aArrayIndex,TInt aColumn) const
       
  2781 //
       
  2782 //    Find a column if it has been set
       
  2783 //
       
  2784     {
       
  2785     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ ); 
       
  2786     if (aColumn<0 || iColumnArray->Count()==0)
       
  2787         return EFalse;
       
  2788     TKeyArrayFix key(0,ECmpTInt);
       
  2789     SColumn column;
       
  2790     column.iColumn=aColumn;
       
  2791 
       
  2792     // Returns zero if key was found, otherwise non-zero
       
  2793     TInt ret = iColumnArray->FindIsq(column,key,aArrayIndex);
       
  2794     return (ret ? EFalse: ETrue);
       
  2795     }
       
  2796 
       
  2797 void CColumnListBoxData::FindColumnIndexOrAddL(TInt& aArrayIndex,TInt aColumn)
       
  2798 //
       
  2799 //    Find a column or add it
       
  2800 //
       
  2801     {
       
  2802     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2803     if (!FindColumnIndex(aArrayIndex,aColumn))
       
  2804         {
       
  2805         AddColumnL(aColumn);
       
  2806         FindColumnIndex(aArrayIndex,aColumn);
       
  2807         }
       
  2808     }
       
  2809 
       
  2810 TInt CColumnListBoxData::AddActualFontL(const CFont* aBaseFont)
       
  2811     {
       
  2812     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2813     if (!iNormalFont.iFonts)
       
  2814         {
       
  2815         iNormalFont.iFonts=new (ELeave) CArrayPtrFlat<CFont> (1);
       
  2816         iBoldFont.iFonts=new (ELeave) CArrayPtrFlat<CFont> (1);
       
  2817         iItalicFont.iFonts=new (ELeave) CArrayPtrFlat<CFont> (1);
       
  2818         iBoldItalicFont.iFonts=new (ELeave) CArrayPtrFlat<CFont> (1);
       
  2819         }
       
  2820 
       
  2821     // Reserves extra space for each font array.
       
  2822     TInt fontCount=iNormalFont.iFonts->Count()+1;
       
  2823     iNormalFont.iFonts->SetReserveL(fontCount);
       
  2824     iBoldFont.iFonts->SetReserveL(fontCount);
       
  2825     iItalicFont.iFonts->SetReserveL(fontCount);
       
  2826     iBoldItalicFont.iFonts->SetReserveL(fontCount);
       
  2827 
       
  2828     // Add Fonts.
       
  2829     TFontStyle style=aBaseFont->FontSpecInTwips().iFontStyle;
       
  2830     ConstructFontL(aBaseFont, style, iNormalFont);
       
  2831     ConstructFontL(aBaseFont, style, iBoldFont);
       
  2832     ConstructFontL(aBaseFont, style, iItalicFont);
       
  2833     ConstructFontL(aBaseFont, style, iBoldItalicFont);
       
  2834 
       
  2835     return fontCount-1;
       
  2836     }
       
  2837 
       
  2838 EXPORT_C TBool CColumnListBoxData::MakeColumnRect( TInt aColumn, TRect& aRect )
       
  2839     // Returns given column rect
       
  2840     {
       
  2841     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2842     TInt lastColumn = LastColumn();
       
  2843     if ( ( aColumn < 0 ) || ( aColumn > lastColumn ) ) return EFalse;
       
  2844 
       
  2845     TRect colRect(aRect);  // we need to save original item rect
       
  2846     for ( TInt column=0; column<lastColumn; column++ )
       
  2847         // loop throuhg columns except last one (scroll bar eats small rect from it)
       
  2848         {
       
  2849         TInt colWidth = ColumnWidthPixel( column );
       
  2850         colRect.iBr.iX = colRect.iTl.iX + colWidth;     // set column rect width
       
  2851         if ( column == aColumn ) break;              // if the column, quit
       
  2852         aRect.iTl.iX += colWidth;               // shrink origial rect by column with
       
  2853         colRect = aRect;                            // set colRect for the LAST column
       
  2854         }
       
  2855     aRect = colRect;
       
  2856 
       
  2857     return ETrue;
       
  2858     }
       
  2859 
       
  2860 EXPORT_C void CColumnListBoxData::SetColumnFontForRowL(TInt aRow,
       
  2861                                                        TInt aColumn,
       
  2862                                                        const CFont* aFont)
       
  2863     {
       
  2864     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2865     if (!iExtension) return;
       
  2866     TInt index = 0;
       
  2867     iExtension->FindRowAndColumnIndexOrAddL(index,aRow,aColumn);
       
  2868     iExtension->At(index).iFont=aFont;
       
  2869     }
       
  2870 
       
  2871 EXPORT_C const CFont* 
       
  2872 CColumnListBoxData::RowAndColumnFont(TInt aRow,TInt aColumn) const
       
  2873     {
       
  2874     if (!iExtension) return 0;
       
  2875     TInt index = 0;
       
  2876     if (iExtension->FindRowAndColumnIndex(index,aRow,aColumn)!=0)
       
  2877         return 0;
       
  2878     return(iExtension->At(index).iFont);
       
  2879     }
       
  2880 
       
  2881 void CColumnListBoxData::SetCurrentItemIndex(TInt aIndex)
       
  2882     {
       
  2883     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2884     if( iExtension->iCurrentRow != aIndex )
       
  2885         {
       
  2886         iExtension->iAnimFlags.Set( CColumnListBoxDataExtension::EFlagUpdateBg );
       
  2887         }
       
  2888     iExtension->iCurrentRow = aIndex;
       
  2889     }
       
  2890 
       
  2891 
       
  2892 // ---------------------------------------------------------------------------
       
  2893 // Wraps the text drawing functinality with & without marquee into one
       
  2894 // function, so that inherited classes can modify their own drawing
       
  2895 // behaviour more easily.
       
  2896 // ---------------------------------------------------------------------------
       
  2897 //
       
  2898 EXPORT_C void CColumnListBoxData::DrawText(
       
  2899     CWindowGc& aGc,
       
  2900     const TRect& aTextRect,
       
  2901     const TDesC& aText,
       
  2902     const TDesC& aClippedText,
       
  2903     const TInt aBaselineOffset,
       
  2904     const CGraphicsContext::TTextAlign aAlign,
       
  2905     const CFont& aFont,
       
  2906     const TBool aHighlight,
       
  2907     const TBool aIsTextClipped ) const
       
  2908     {
       
  2909     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2910     TBool marqueeDisabled =
       
  2911         static_cast<CEikListBox*>(
       
  2912             Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
       
  2913 
       
  2914     if ( iExtension->IsMarqueeOn() && aHighlight && aIsTextClipped && !marqueeDisabled )
       
  2915         {
       
  2916         if ( iExtension->iMarquee->DrawText( aGc, aTextRect, aText, aBaselineOffset, aAlign, aFont ) )
       
  2917             {
       
  2918             // All the loops have been executed -> the text needs to be truncated.
       
  2919             aGc.DrawText( aClippedText, aTextRect, aBaselineOffset, aAlign, 0 );    
       
  2920             }
       
  2921         }
       
  2922     else
       
  2923         {
       
  2924         if ( iExtension->iMarquee && marqueeDisabled )
       
  2925             {
       
  2926             iExtension->iMarquee->Stop();
       
  2927             }
       
  2928 
       
  2929         aGc.DrawText( aClippedText, aTextRect, aBaselineOffset, aAlign, 0 );
       
  2930         }                           
       
  2931     }
       
  2932 
       
  2933 
       
  2934 EXPORT_C void CColumnListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, const TInt aScrollDelay)
       
  2935     {
       
  2936     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2937     if ( iExtension->iMarquee )
       
  2938         {
       
  2939         iExtension->iMarquee->SetLoops( aLoops );
       
  2940         iExtension->iMarquee->SetSpeedInPixels( aScrollAmount );
       
  2941         iExtension->iMarquee->SetDelay( aScrollDelay );
       
  2942         }
       
  2943     if ( iExtension->i2ndLineMarquee )
       
  2944         {
       
  2945         iExtension->i2ndLineMarquee->SetLoops( aLoops );
       
  2946         iExtension->i2ndLineMarquee->SetSpeedInPixels( aScrollAmount );
       
  2947         iExtension->i2ndLineMarquee->SetDelay( aScrollDelay );
       
  2948         }
       
  2949     }
       
  2950     
       
  2951 EXPORT_C void CColumnListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, 
       
  2952                                                    const TInt aScrollDelay, const TInt aInterval)
       
  2953     {
       
  2954     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2955     if ( iExtension->iMarquee )
       
  2956         {
       
  2957         iExtension->iMarquee->SetInterval( aInterval );
       
  2958         iExtension->i2ndLineMarquee->SetInterval( aInterval );
       
  2959         SetMarqueeParams( aLoops, aScrollAmount, aScrollDelay );
       
  2960         }
       
  2961     }    
       
  2962 
       
  2963 
       
  2964 EXPORT_C
       
  2965 void CColumnListBoxData::SetSubCellIconSize(TInt aIndex, TSize aSize)
       
  2966     {
       
  2967     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  2968     if (iExtension && aIndex < 6 && aIndex >= 0)
       
  2969         {
       
  2970         iExtension->iSubCellIconSize[aIndex] = aSize;
       
  2971         }
       
  2972     }
       
  2973 
       
  2974 TSize CColumnListBoxData::GetSubCellIconSize(TInt aIndex)
       
  2975     {
       
  2976     if (iExtension && aIndex < 6 && aIndex >= 0)
       
  2977         {
       
  2978         return iExtension->iSubCellIconSize[aIndex];
       
  2979         }
       
  2980     return TSize(0,0);
       
  2981     }
       
  2982 
       
  2983 // -----------------------------------------------------------------------------
       
  2984 // CColumnListBoxData::HighlightAnim
       
  2985 // -----------------------------------------------------------------------------
       
  2986 //
       
  2987 EXPORT_C const CAknsEffectAnim* CColumnListBoxData::HighlightAnim() const
       
  2988     {
       
  2989     if( iExtension )
       
  2990         return iExtension->iAnimation;
       
  2991     return NULL;
       
  2992     }
       
  2993 
       
  2994 // -----------------------------------------------------------------------------
       
  2995 // AboutToDrawHighlightAnim
       
  2996 // -----------------------------------------------------------------------------
       
  2997 //
       
  2998 EXPORT_C void CColumnListBoxData::AboutToDrawHighlightAnim() const
       
  2999     {
       
  3000     if( !iExtension )
       
  3001         {
       
  3002         return;
       
  3003         }
       
  3004     if( !iExtension->iAnimation || !iExtension->iControl )
       
  3005         {
       
  3006         return;
       
  3007         }
       
  3008 
       
  3009     CEikListBox* list = static_cast<CEikListBox*>( iExtension->iControl );
       
  3010     CListBoxView* view = list->View();
       
  3011     if( !view )
       
  3012         {
       
  3013         return;
       
  3014         }
       
  3015 
       
  3016     if( view->CurrentItemIndex() != iExtension->iCurrentRow )
       
  3017         {
       
  3018         iExtension->iAnimFlags.Set( CColumnListBoxDataExtension::EFlagUpdateBg );
       
  3019         iExtension->iCurrentRow = view->CurrentItemIndex();
       
  3020         }
       
  3021 
       
  3022     iExtension->SyncAnim( iExtension->iAnimSize );
       
  3023     }
       
  3024 
       
  3025 // -----------------------------------------------------------------------------
       
  3026 // CColumnListBoxData::SetHighlightAnimBackgroundDrawer
       
  3027 // -----------------------------------------------------------------------------
       
  3028 //
       
  3029 EXPORT_C void CColumnListBoxData::SetHighlightAnimBackgroundDrawer(
       
  3030     MColumnListBoxAnimBackgroundDrawer* aDrawer )
       
  3031     {
       
  3032     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3033     if( iExtension )
       
  3034         {
       
  3035         iExtension->iHighlightBgDrawer = aDrawer;
       
  3036         }
       
  3037     }
       
  3038 
       
  3039 // -----------------------------------------------------------------------------
       
  3040 // CColumnListBoxData::SetItemCellSize
       
  3041 // -----------------------------------------------------------------------------
       
  3042 //
       
  3043 EXPORT_C void CColumnListBoxData::SetItemCellSize( const TSize& aSizeInPixels )
       
  3044     {
       
  3045     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3046     if( iExtension )
       
  3047         {
       
  3048         if( iExtension->iAnimSize != aSizeInPixels )
       
  3049             {
       
  3050             iExtension->Play();
       
  3051             }
       
  3052         iExtension->iAnimSize = aSizeInPixels;
       
  3053         }
       
  3054     }
       
  3055 
       
  3056 // -----------------------------------------------------------------------------
       
  3057 // CColumnListBoxData::HasHighlightAnim
       
  3058 // -----------------------------------------------------------------------------
       
  3059 //
       
  3060 EXPORT_C TBool CColumnListBoxData::HasHighlightAnim() const
       
  3061     {
       
  3062     if( !iExtension )
       
  3063         return EFalse;
       
  3064     if( !iExtension->iAnimation )
       
  3065         return EFalse;
       
  3066     return ETrue;
       
  3067     }
       
  3068 
       
  3069 // -----------------------------------------------------------------------------
       
  3070 // CColumnListBoxData::DrawHighlightAnim
       
  3071 // -----------------------------------------------------------------------------
       
  3072 //
       
  3073 EXPORT_C TBool CColumnListBoxData::DrawHighlightAnim(
       
  3074         CBitmapContext& aGc, const TRect& aRect ) const
       
  3075     {
       
  3076     if( !iExtension )
       
  3077         return EFalse;
       
  3078 
       
  3079     if( !iExtension->iAnimation )
       
  3080         return EFalse;
       
  3081 
       
  3082     return iExtension->SyncAndDrawAnim( aGc, aRect );
       
  3083     }
       
  3084 
       
  3085 // -----------------------------------------------------------------------------
       
  3086 // CColumnListBoxData::FocusGained
       
  3087 // -----------------------------------------------------------------------------
       
  3088 //
       
  3089 void CColumnListBoxData::FocusGained()
       
  3090     {
       
  3091     iExtension->FocusGained();
       
  3092     }
       
  3093 
       
  3094 // -----------------------------------------------------------------------------
       
  3095 // CColumnListBoxData::FocusLost
       
  3096 // -----------------------------------------------------------------------------
       
  3097 //
       
  3098 void CColumnListBoxData::FocusLost()
       
  3099     {
       
  3100     iExtension->FocusLost();
       
  3101     }
       
  3102 
       
  3103 void CColumnListBoxData::HandleResourceChange( TInt aType )
       
  3104     {
       
  3105     _AKNTRACE( "[%s][%s] aType = %d", "CColumnListBoxData", __FUNCTION__, aType  );
       
  3106     // Animation is skin dependent, whenever skin changes animation changes
       
  3107     // too.
       
  3108     if( KAknsMessageSkinChange == aType )
       
  3109         {
       
  3110         iExtension->SkinChanged();
       
  3111         }
       
  3112     else if(aType == KEikDynamicLayoutVariantSwitch)
       
  3113         {
       
  3114         // What is under highlight may have changed -> we need to update
       
  3115         // highlight background to animation.
       
  3116         iExtension->iAnimFlags.Set( CColumnListBoxDataExtension::EFlagUpdateBg );
       
  3117         }
       
  3118     else if( ( aType == KEikMessageUnfadeWindows ) ||
       
  3119              ( aType == KEikMessageFadeAllWindows ) )
       
  3120         {
       
  3121         if( iExtension->iMarquee )
       
  3122             {
       
  3123             iExtension->iMarquee->HandleResourceChange( aType );
       
  3124             }
       
  3125         if( iExtension->i2ndLineMarquee )
       
  3126             {
       
  3127             iExtension->i2ndLineMarquee->HandleResourceChange( aType );
       
  3128             }
       
  3129         }
       
  3130     }
       
  3131 
       
  3132 void CColumnListBoxData::SetupSkinContextL()
       
  3133     {
       
  3134     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3135     __ASSERT_DEBUG( iExtension, Panic( EEikPanicNullPointer ));
       
  3136 
       
  3137     TRect mainPane;
       
  3138     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
  3139     
       
  3140     TRect mainPaneRect( mainPane.Size() );
       
  3141     
       
  3142     if ( !iExtension->iSkinControlContext )
       
  3143         {
       
  3144         iExtension->iSkinControlContext = CAknsListBoxBackgroundControlContext::NewL(
       
  3145             KAknsIIDQsnBgAreaMainListGene,
       
  3146             mainPaneRect,
       
  3147             EFalse,
       
  3148             KAknsIIDQsnBgColumnA,
       
  3149             mainPaneRect );
       
  3150 
       
  3151         iExtension->iSkinHighlightFrameId = &KAknsIIDQsnFrList;
       
  3152         iExtension->iSkinHighlightFrameCenterId = &KAknsIIDQsnFrListCenter;
       
  3153         }
       
  3154     else
       
  3155         {
       
  3156         iExtension->iSkinControlContext->SetRect( mainPaneRect );
       
  3157         }
       
  3158     }
       
  3159 
       
  3160 void CColumnListBoxData::SetESSTextColor(TRgb aTextColor)
       
  3161     {
       
  3162     if (iExtension)
       
  3163         iExtension->iTextColor = aTextColor;
       
  3164     }
       
  3165 
       
  3166 void CColumnListBoxData::SetESSHighlightedTextColor(TRgb aHighlightedTextColor)
       
  3167     {
       
  3168     if (iExtension)
       
  3169         iExtension->iHighlightedTextColor = aHighlightedTextColor;
       
  3170     }
       
  3171 
       
  3172 EXPORT_C void CColumnListBoxData::SetColumnUnderlined( TBitFlags32 aUnderlinedColumns )
       
  3173     {
       
  3174     if ( iExtension )
       
  3175         {
       
  3176         iExtension->iUnderlineFlagSet = ETrue;
       
  3177         iExtension->iUnderlineFlags   = aUnderlinedColumns;
       
  3178         }
       
  3179     }
       
  3180 
       
  3181 void CColumnListBoxData::SetUnderlineStyle( TListItemProperties aProperties,
       
  3182                                             CWindowGc& aGc,
       
  3183                                             TInt aColumn ) const
       
  3184     {
       
  3185     if ( !iExtension )
       
  3186         {
       
  3187         return;
       
  3188         }
       
  3189 
       
  3190     if ( !iExtension->iUnderlineFlagSet )
       
  3191         {
       
  3192         // underlining is already either on or off and
       
  3193         // hardcoded off turning will ensure old style
       
  3194         // behaviour
       
  3195         return;
       
  3196         }
       
  3197     
       
  3198     if ( aProperties.IsUnderlined()
       
  3199          && iExtension->iUnderlineFlagSet
       
  3200          && iExtension->iUnderlineFlags.IsSet( aColumn ) )
       
  3201         {
       
  3202         aGc.SetUnderlineStyle( EUnderlineOn );
       
  3203         }
       
  3204     else
       
  3205         {
       
  3206         aGc.SetUnderlineStyle( EUnderlineOff );
       
  3207         }
       
  3208     }
       
  3209 
       
  3210 // -----------------------------------------------------------------------------
       
  3211 // CColumnListBoxData::ResetSLSubCellArray
       
  3212 // -----------------------------------------------------------------------------
       
  3213 //
       
  3214 EXPORT_C void CColumnListBoxData::ResetSLSubCellArray()
       
  3215     {
       
  3216     if ( !iExtension )
       
  3217         {
       
  3218         return;
       
  3219         }
       
  3220 
       
  3221     iExtension->iMarginRect = TRect::EUninitialized;
       
  3222     if ( iExtension && iExtension->iUseLayoutData )
       
  3223         {
       
  3224         iExtension->iUseLayoutData = EFalse;
       
  3225 #ifdef RD_UI_TRANSITION_EFFECTS_LIST 
       
  3226         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
       
  3227         MAknListBoxTfxInternal* transApi =
       
  3228              CAknListLoader::TfxApiInternal( view->ItemDrawer()->Gc() );
       
  3229         if ( transApi )
       
  3230             {
       
  3231             transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
       
  3232             transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
       
  3233             } 
       
  3234 #endif
       
  3235         }
       
  3236     iExtension->ResetSLSubCellArray();
       
  3237     // This function gets called always when size changes, so here is called
       
  3238     // SetupSkinContextL to update the layout rect of the background skin 
       
  3239     // context (mainpane rect can change for example if toolbar is hidden.
       
  3240     TRAP_IGNORE( SetupSkinContextL() );
       
  3241     }
       
  3242 
       
  3243 // -----------------------------------------------------------------------------
       
  3244 // CColumnListBoxData::SetGraphicSubCellL
       
  3245 // -----------------------------------------------------------------------------
       
  3246 //
       
  3247 EXPORT_C void CColumnListBoxData::SetGraphicSubCellL(TInt aSubCell,
       
  3248                                                    const TAknWindowLineLayout &aGraphicLayout)       
       
  3249     {
       
  3250     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3251     if (!iExtension) return;
       
  3252     TInt index = 0;
       
  3253     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
       
  3254     iExtension->AtSL(index).iTextLayout=NULL;
       
  3255     iExtension->AtSL(index).iGraphicLayout=aGraphicLayout;
       
  3256     iExtension->AtSL(index).iSubCellType=CColumnListBoxDataExtension::EEikSLGraphic;
       
  3257     
       
  3258     // needed for compatibility
       
  3259     CEikColumnListBox* list = static_cast<CEikColumnListBox*>( iExtension->iControl );
       
  3260     TAknLayoutRect layoutRect;
       
  3261     layoutRect.LayoutRect( list->View()->ItemDrawer()->ItemCellSize(), aGraphicLayout );
       
  3262     TRect rect( layoutRect.Rect() );
       
  3263     
       
  3264     SetSubCellIconSize( aSubCell, rect.Size() );
       
  3265     SetColumnWidthPixelL( aSubCell, rect.Width() );
       
  3266     SetGraphicsColumnL( aSubCell, ETrue );
       
  3267     SetColumnXL( aSubCell, rect.iTl.iX );
       
  3268     SetColumnEndXL( aSubCell, rect.iBr.iX );
       
  3269     iExtension->iUseLayoutData=ETrue; // might go to own method...
       
  3270     if ( iExtension->iMarginRect == TRect::EUninitialized )
       
  3271         {
       
  3272         iExtension->iMarginRect = rect;
       
  3273         }
       
  3274     else
       
  3275         {
       
  3276         iExtension->iMarginRect.BoundingRect( rect );
       
  3277         }
       
  3278 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3279     MAknListBoxTfxInternal* transApi =
       
  3280         CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
       
  3281     if ( transApi )
       
  3282         {
       
  3283         transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, iExtension->iMarginRect.iTl );
       
  3284         TSize size = list->View()->ItemDrawer()->ItemCellSize();
       
  3285         TPoint br( size.AsPoint() - iExtension->iMarginRect.iBr );
       
  3286         transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin,
       
  3287             br );
       
  3288         }
       
  3289 #endif
       
  3290     }
       
  3291 
       
  3292 // -----------------------------------------------------------------------------
       
  3293 // CColumnListBoxData::SetTextSubCellL
       
  3294 // -----------------------------------------------------------------------------
       
  3295 //
       
  3296 EXPORT_C void CColumnListBoxData::SetTextSubCellL(TInt aSubCell,
       
  3297                                                 const TAknTextLineLayout &aTextLayout)
       
  3298     {
       
  3299     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3300     if (!iExtension) return;
       
  3301     TInt index = 0;
       
  3302     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
       
  3303     iExtension->AtSL(index).iTextLayout=aTextLayout;
       
  3304     iExtension->AtSL(index).iGraphicLayout=NULL;
       
  3305     iExtension->AtSL(index).iSubCellType=CColumnListBoxDataExtension::EEikSLText;
       
  3306     
       
  3307     // needed for compatibility
       
  3308     CEikColumnListBox* list = static_cast<CEikColumnListBox*>( iExtension->iControl );
       
  3309     TAknLayoutText textLayout;
       
  3310     textLayout.LayoutText( list->View()->ItemDrawer()->ItemCellSize(), aTextLayout );
       
  3311     TRect rect( textLayout.TextRect() );
       
  3312     
       
  3313     SetColumnWidthPixelL( aSubCell, rect.Width() );
       
  3314     SetColumnFontL( aSubCell, textLayout.Font() );
       
  3315     SetColumnXL( aSubCell, rect.iTl.iX );
       
  3316     SetColumnEndXL( aSubCell, rect.iBr.iX );
       
  3317     SetColumnBaselinePosL( aSubCell, aTextLayout.iB );
       
  3318     iExtension->iUseLayoutData=ETrue; // might go to own method...
       
  3319     if ( iExtension->iMarginRect == TRect::EUninitialized )
       
  3320         {
       
  3321         iExtension->iMarginRect = rect;
       
  3322         }
       
  3323     else
       
  3324         {
       
  3325         iExtension->iMarginRect.BoundingRect( rect );
       
  3326         }
       
  3327 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3328     MAknListBoxTfxInternal* transApi =
       
  3329         CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
       
  3330     if ( transApi )
       
  3331         {
       
  3332         transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, iExtension->iMarginRect.iTl );
       
  3333         TSize size = list->View()->ItemDrawer()->ItemCellSize();
       
  3334         TPoint br( size.AsPoint() - iExtension->iMarginRect.iBr );
       
  3335         transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin,
       
  3336             br );
       
  3337         }
       
  3338 #endif
       
  3339     }
       
  3340 
       
  3341 // -----------------------------------------------------------------------------
       
  3342 // CColumnListBoxData::SetConditionalSubCellL
       
  3343 // -----------------------------------------------------------------------------
       
  3344 //
       
  3345 EXPORT_C void CColumnListBoxData::SetConditionalSubCellL(TInt aSubCell,
       
  3346                                                          const TAknTextLineLayout &aTextLayout,
       
  3347                                                          TInt aAffectedSubCell)  
       
  3348     {
       
  3349     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3350     // iConditionValue of affected subcell (=text subcell, which has different layouts)
       
  3351     // contains index of graphical subcell, which existence should be checked first.
       
  3352     // This graphical subcell has in iConditionValue index of graphical subcell,
       
  3353     // which existence should be checked second etc. Each graphical subcell can
       
  3354     // affect only to 1 text subcell (or none).
       
  3355 
       
  3356     // for compabitility - needed at least for text wrapping
       
  3357     SetOptionalColumnL( aSubCell, ETrue );
       
  3358     if (!iExtension) return;
       
  3359 
       
  3360     TInt i = 0x01;
       
  3361     i = i << aSubCell;
       
  3362     iExtension->iConditionalCells = iExtension->iConditionalCells | i;
       
  3363 
       
  3364     TInt graphicalIndex = 0;
       
  3365     if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found
       
  3366     // conditional layoutline can be only added to graphical subcells
       
  3367     if (iExtension->AtSL(graphicalIndex).iSubCellType!=CColumnListBoxDataExtension::EEikSLGraphic) return;
       
  3368     
       
  3369     TInt textIndex = 0; // index of affected subcell
       
  3370     if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found
       
  3371     // affected subcell can only be text subcell
       
  3372     if (iExtension->AtSL(textIndex).iSubCellType==CColumnListBoxDataExtension::EEikSLGraphic) return;
       
  3373     
       
  3374     TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain
       
  3375 
       
  3376     while (gSC > -1)
       
  3377         {
       
  3378         if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found
       
  3379         gSC = iExtension->AtSL(textIndex).iConditionValue;
       
  3380         }
       
  3381     iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain
       
  3382     iExtension->AtSL(graphicalIndex).iTextLayout=aTextLayout;
       
  3383     iExtension->CreateColorBitmapsL();
       
  3384 
       
  3385     CEikColumnListBox* list = static_cast<CEikColumnListBox*>( iExtension->iControl );
       
  3386     TAknLayoutText textLayout;
       
  3387     textLayout.LayoutText( list->View()->ItemDrawer()->ItemCellSize(), aTextLayout );
       
  3388 
       
  3389     if ( iExtension->iMarginRect == TRect::EUninitialized )
       
  3390         {
       
  3391         iExtension->iMarginRect = textLayout.TextRect();
       
  3392         }
       
  3393     else
       
  3394         {
       
  3395         iExtension->iMarginRect.BoundingRect( textLayout.TextRect() );
       
  3396         }
       
  3397 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3398     MAknListBoxTfxInternal* transApi =
       
  3399         CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
       
  3400     if ( transApi )
       
  3401         {
       
  3402         transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, iExtension->iMarginRect.iTl );
       
  3403         TSize size = list->View()->ItemDrawer()->ItemCellSize();
       
  3404         TPoint br( size.AsPoint() - iExtension->iMarginRect.iBr );
       
  3405         transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin,
       
  3406             br );
       
  3407         }
       
  3408 #endif
       
  3409     }
       
  3410 
       
  3411 // -----------------------------------------------------------------------------
       
  3412 // CColumnListBoxData::SetStretchableGraphicSubCellL
       
  3413 // -----------------------------------------------------------------------------
       
  3414 //
       
  3415 EXPORT_C void CColumnListBoxData::SetStretchableGraphicSubCellL(
       
  3416     TInt aSubCell, 
       
  3417     const TAknWindowComponentLayout& aNormalLayout, 
       
  3418     const TAknWindowComponentLayout& aStretchedLayout )
       
  3419     {
       
  3420     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3421     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3422          Layout_Meta_Data::IsListStretchingEnabled() &&
       
  3423          StretchingEnabled() )
       
  3424         {
       
  3425         SetGraphicSubCellL( aSubCell, aStretchedLayout.LayoutLine() );
       
  3426         }
       
  3427     else
       
  3428         {
       
  3429         SetGraphicSubCellL( aSubCell, aNormalLayout.LayoutLine() );
       
  3430         }
       
  3431     }
       
  3432     
       
  3433 // -----------------------------------------------------------------------------
       
  3434 // CColumnListBoxData::SetStretchableTextSubCellL
       
  3435 // -----------------------------------------------------------------------------
       
  3436 //
       
  3437 EXPORT_C void CColumnListBoxData::SetStretchableTextSubCellL(
       
  3438     TInt aSubCell, 
       
  3439     const TAknTextComponentLayout& aNormalLayout, 
       
  3440     const TAknTextComponentLayout& aStretchedLayout )
       
  3441     {
       
  3442     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3443     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3444          Layout_Meta_Data::IsListStretchingEnabled() &&
       
  3445          StretchingEnabled() )
       
  3446         {
       
  3447         SetTextSubCellL( aSubCell, aStretchedLayout.LayoutLine() );
       
  3448         }
       
  3449     else
       
  3450         {
       
  3451         SetTextSubCellL( aSubCell, aNormalLayout.LayoutLine() );
       
  3452         }
       
  3453     }
       
  3454     
       
  3455 // -----------------------------------------------------------------------------
       
  3456 // CColumnListBoxData::SetStretchableConditionalSubCellL
       
  3457 // -----------------------------------------------------------------------------
       
  3458 //
       
  3459 EXPORT_C void CColumnListBoxData::SetStretchableConditionalSubCellL(
       
  3460     TInt aSubCell,
       
  3461     const TAknTextComponentLayout& aNormalLayout,
       
  3462     const TAknTextComponentLayout& aStretchedLayout,
       
  3463     TInt aNormalSubCell,
       
  3464     TInt aStretchedSubCell )
       
  3465     {
       
  3466     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3467     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3468          Layout_Meta_Data::IsListStretchingEnabled() &&
       
  3469          StretchingEnabled() )
       
  3470         {
       
  3471         SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell );
       
  3472         }
       
  3473     else
       
  3474         {
       
  3475         SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell );
       
  3476         }
       
  3477     }
       
  3478 
       
  3479 // -----------------------------------------------------------------------------
       
  3480 // CColumnListBoxData::UsesScalableLayoutData
       
  3481 // -----------------------------------------------------------------------------
       
  3482 //
       
  3483 TBool CColumnListBoxData::UsesScalableLayoutData() const
       
  3484     {
       
  3485     if (iExtension)
       
  3486         return iExtension->iUseLayoutData;
       
  3487 
       
  3488     return EFalse;
       
  3489     }
       
  3490 
       
  3491 // -----------------------------------------------------------------------------
       
  3492 // CColumnListBoxData::EnableStretching
       
  3493 // -----------------------------------------------------------------------------
       
  3494 //
       
  3495 void CColumnListBoxData::EnableStretching( const TBool aEnabled )
       
  3496     {
       
  3497     if ( !iExtension )
       
  3498         {
       
  3499         return;
       
  3500         }
       
  3501         
       
  3502     iExtension->iStretchingEnabled = aEnabled;        
       
  3503     }
       
  3504 
       
  3505 #ifdef RD_LIST_STRETCH
       
  3506 // -----------------------------------------------------------------------------
       
  3507 // CColumnListBoxData::StretchingEnabled
       
  3508 // -----------------------------------------------------------------------------
       
  3509 //
       
  3510 EXPORT_C TBool CColumnListBoxData::StretchingEnabled() const
       
  3511     {
       
  3512     if ( !iExtension )
       
  3513         {
       
  3514         return EFalse;
       
  3515         }
       
  3516         
       
  3517     return iExtension->iStretchingEnabled;        
       
  3518     }
       
  3519 
       
  3520 #else
       
  3521 // -----------------------------------------------------------------------------
       
  3522 // CColumnListBoxData::StretchingEnabled
       
  3523 // -----------------------------------------------------------------------------
       
  3524 //
       
  3525 EXPORT_C TBool CColumnListBoxData::StretchingEnabled() const
       
  3526     {
       
  3527     return EFalse;
       
  3528     }
       
  3529 
       
  3530 #endif // RD_LIST_STRETCH
       
  3531 
       
  3532 // -----------------------------------------------------------------------------
       
  3533 // CColumnListBoxData::CheckIfSubCellsIntersect
       
  3534 // -----------------------------------------------------------------------------
       
  3535 //
       
  3536 void CColumnListBoxData::CheckIfSubCellsIntersect( 
       
  3537     TAknTextLineLayout* aLayouts, 
       
  3538     TBool* aResults, 
       
  3539     const TDesC& aText, 
       
  3540     const TRect& aItemRect ) const
       
  3541     {
       
  3542     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxData", __FUNCTION__, __LINE__ );
       
  3543 
       
  3544     TInt column = 0;
       
  3545     TInt column2;
       
  3546     TInt subCellIndex;
       
  3547     TInt subCellIndex2;
       
  3548     TInt lastColumn = Min( LastColumn(), KMaxColumn );
       
  3549     TPtrC text;
       
  3550     TBool isEmpty[KMaxColumn];
       
  3551 
       
  3552     // cache the empty text states
       
  3553     while ( ETrue )
       
  3554         {
       
  3555         if ( column > lastColumn )
       
  3556             {
       
  3557             break;
       
  3558             }
       
  3559 
       
  3560         TextUtils::ColumnText( text, column, &aText );
       
  3561 
       
  3562         if ( text == KNullDesC || ColumnIsOptional( column ) )
       
  3563             {
       
  3564             isEmpty[column] = ETrue;
       
  3565             }
       
  3566         else
       
  3567             {
       
  3568             isEmpty[column] = EFalse;
       
  3569             }
       
  3570 
       
  3571         ++column;
       
  3572         }
       
  3573 
       
  3574     column = 0;
       
  3575 
       
  3576     while ( ETrue )
       
  3577         {
       
  3578         if ( column > lastColumn )
       
  3579             {
       
  3580             break;
       
  3581             }
       
  3582 
       
  3583         if ( iExtension->FindSLSubCellIndex( subCellIndex, column ) != 0 ) 
       
  3584             {
       
  3585             break;
       
  3586             }
       
  3587         
       
  3588         if ( isEmpty[column] )
       
  3589             {
       
  3590             ++column;
       
  3591             continue;
       
  3592             }
       
  3593         
       
  3594         TRect bRect( ColumnX( column ), 0, ColumnEndX( column ), 10 );
       
  3595         
       
  3596         for ( column2 = column + 1; column2 <= lastColumn; column2++ )
       
  3597             {
       
  3598             if ( isEmpty[column2] )
       
  3599                 {
       
  3600                 continue;
       
  3601                 }
       
  3602 
       
  3603             if ( iExtension->FindSLSubCellIndex( subCellIndex2, column2 ) != 0 ) 
       
  3604                 {
       
  3605                 break;
       
  3606                 }
       
  3607 
       
  3608             TRect bRect2( ColumnX( column2 ), 0, ColumnEndX( column2 ), 10 );
       
  3609 
       
  3610             if ( bRect.Intersects( bRect2 ) ) 
       
  3611                 {
       
  3612                 aResults[column] = ETrue;
       
  3613 
       
  3614                 if ( !AknLayoutUtils::LayoutMirrored() )
       
  3615                     {
       
  3616                     bRect.iBr.iX = bRect2.iTl.iX;
       
  3617                     }
       
  3618                 else
       
  3619                     {
       
  3620                     bRect.iTl.iX = bRect2.iBr.iX;
       
  3621                     }
       
  3622                 }
       
  3623             }
       
  3624             
       
  3625         if ( aResults[column] )
       
  3626             {
       
  3627             if ( iExtension->AtSL( subCellIndex ).iSubCellType == CColumnListBoxDataExtension::EEikSLText )
       
  3628                 {
       
  3629                 TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout;
       
  3630                 
       
  3631                 textLine.iW = bRect.Width();
       
  3632 
       
  3633                 if ( !AknLayoutUtils::LayoutMirrored() )
       
  3634                     {
       
  3635                     textLine.ir = aItemRect.iBr.iX - bRect.iBr.iX;
       
  3636                     }
       
  3637                 else
       
  3638                     {
       
  3639                     textLine.il = bRect.iTl.iX - aItemRect.iTl.iX;
       
  3640                     }
       
  3641                 
       
  3642                 aLayouts[column] = textLine;
       
  3643                 }
       
  3644             }
       
  3645 
       
  3646         ++column;
       
  3647         }
       
  3648     }
       
  3649 
       
  3650 // -----------------------------------------------------------------------------
       
  3651 // CColumnListBoxData::SubCellsMightIntersect
       
  3652 // -----------------------------------------------------------------------------
       
  3653 //
       
  3654 EXPORT_C void CColumnListBoxData::SubCellsMightIntersect( const TBool aMightIntersect )
       
  3655     {
       
  3656     iExtension->iSubCellsMightIntersect = aMightIntersect;
       
  3657     }
       
  3658     
       
  3659 void CColumnListBoxDataExtension::CreateColorBitmapsL()
       
  3660     {
       
  3661     _AKNTRACE( "[%s][%s][%d].", "CColumnListBoxDataExtension", __FUNCTION__, __LINE__ );
       
  3662     /* size calculation relies on fact, that currently all additional
       
  3663     * icons in column lists are same size. Size could be calculated
       
  3664     * from sizes availble in setconditionalsubcelll(), but that would
       
  3665     * be too unreliable. And there is no way to calculate size of
       
  3666     * icons created by symbian's old api.
       
  3667     */
       
  3668     TRect mainPane;
       
  3669     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
  3670     TAknLayoutRect r;
       
  3671     r.LayoutRect( mainPane, AknLayoutScalable_Avkon::listscroll_gen_pane(0) );
       
  3672     r.LayoutRect( r.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0) );
       
  3673     r.LayoutRect( r.Rect(), AknLayoutScalable_Avkon::list_single_pane(0) );
       
  3674     r.LayoutRect( r.Rect(), AknLayoutScalable_Avkon::list_single_pane_g1(0) );
       
  3675     TSize aSize = r.Rect().Size();
       
  3676     
       
  3677     TRgb color, hiliColor;
       
  3678     TInt error;
       
  3679     // icon #13 main area   additional list icons   #215
       
  3680     // icon #16 list highlight  additional list iconsform checkbox, radio button    #215
       
  3681 
       
  3682     error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  3683                                        color,
       
  3684                                        KAknsIIDQsnIconColors,
       
  3685                                        EAknsCIQsnIconColorsCG13 );
       
  3686     if ( error )
       
  3687         {
       
  3688         return;
       
  3689         }
       
  3690     error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  3691                                        hiliColor,
       
  3692                                        KAknsIIDQsnIconColors,
       
  3693                                        EAknsCIQsnIconColorsCG16 );
       
  3694     if ( error )
       
  3695         {
       
  3696         return;
       
  3697         }
       
  3698     
       
  3699      if ( iColorBmp && iColorBmp->SizeInPixels() == aSize
       
  3700           && color == iIconColor && hiliColor == iHiliIconColor )
       
  3701          {
       
  3702          return;
       
  3703          }
       
  3704 
       
  3705     iIconColor = color;
       
  3706     iHiliIconColor = hiliColor;
       
  3707 
       
  3708     if ( !iColorBmp )
       
  3709         {
       
  3710         iColorBmp = new( ELeave ) CFbsBitmap();
       
  3711         iColorBmp->Create( aSize, CCoeEnv::Static()->ScreenDevice()->DisplayMode() );
       
  3712         }
       
  3713     else if ( iColorBmp->SizeInPixels() != aSize )
       
  3714         {
       
  3715         iColorBmp->Resize( aSize );
       
  3716         }
       
  3717     if ( !iHiliBmp )
       
  3718         {
       
  3719         iHiliBmp = new( ELeave ) CFbsBitmap();
       
  3720         iHiliBmp->Create( aSize, CCoeEnv::Static()->ScreenDevice()->DisplayMode() );
       
  3721         }
       
  3722     else if ( iHiliBmp->SizeInPixels() != aSize )
       
  3723         {
       
  3724         iHiliBmp->Resize( aSize );
       
  3725         }
       
  3726 
       
  3727     CFbsBitGc* fbsBitGc = CFbsBitGc::NewL();
       
  3728     CleanupStack::PushL( fbsBitGc );
       
  3729 
       
  3730     CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( iColorBmp );
       
  3731     CleanupStack::PushL( bmpDevice );
       
  3732     fbsBitGc->Activate( bmpDevice );
       
  3733     fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen);
       
  3734     fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  3735     fbsBitGc->SetBrushColor( color );
       
  3736     fbsBitGc->Clear();
       
  3737     CleanupStack::PopAndDestroy( bmpDevice );
       
  3738     bmpDevice = NULL;
       
  3739     
       
  3740     bmpDevice = CFbsBitmapDevice::NewL( iHiliBmp );
       
  3741     CleanupStack::PushL( bmpDevice );
       
  3742     fbsBitGc->Activate( bmpDevice );
       
  3743     fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen);
       
  3744     fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  3745     fbsBitGc->SetBrushColor( hiliColor );
       
  3746     fbsBitGc->Clear();
       
  3747     CleanupStack::PopAndDestroy( bmpDevice );
       
  3748     bmpDevice = NULL;
       
  3749 
       
  3750     CleanupStack::PopAndDestroy( fbsBitGc );
       
  3751     }
       
  3752 
       
  3753 
       
  3754 EXPORT_C TUint32 CColumnListBoxData::CurrentItemTextWasClipped() const
       
  3755     {
       
  3756     return iExtension ? iExtension->iClippedColumns : 0;
       
  3757     }
       
  3758 
       
  3759 TBool CColumnListBoxData::KineticScrollingEnabled() const
       
  3760     {
       
  3761     if ( iExtension )
       
  3762         {
       
  3763         return iExtension->iKineticScrolling;       
       
  3764         }
       
  3765     return EFalse;
       
  3766     }
       
  3767 
       
  3768 
       
  3769 // End of File