uifw/AvKon/src/eikfrlbd.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #ifdef __ARMCC__
       
    19 #pragma push
       
    20 #pragma O3
       
    21 #pragma Otime
       
    22 #pragma arm
       
    23 #endif // __ARMCC__
    18 
    24 
    19 #include <eikfrlbd.h>
    25 #include <eikfrlbd.h>
    20 #include <aknlists.h>
    26 #include <aknlists.h>
    21 #include <AknMarqueeControl.h>
    27 #include <AknMarqueeControl.h>
    22 #include <AknPictographInterface.h>
    28 #include <AknPictographInterface.h>
    32 #include <eikslbd.h>
    38 #include <eikslbd.h>
    33 #include "AknDebug.h"
    39 #include "AknDebug.h"
    34 #include <aknlayoutscalable_avkon.cdl.h>
    40 #include <aknlayoutscalable_avkon.cdl.h>
    35 #include <layoutmetadata.cdl.h>
    41 #include <layoutmetadata.cdl.h>
    36 #include <aknphysics.h>
    42 #include <aknphysics.h>
       
    43 #include <AknIconArray.h>
       
    44 #include <avkon.mbg>
    37 
    45 
    38 
    46 
    39 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
    47 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
    40 #include <aknlistloadertfx.h>
    48 #include <aknlistloadertfx.h>
    41 #include <aknlistboxtfxinternal.h>
    49 #include <aknlistboxtfxinternal.h>
    42 #endif //RD_UI_TRANSITION_EFFECTS_LIST
    50 #endif //RD_UI_TRANSITION_EFFECTS_LIST
    43 
    51 
    44 #include <touchfeedback.h>
    52 #include <touchfeedback.h>
       
    53 #include <AknSmileyUtils.h>
    45 #include "akntrace.h"
    54 #include "akntrace.h"
    46 
    55 
    47 // there are 17(!) subcells in qdial grid (0 ... 16)
    56 // there are 17(!) subcells in qdial grid (0 ... 16)
    48 const TInt KMaxSubCellIndex = 16 + 1;
    57 const TInt KMaxSubCellIndex = 16 + 1;
    49 
    58 
    50 // colored tick marks support
    59 // colored tick marks support
    51 const TInt KColorIconFlag = -1;
    60 const TInt KColorIconFlag = -1;
    52 const TInt KColorIconIdx  =  0;
    61 const TInt KColorIconIdx  =  0;
       
    62 
       
    63 // Number of icons in marking mode icon array
       
    64 const TInt KMarkingModeIconArraySize = 2;
       
    65 
       
    66 // smiley text place holder
       
    67 _LIT( KPlaceHolder, "\xFFF0i" );
    53 
    68 
    54 /**
    69 /**
    55 * This class needs to be in .cpp file so that we do not accidentally make it
    70 * This class needs to be in .cpp file so that we do not accidentally make it
    56 * derivable; that would destroy all the binary compability advantages this
    71 * derivable; that would destroy all the binary compability advantages this
    57 * class has..
    72 * class has..
    69 NONSHARABLE_CLASS(CFormattedCellListBoxDataExtension) :
    84 NONSHARABLE_CLASS(CFormattedCellListBoxDataExtension) :
    70     public CActive,
    85     public CActive,
    71     public MAknPictographAnimatorCallBack,
    86     public MAknPictographAnimatorCallBack,
    72     public MCoeForegroundObserver,
    87     public MCoeForegroundObserver,
    73     public MAknsEffectAnimObserver,
    88     public MAknsEffectAnimObserver,
    74     public MListBoxItemChangeObserver
    89     public MListBoxItemChangeObserver,
       
    90     public MAknSmileyObserver
    75     {
    91     {
    76 public:
    92 public:
    77     enum TFlag
    93     enum TFlag
    78         {
    94         {
    79         // Set if current item background should be copied to animation as
    95         // Set if current item background should be copied to animation as
   115         TInt iSubCell; // Must be first entry
   131         TInt iSubCell; // Must be first entry
   116         TAknTextLineLayout iTextLayout;
   132         TAknTextLineLayout iTextLayout;
   117         TAknWindowLineLayout iGraphicLayout;
   133         TAknWindowLineLayout iGraphicLayout;
   118         TInt iSubCellType;
   134         TInt iSubCellType;
   119         TInt iConditionValue; // used with conditional layouts for not always drawn subcells
   135         TInt iConditionValue; // used with conditional layouts for not always drawn subcells
       
   136         TBool iSmileyCell;
   120         };
   137         };
   121 
   138 
   122     SRowAndSubCell& At(TInt aArrayIndex);
   139     SRowAndSubCell& At(TInt aArrayIndex);
   123     const SRowAndSubCell& At(TInt aArrayIndex) const;
   140     const SRowAndSubCell& At(TInt aArrayIndex) const;
   124     void AddRowAndSubCellL(TInt aRow,TInt aSubCell);
   141     void AddRowAndSubCellL(TInt aRow,TInt aSubCell);
   125     TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const;
   142     TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const;
   126     void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell);
   143     void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell);
   127 
   144 
   128     SSLSubCell& AtSL(TInt aArrayIndex);
   145     SSLSubCell& SLAt(TInt aArrayIndex);
   129     const SSLSubCell& AtSL(TInt aArrayIndex) const;
   146     const SSLSubCell& SLAt(TInt aArrayIndex) const;
   130     void AddSLSubCellL(TInt aSubCell);
   147     void AddSLSubCellL(TInt aSubCell);
   131     TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const;
   148     TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const;
   132     void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell);
   149     void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell);
   133     void ResetSLSubCellArray();
   150     void ResetSLSubCellArray();
   134 
   151 
   165     
   182     
   166     TBool DrawPressedDownEffect( MAknsSkinInstance* aSkin, 
   183     TBool DrawPressedDownEffect( MAknsSkinInstance* aSkin, 
   167                                  CWindowGc& aGc, 
   184                                  CWindowGc& aGc, 
   168                                  const TRect& aOutRect, 
   185                                  const TRect& aOutRect, 
   169                                  const TRect& aInnerRect ) const;
   186                                  const TRect& aInnerRect ) const;
       
   187     void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, 
       
   188                              const TAknLayoutText& aLayout, 
       
   189                              TBool aUseLogicalToVisualConversion, 
       
   190                              const TRgb &aColor);
       
   191     TInt ConvertTextToSmiley( TDes& aText );
       
   192     void LoadMarkingIconsL();
       
   193 
   170 private: // New internal methods
   194 private: // New internal methods
   171     TBool DrawHighlightBackground( CFbsBitGc& aGc );
   195     TBool DrawHighlightBackground( CFbsBitGc& aGc );
   172     void PostDeleteAnimation();
   196     void PostDeleteAnimation();
   173     void CreateAnimationL();
   197     void CreateAnimationL();
   174     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
   198     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
   186     void SetSubCellLayoutAlignmentL( TInt aSubCellIndex );        
   210     void SetSubCellLayoutAlignmentL( TInt aSubCellIndex );        
   187         
   211         
   188         
   212         
   189     TInt FindSubCellExtIndex(TInt& aArrayIndex,TInt aSubCell) const;
   213     TInt FindSubCellExtIndex(TInt& aArrayIndex,TInt aSubCell) const;
   190     TBool SubCellLayoutAlignment(TInt aSubCellIndex) const;        
   214     TBool SubCellLayoutAlignment(TInt aSubCellIndex) const;        
   191 
   215 public: // from MAknSmileyObserver
       
   216     void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon );
       
   217     void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon );
   192 private: // From MAknPictographAnimatorCallBack
   218 private: // From MAknPictographAnimatorCallBack
   193     void DrawPictographArea();
   219     void DrawPictographArea();
   194 
   220 
   195 public:
   221 public:
   196     CCoeControl *iControl; // not owned
   222     CCoeControl *iControl; // not owned
   255 
   281 
   256     CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment
   282     CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment
   257 
   283 
   258     TRect iMarginRect;    
   284     TRect iMarginRect;    
   259     TBool iKineticScrolling;
   285     TBool iKineticScrolling;
       
   286     CAknSmileyManager* iSmileyMan;
       
   287     TSize iSmileySize; // last set simley size
       
   288     CAknIconArray* iMarkingIconArray;
   260     };
   289     };
   261 
   290 
   262 
   291 
   263 /**
   292 /**
   264 * High priority is well argumented because running the active object will
   293 * High priority is well argumented because running the active object will
   303     cenRep->Get( KAknAutomaticListStretching, iStretchingEnabled );
   332     cenRep->Get( KAknAutomaticListStretching, iStretchingEnabled );
   304     delete cenRep;
   333     delete cenRep;
   305 #endif
   334 #endif
   306 
   335 
   307     iKineticScrolling = CAknPhysics::FeatureEnabled();
   336     iKineticScrolling = CAknPhysics::FeatureEnabled();
       
   337     LoadMarkingIconsL();
   308     _AKNTRACE_FUNC_EXIT;
   338     _AKNTRACE_FUNC_EXIT;
   309     }
   339     }
   310 
   340 
   311 CFormattedCellListBoxDataExtension::~CFormattedCellListBoxDataExtension()
   341 CFormattedCellListBoxDataExtension::~CFormattedCellListBoxDataExtension()
   312     {
   342     {
   314     Cancel();
   344     Cancel();
   315 
   345 
   316     // Stop receiving foreground events
   346     // Stop receiving foreground events
   317     CCoeEnv* env = CCoeEnv::Static();
   347     CCoeEnv* env = CCoeEnv::Static();
   318     env->RemoveForegroundObserver( *this );
   348     env->RemoveForegroundObserver( *this );
       
   349     delete iSmileyMan;
   319 
   350 
   320     delete iRowAndSubCellArray;
   351     delete iRowAndSubCellArray;
   321     iRowAndSubCellArray = NULL;
   352     iRowAndSubCellArray = NULL;
   322     delete iSLSubCellArray;
   353     delete iSLSubCellArray;
   323     iSLSubCellArray = NULL;
   354     iSLSubCellArray = NULL;
   330     delete iMarquee;
   361     delete iMarquee;
   331     delete i2ndLineMarquee;
   362     delete i2ndLineMarquee;
   332     delete iAnimation;
   363     delete iAnimation;
   333     delete iColorBmp;
   364     delete iColorBmp;
   334     delete iHiliBmp;
   365     delete iHiliBmp;
       
   366     
       
   367     if ( iMarkingIconArray )
       
   368         {
       
   369         iMarkingIconArray->ResetAndDestroy();
       
   370         }
       
   371 
       
   372     delete iMarkingIconArray;
   335     _AKNTRACE_FUNC_EXIT;
   373     _AKNTRACE_FUNC_EXIT;
   336     }
   374     }
   337 
   375 
   338 void 
   376 void 
   339 CFormattedCellListBoxDataExtension::AddRowAndSubCellL(TInt aRow,TInt aSubCell)
   377 CFormattedCellListBoxDataExtension::AddRowAndSubCellL(TInt aRow,TInt aSubCell)
   401     subcell.iSubCell = aSubCell;
   439     subcell.iSubCell = aSubCell;
   402     subcell.iTextLayout = NULL;
   440     subcell.iTextLayout = NULL;
   403     subcell.iGraphicLayout = NULL;
   441     subcell.iGraphicLayout = NULL;
   404     subcell.iSubCellType = 0;
   442     subcell.iSubCellType = 0;
   405     subcell.iConditionValue = -1;
   443     subcell.iConditionValue = -1;
       
   444     subcell.iSmileyCell = EFalse;
   406 
   445 
   407     TKeyArrayFix key(0,ECmpTInt32);
   446     TKeyArrayFix key(0,ECmpTInt32);
   408     iSLSubCellArray->InsertIsqL(subcell,key);
   447     iSLSubCellArray->InsertIsqL(subcell,key);
   409     }
   448     }
   410 
   449 
   411 
   450 
   412 CFormattedCellListBoxDataExtension::SSLSubCell& 
   451 CFormattedCellListBoxDataExtension::SSLSubCell& 
   413 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex)
   452 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex)
   414     {
   453     {
   415     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   454     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   416     return(iSLSubCellArray->At(aArrayIndex));
   455     return(iSLSubCellArray->At(aArrayIndex));
   417     }
   456     }
   418 
   457 
   419 const CFormattedCellListBoxDataExtension::SSLSubCell& 
   458 const CFormattedCellListBoxDataExtension::SSLSubCell& 
   420 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) const
   459 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) const
   421     {
   460     {
   422     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   461     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   423     return(iSLSubCellArray->At(aArrayIndex));
   462     return(iSLSubCellArray->At(aArrayIndex));
   424     }
   463     }
   425 
   464 
   673     {
   712     {
   674     _AKNTRACE_FUNC_ENTER;
   713     _AKNTRACE_FUNC_ENTER;
   675     DeleteAnim();
   714     DeleteAnim();
   676     TryCreateAnimation();
   715     TryCreateAnimation();
   677     TRAP_IGNORE(CreateColorBitmapsL());
   716     TRAP_IGNORE(CreateColorBitmapsL());
       
   717     TRAP_IGNORE( LoadMarkingIconsL() );
   678     _AKNTRACE_FUNC_EXIT;
   718     _AKNTRACE_FUNC_EXIT;
   679     }
   719     }
   680 
   720 
   681 // -----------------------------------------------------------------------------
   721 // -----------------------------------------------------------------------------
   682 // CFormattedCellListBoxDataExtension::SetControl
   722 // CFormattedCellListBoxDataExtension::SetControl
  1183     if (FindSubCellExtIndex(index,aSubCellIndex)==KErrNotFound)
  1223     if (FindSubCellExtIndex(index,aSubCellIndex)==KErrNotFound)
  1184         return (ETrue);
  1224         return (ETrue);
  1185     return(iSubCellExtArray->At(index).iLayoutAlign);    
  1225     return(iSubCellExtArray->At(index).iLayoutAlign);    
  1186     }   
  1226     }   
  1187 
  1227 
  1188 
  1228 void CFormattedCellListBoxDataExtension::SmileyStillImageLoaded(
       
  1229     CAknSmileyIcon* /*aSmileyIcon*/)
       
  1230     {
       
  1231     iControl->DrawDeferred();
       
  1232     }
       
  1233 
       
  1234 void CFormattedCellListBoxDataExtension::SmileyAnimationChanged( 
       
  1235     CAknSmileyIcon* /*aSmileyIcon*/ )
       
  1236     {
       
  1237     }
  1189 
  1238 
  1190 ///////////handling TSubCellExt,end
  1239 ///////////handling TSubCellExt,end
  1191 
  1240 
  1192 void CFormattedCellListBoxDataExtension::DrawPictographArea()
  1241 void CFormattedCellListBoxDataExtension::DrawPictographArea()
  1193     {
  1242     {
  1247                                      aInnerRect,
  1296                                      aInnerRect,
  1248                                      KAknsIIDQsnFrListPressed,
  1297                                      KAknsIIDQsnFrListPressed,
  1249                                      KAknsIIDQsnFrListCenterPressed );
  1298                                      KAknsIIDQsnFrListCenterPressed );
  1250     }
  1299     }
  1251 
  1300 
       
  1301 void CFormattedCellListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc,
       
  1302                                                              const TDesC& aSmileyText,
       
  1303                                                              const TAknLayoutText& aLayout,
       
  1304                                                              TBool aUseLogicalToVisualConversion,
       
  1305                                                              const TRgb& aColor )
       
  1306     {
       
  1307     __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
       
  1308     TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), 
       
  1309                   aLayout.Font()->HeightInPixels() );
       
  1310     TSize s(l,l);
       
  1311     if ( iSmileySize != s )
       
  1312         {
       
  1313         iSmileyMan->SetSize( s );
       
  1314         iSmileySize = s;
       
  1315         }
       
  1316     aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor...
       
  1317     iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion );
       
  1318     }
       
  1319 TInt CFormattedCellListBoxDataExtension::ConvertTextToSmiley( TDes& aText)
       
  1320     {
       
  1321     __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
       
  1322     TInt count = 0;
       
  1323     TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ;
       
  1324     return err == KErrNone ? count : err;
       
  1325     }
       
  1326 
       
  1327 
       
  1328 // -----------------------------------------------------------------------------
       
  1329 // CFormattedCellListBoxDataExtension::LoadMarkingIconsL
       
  1330 // -----------------------------------------------------------------------------
       
  1331 //
       
  1332 void CFormattedCellListBoxDataExtension::LoadMarkingIconsL()
       
  1333     {
       
  1334     if ( !iMarkingIconArray )
       
  1335         {
       
  1336         iMarkingIconArray = new ( ELeave ) CAknIconArray( 
       
  1337                 KMarkingModeIconArraySize );
       
  1338         }
       
  1339     else
       
  1340         {
       
  1341         iMarkingIconArray->ResetAndDestroy();
       
  1342         }
       
  1343 
       
  1344     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1345     const TDesC& avkonIconFile = AknIconUtils::AvkonIconFileName();
       
  1346 
       
  1347     CGulIcon* icon = AknsUtils::CreateGulIconL( skin, 
       
  1348             KAknsIIDQgnPropCheckboxOn, 
       
  1349             avkonIconFile, 
       
  1350             EMbmAvkonQgn_prop_checkbox_on, 
       
  1351             EMbmAvkonQgn_prop_checkbox_on_mask );
       
  1352     
       
  1353     CleanupStack::PushL( icon );
       
  1354     iMarkingIconArray->AppendL( icon );
       
  1355     CleanupStack::Pop( icon );
       
  1356 
       
  1357     icon = AknsUtils::CreateGulIconL( skin, 
       
  1358             KAknsIIDQgnPropCheckboxOff, 
       
  1359             avkonIconFile, 
       
  1360             EMbmAvkonQgn_prop_checkbox_off, 
       
  1361             EMbmAvkonQgn_prop_checkbox_off_mask );
       
  1362 
       
  1363     CleanupStack::PushL( icon );
       
  1364     iMarkingIconArray->AppendL( icon );
       
  1365     CleanupStack::Pop( icon );
       
  1366     }
       
  1367 
  1252 
  1368 
  1253 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const 
  1369 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const 
  1254     {
  1370     {
       
  1371     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1255     return iExtension->iControl;
  1372     return iExtension->iControl;
  1256     }
  1373     }
  1257 
  1374 
  1258 EXPORT_C void CFormattedCellListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition)
  1375 EXPORT_C void CFormattedCellListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition)
  1259     {
  1376     {
  1260     if (iExtension)
  1377     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1261         iExtension->iSeparatorLinePosition = aPosition;
  1378     iExtension->iSeparatorLinePosition = aPosition;
  1262     }
  1379     }
  1263 EXPORT_C TAknSeparatorLinePosition CFormattedCellListBoxData::SeparatorLinePosition() const
  1380 EXPORT_C TAknSeparatorLinePosition CFormattedCellListBoxData::SeparatorLinePosition() const
  1264     {
  1381     {
  1265     if (iExtension)
  1382     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1266         return iExtension->iSeparatorLinePosition;
  1383     return iExtension->iSeparatorLinePosition;
  1267     else
       
  1268         return ENoLine;
       
  1269     }
  1384     }
  1270 EXPORT_C CAknLayoutData *CFormattedCellListBoxData::LayoutData() const
  1385 EXPORT_C CAknLayoutData *CFormattedCellListBoxData::LayoutData() const
  1271     {
  1386     {
  1272         return NULL;
  1387         return NULL;
  1273     }
  1388     }
  1283 CFormattedCellListBoxDataExtension *CFormattedCellListBoxData::Extension() { return iExtension; }
  1398 CFormattedCellListBoxDataExtension *CFormattedCellListBoxData::Extension() { return iExtension; }
  1284 CFormattedCellListBoxDataExtension *CFormattedCellListBoxData::Extension() const { return iExtension; }
  1399 CFormattedCellListBoxDataExtension *CFormattedCellListBoxData::Extension() const { return iExtension; }
  1285 
  1400 
  1286 EXPORT_C void CFormattedCellListBoxData::SetControl(CCoeControl *aControl)
  1401 EXPORT_C void CFormattedCellListBoxData::SetControl(CCoeControl *aControl)
  1287     {
  1402     {
       
  1403     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1288     iExtension->SetControl( aControl );
  1404     iExtension->SetControl( aControl );
  1289     }
  1405     }
  1290 
  1406 
  1291 EXPORT_C MAknsControlContext* CFormattedCellListBoxData::SkinBackgroundContext() const
  1407 EXPORT_C MAknsControlContext* CFormattedCellListBoxData::SkinBackgroundContext() const
  1292     {
  1408     {
       
  1409     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1293     if (iExtension->iSkinEnabled)
  1410     if (iExtension->iSkinEnabled)
  1294         {
  1411         {
  1295         if (iExtension->iPopupFrame)
  1412         if (iExtension->iPopupFrame)
  1296             {
  1413             {
  1297             return iExtension->iPopupFrame;
  1414             return iExtension->iPopupFrame;
  1308     }
  1425     }
  1309 
  1426 
  1310 
  1427 
  1311 EXPORT_C void CFormattedCellListBoxData::SetSkinEnabledL(TBool aEnabled)
  1428 EXPORT_C void CFormattedCellListBoxData::SetSkinEnabledL(TBool aEnabled)
  1312     {
  1429     {
       
  1430     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1313     CListBoxData::SetSkinEnabledL(aEnabled);
  1431     CListBoxData::SetSkinEnabledL(aEnabled);
  1314     iExtension->iSkinEnabled = aEnabled;
  1432     iExtension->iSkinEnabled = aEnabled;
  1315     }
  1433     }
  1316 
  1434 
  1317 EXPORT_C TBool CFormattedCellListBoxData::SkinEnabled() const
  1435 EXPORT_C TBool CFormattedCellListBoxData::SkinEnabled() const
  1318     {
  1436     {
       
  1437     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1319     return iExtension->iSkinEnabled;
  1438     return iExtension->iSkinEnabled;
  1320     }
  1439     }
  1321 
  1440 
  1322 EXPORT_C void CFormattedCellListBoxData::SetSkinStyle(const TAknsItemID *id, const TRect &aTileRect)
  1441 EXPORT_C void CFormattedCellListBoxData::SetSkinStyle(const TAknsItemID *id, const TRect &aTileRect)
  1323     {
  1442     {
  1324 
  1443     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1325     if (iExtension->iSkinControlContext)
  1444     if (iExtension->iSkinControlContext)
  1326         {
  1445         {
  1327         iExtension->iSkinControlContext->SetTiledBitmap(*id);
  1446         iExtension->iSkinControlContext->SetTiledBitmap(*id);
  1328         iExtension->iSkinControlContext->SetTiledRect(aTileRect);
  1447         iExtension->iSkinControlContext->SetTiledRect(aTileRect);
  1329         }
  1448         }
  1330     }
  1449     }
  1331 EXPORT_C void CFormattedCellListBoxData::SetSkinParentPos(const TPoint &aPos)
  1450 EXPORT_C void CFormattedCellListBoxData::SetSkinParentPos(const TPoint &aPos)
  1332     {
  1451     {
       
  1452     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1333     if (iExtension->iSkinControlContext)
  1453     if (iExtension->iSkinControlContext)
  1334         {
  1454         {
  1335         iExtension->iSkinControlContext->SetParentPos(aPos);
  1455         iExtension->iSkinControlContext->SetParentPos(aPos);
  1336         }
  1456         }
  1337     }
  1457     }
  1338 EXPORT_C void CFormattedCellListBoxData::SetBackgroundSkinStyle(const TAknsItemID *aId, const TRect &aRect)
  1458 EXPORT_C void CFormattedCellListBoxData::SetBackgroundSkinStyle(const TAknsItemID *aId, const TRect &aRect)
  1339     {
  1459     {
       
  1460     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1340     if (iExtension->iSkinControlContext)
  1461     if (iExtension->iSkinControlContext)
  1341         {
  1462         {
  1342         iExtension->iSkinControlContext->SetBitmap(*aId);
  1463         iExtension->iSkinControlContext->SetBitmap(*aId);
  1343         iExtension->iSkinControlContext->SetRect(aRect);
  1464         iExtension->iSkinControlContext->SetRect(aRect);
  1344         }
  1465         }
  1345     }
  1466     }
  1346 EXPORT_C void CFormattedCellListBoxData::SetListEndSkinStyle(const TAknsItemID *aListEndId, const TRect &aRect)
  1467 EXPORT_C void CFormattedCellListBoxData::SetListEndSkinStyle(const TAknsItemID *aListEndId, const TRect &aRect)
  1347     {
  1468     {
       
  1469     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1348     if (iExtension->iSkinControlContext)
  1470     if (iExtension->iSkinControlContext)
  1349         {
  1471         {
  1350         iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId);
  1472         iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId);
  1351         iExtension->iSkinControlContext->SetBottomRect(aRect);
  1473         iExtension->iSkinControlContext->SetBottomRect(aRect);
  1352         }
  1474         }
  1353     }
  1475     }
  1354 
  1476 
  1355 EXPORT_C void CFormattedCellListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
  1477 EXPORT_C void CFormattedCellListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
  1356     {
  1478     {
       
  1479     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1357     iExtension->iSkinHighlightFrameId = aFrameId;
  1480     iExtension->iSkinHighlightFrameId = aFrameId;
  1358     iExtension->iSkinHighlightFrameCenterId = aFrameCenterId;
  1481     iExtension->iSkinHighlightFrameCenterId = aFrameCenterId;
  1359     }
  1482     }
  1360     
  1483     
  1361 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
  1484 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
  1362     {
  1485     {
  1363     if (iExtension && iExtension->iPopupFrame)
  1486     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  1487     if ( iExtension->iPopupFrame)
  1364         {
  1488         {
  1365         iExtension->iPopupFrame->SetFrame(*aFrameId);
  1489         iExtension->iPopupFrame->SetFrame(*aFrameId);
  1366         iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
  1490         iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
  1367         }
  1491         }
  1368     else
  1492     else
  1380         }
  1504         }
  1381     }
  1505     }
  1382     
  1506     
  1383 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFramePosition(const TRect &aOuterRect, const TRect &aInnerRect)
  1507 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFramePosition(const TRect &aOuterRect, const TRect &aInnerRect)
  1384     {
  1508     {
  1385     if (iExtension && iExtension->iPopupFrame)
  1509     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  1510     if ( iExtension->iPopupFrame)
  1386         iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect);
  1511         iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect);
  1387     }
  1512     }
  1388 
  1513 
  1389 EXPORT_C void CFormattedCellListBoxData::UseLogicalToVisualConversion(
  1514 EXPORT_C void CFormattedCellListBoxData::UseLogicalToVisualConversion(
  1390     TBool aUseConversion )
  1515     TBool aUseConversion )
  1391     {
  1516     {
  1392     if (iExtension)
  1517     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1393     iExtension->iUseLogicalToVisualConversion = aUseConversion;
  1518     iExtension->iUseLogicalToVisualConversion = aUseConversion;
  1394     }
  1519     }
  1395 
  1520 
  1396 void CFormattedCellListBoxData::CreatePictographInterfaceL()
  1521 void CFormattedCellListBoxData::CreatePictographInterfaceL()
  1397     {
  1522     {
       
  1523     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1398     iExtension->CreatePictographInterfaceL();
  1524     iExtension->CreatePictographInterfaceL();
  1399     }
  1525     }
  1400 
  1526 
  1401 void CFormattedCellListBoxData::CreateMarqueeControlL()
  1527 void CFormattedCellListBoxData::CreateMarqueeControlL()
  1402     {
  1528     {
       
  1529     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1403     TCallBack callBack(CFormattedCellListBoxDataExtension::RedrawEvent, iExtension->iControl);
  1530     TCallBack callBack(CFormattedCellListBoxDataExtension::RedrawEvent, iExtension->iControl);
  1404     //iExtension->iMarquee = CAknMarqueeControl::NewL();
  1531     //iExtension->iMarquee = CAknMarqueeControl::NewL();
  1405     iExtension->CreateMarqueeControlL();
  1532     iExtension->CreateMarqueeControlL();
  1406     iExtension->iMarquee->SetRedrawCallBack(callBack);
  1533     iExtension->iMarquee->SetRedrawCallBack(callBack);
  1407     iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack);
  1534     iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack);
  1655     }
  1782     }
  1656 
  1783 
  1657 EXPORT_C void 
  1784 EXPORT_C void 
  1658 CFormattedCellListBoxData::SetSubCellAlignmentL(TInt aSubCellIndex, CGraphicsContext::TTextAlign aAlign)
  1785 CFormattedCellListBoxData::SetSubCellAlignmentL(TInt aSubCellIndex, CGraphicsContext::TTextAlign aAlign)
  1659     {
  1786     {
       
  1787     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1660     TInt index = 0;
  1788     TInt index = 0;
  1661     FindSubCellIndexOrAddL(index,aSubCellIndex);
  1789     FindSubCellIndexOrAddL(index,aSubCellIndex);
  1662     At(index).iAlign=aAlign;
  1790     At(index).iAlign=aAlign;
  1663 
  1791 
  1664     iExtension->SetSubCellLayoutAlignmentL( aSubCellIndex );
  1792     iExtension->SetSubCellLayoutAlignmentL( aSubCellIndex );
  1802     }
  1930     }
  1803 
  1931 
  1804 
  1932 
  1805 EXPORT_C TBool CFormattedCellListBoxData::RespectFocus() const
  1933 EXPORT_C TBool CFormattedCellListBoxData::RespectFocus() const
  1806     {
  1934     {
  1807     if (iExtension)
  1935     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1808         return iExtension->iRespectFocus;
  1936     return iExtension->iRespectFocus;
  1809     return EFalse;
       
  1810     }
  1937     }
  1811 
  1938 
  1812 EXPORT_C void CFormattedCellListBoxData::SetRespectFocus(TBool aBool)
  1939 EXPORT_C void CFormattedCellListBoxData::SetRespectFocus(TBool aBool)
  1813     {
  1940     {
  1814     if (iExtension)
  1941     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  1815         iExtension->iRespectFocus = aBool;
  1942     iExtension->iRespectFocus = aBool;
  1816     }
  1943     }
  1817 
  1944 
  1818 EXPORT_C CFont* 
  1945 EXPORT_C CFont* 
  1819 CFormattedCellListBoxData::Font(const TListItemProperties& /*aItemProperties*/,
  1946 CFormattedCellListBoxData::Font(const TListItemProperties& /*aItemProperties*/,
  1820                    TInt aSubCellIndex) const
  1947                    TInt aSubCellIndex) const
  2183     }
  2310     }
  2184 
  2311 
  2185 EXPORT_C void CFormattedCellListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  2312 EXPORT_C void CFormattedCellListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  2186     {
  2313     {
  2187     _AKNTRACE_FUNC_ENTER;
  2314     _AKNTRACE_FUNC_ENTER;
       
  2315     _AKNTRACE("Highlight width: %d, (%d,%d)", aRect.Width(), aRect.iTl.iX, aRect.iBr.iX );
  2188     DrawDefaultHighlight(aGc, aRect, aHighlight);
  2316     DrawDefaultHighlight(aGc, aRect, aHighlight);
  2189 
  2317 
  2190     // Draw the actual items.
  2318     // Draw the actual items.
  2191     DrawFormatted(aProperties,aGc,aText,aRect,aHighlight,aColors);
  2319     DrawFormatted(aProperties,aGc,aText,aRect,aHighlight,aColors);
  2192     _AKNTRACE_FUNC_EXIT;
  2320     _AKNTRACE_FUNC_EXIT;
  2199                                           const TRect& aItemRect,
  2327                                           const TRect& aItemRect,
  2200                                           TBool aHighlight,
  2328                                           TBool aHighlight,
  2201                                           const TColors& aColors ) const
  2329                                           const TColors& aColors ) const
  2202     {
  2330     {
  2203     _AKNTRACE_FUNC_ENTER;
  2331     _AKNTRACE_FUNC_ENTER;
  2204     _AKNTRACE("DrawFormatted: aText=%S, aItemRect=(%d,%d,%d,%d)",
  2332     _AKNTRACE("DrawFormatted: aItemRect=(%d,%d,%d,%d)",
  2205             aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2333             aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2206             aItemRect.iBr.iY);
  2334             aItemRect.iBr.iY);
  2207     
  2335     
  2208     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2336     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  2337     __ASSERT_DEBUG( iExtension->iControl, Panic( EAknPanicNullPointer ));
       
  2338 
       
  2339     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl ); 
       
  2340     CListBoxView* view = listbox->View();
       
  2341 
  2209     if (!view->ViewRect().Intersects(aItemRect))
  2342     if (!view->ViewRect().Intersects(aItemRect))
  2210         {
  2343         {
  2211         // outside of the clipping rect -> don't process this item
  2344         // outside of the clipping rect -> don't process this item
  2212         return;
  2345         return;
  2213         }
  2346         }
  2214 
  2347 
  2215     if ( aHighlight )
  2348     if ( aHighlight )
  2216         {
  2349         {
  2217         iExtension->iClippedSubcells = 0;
  2350         iExtension->iClippedSubcells = 0;
  2218         }
  2351         }
       
  2352 
       
  2353     TBool backgroundDrawingSuppressed = listbox->BackgroundDrawingSuppressed();
  2219     
  2354     
  2220 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2355 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2221     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2356     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2222     if ( transApi )
  2357     if ( transApi && !backgroundDrawingSuppressed )
  2223         {
  2358         {
  2224         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
  2359         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
  2225         if(transApi->EffectsDisabled())
  2360         if(transApi->EffectsDisabled())
  2226             {
  2361             {
  2227             aGc.SetClippingRect( view->ViewRect() );
  2362             aGc.SetClippingRect( view->ViewRect() );
  2228             }
  2363             }
  2229         }
  2364         }
  2230 #else
  2365 #else
  2231     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2366     if ( !backgroundDrawingSuppressed )
  2232     aGc.SetClippingRect( view->ViewRect() );
  2367         {
       
  2368         aGc.SetClippingRect( view->ViewRect() );
       
  2369         }
  2233 #endif //RD_UI_TRANSITION_EFFECTS_LIST
  2370 #endif //RD_UI_TRANSITION_EFFECTS_LIST
  2234     
  2371     TRect vr(view->ViewRect());
       
  2372     _AKNTRACE("Clipping: Width %d, (%d,%d)", vr.Width(), vr.iTl.iX, vr.iBr.iX );
  2235     if ( UsesScalableLayoutData() )
  2373     if ( UsesScalableLayoutData() )
  2236         {
  2374         {
  2237         /* this is a AvKon list or list is created using methods in aknlists.cpp
  2375         /* this is a AvKon list or list is created using methods in aknlists.cpp
  2238         * which is _the_ way to set up a list
  2376         * which is _the_ way to set up a list
  2239         */
  2377         */
  2247         */
  2385         */
  2248         DrawFormattedOld( aProperties, aGc, aText, aItemRect, aHighlight, aColors );
  2386         DrawFormattedOld( aProperties, aGc, aText, aItemRect, aHighlight, aColors );
  2249         }
  2387         }
  2250 
  2388 
  2251 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
  2389 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
  2252     if ( transApi )
  2390     if ( transApi && !backgroundDrawingSuppressed )
  2253         {        
  2391         {        
  2254         if(transApi->EffectsDisabled())
  2392         if(transApi->EffectsDisabled())
  2255             {
  2393             {
  2256             aGc.CancelClippingRect();
  2394             aGc.CancelClippingRect();
  2257             }
  2395             }
  2258 
  2396 
  2259         transApi->StopDrawing();
  2397         transApi->StopDrawing();
  2260         }
  2398         }
  2261 #else
  2399 #else
  2262     aGc.CancelClippingRect();
  2400     if ( !backgroundDrawingSuppressed )
       
  2401         {
       
  2402         aGc.CancelClippingRect();
       
  2403         }
  2263 #endif //RD_UI_TRANSITION_EFFECTS_LIST 
  2404 #endif //RD_UI_TRANSITION_EFFECTS_LIST 
  2264     _AKNTRACE_FUNC_EXIT;
  2405     _AKNTRACE_FUNC_EXIT;
  2265     }
  2406     }
  2266 
  2407 
  2267 
  2408 
  2271                                           const CGulIcon* aIcon,
  2412                                           const CGulIcon* aIcon,
  2272                                           TInt            aSubcell,
  2413                                           TInt            aSubcell,
  2273                                           TBool           aColorIcon,
  2414                                           TBool           aColorIcon,
  2274                                           const TRect&    aGraphicRect ) const
  2415                                           const TRect&    aGraphicRect ) const
  2275     {
  2416     {
       
  2417     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  2418     
  2276     // se also eikclbd.cpp ( sigh ).
  2419     // se also eikclbd.cpp ( sigh ).
  2277     CFbsBitmap* bitmap( aIcon->Bitmap() );
  2420     CFbsBitmap* bitmap( aIcon->Bitmap() );
  2278     CFbsBitmap* mask( aIcon->Mask() );
  2421     CFbsBitmap* mask( aIcon->Mask() );
  2279 
  2422 
  2280     // possibly colorskinnable icon. Check must be after SetSize()
  2423     // possibly colorskinnable icon. Check must be after SetSize()
  2330                                                 const TRect& aItemRect,
  2473                                                 const TRect& aItemRect,
  2331                                                 TBool aHighlight,
  2474                                                 TBool aHighlight,
  2332                                                 const TColors& aColors ) const
  2475                                                 const TColors& aColors ) const
  2333     {
  2476     {
  2334     _AKNTRACE_FUNC_ENTER;
  2477     _AKNTRACE_FUNC_ENTER;
  2335     _AKNTRACE("DrawFormattedSimple: aText=%S, aItemRect=(%d,%d,%d,%d)",
  2478     _AKNTRACE("DrawFormattedSimple: aItemRect=(%d,%d,%d,%d)",
  2336             aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2479             aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2337             aItemRect.iBr.iY);
  2480             aItemRect.iBr.iY);
  2338     
  2481     
       
  2482     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  2483     
  2339     TRect textRect(aItemRect);
  2484     TRect textRect(aItemRect);
       
  2485     DrawMarkingModeIcons( aProperties, aGc, textRect );
       
  2486     
  2340     const TColors *subcellColors = &aColors;
  2487     const TColors *subcellColors = &aColors;
  2341 
  2488 
  2342     TInt lastSubCell = Min( LastSubCell(), KMaxSubCellIndex );
  2489     TInt lastSubCell = Min( LastSubCell(), KMaxSubCellIndex );
  2343 
  2490 
  2344     TInt subcell=0;
  2491     TInt subcell=0;
  2358     
  2505     
  2359     Mem::FillZ( &rectClipped[0], KMaxSubCellIndex * sizeof( TBool ) );
  2506     Mem::FillZ( &rectClipped[0], KMaxSubCellIndex * sizeof( TBool ) );
  2360     
  2507     
  2361     if ( iExtension->iSubCellsMightIntersect )
  2508     if ( iExtension->iSubCellsMightIntersect )
  2362         {
  2509         {
  2363         CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aItemRect );
  2510         CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, textRect );
  2364         }
  2511         }
  2365 
  2512 
  2366     TInt SCindex=0;
  2513     TInt SCindex=0;
  2367 
  2514 
  2368     // This loop does the drawing.    
  2515     // This loop does the drawing.    
  2380             {
  2527             {
  2381             // empty subcell, continue to draw next subcell
  2528             // empty subcell, continue to draw next subcell
  2382             ++ subcell;
  2529             ++ subcell;
  2383             continue;
  2530             continue;
  2384             }
  2531             }
  2385         if (!iExtension) break;
  2532 
  2386         if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break;
  2533         if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break;
  2387 
  2534 
  2388         if (UseSubCellColors(subcell))
  2535         if (UseSubCellColors(subcell))
  2389             {
  2536             {
  2390             subcellColors = &SubCellColors(subcell);
  2537             subcellColors = &SubCellColors(subcell);
  2393             {
  2540             {
  2394             subcellColors = &aColors;
  2541             subcellColors = &aColors;
  2395             }
  2542             }
  2396             
  2543             
  2397         TRgb color;
  2544         TRgb color;
  2398 
  2545         CListBoxView* view = static_cast<CEikListBox*>( Control() )->View();
       
  2546         TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor; 
  2399         if (aHighlight)
  2547         if (aHighlight)
  2400             {
  2548             {
  2401             color = subcellColors->iHighlightedText;
  2549             color = subcellColors->iHighlightedText;
  2402             aGc.SetBrushColor(subcellColors->iHighlightedBack); 
  2550             aGc.SetBrushColor(subcellColors->iHighlightedBack); 
  2403             if ( AknsUtils::AvkonSkinEnabled() )
  2551             if ( AknsUtils::AvkonSkinEnabled() && !useOverrideColor )
  2404                 {
  2552                 {
  2405                 if ( iExtension->iHighlightedTextColor != NULL )
  2553                 if ( iExtension->iHighlightedTextColor != NULL )
  2406                     {
  2554                     {
  2407                     color = iExtension->iHighlightedTextColor;
  2555                     color = iExtension->iHighlightedTextColor;
  2408                     }
  2556                     }
  2410             }
  2558             }
  2411         else
  2559         else
  2412             {
  2560             {
  2413             color = subcellColors->iText;
  2561             color = subcellColors->iText;
  2414             aGc.SetBrushColor(subcellColors->iBack);
  2562             aGc.SetBrushColor(subcellColors->iBack);
  2415             if ( AknsUtils::AvkonSkinEnabled() )
  2563             if ( AknsUtils::AvkonSkinEnabled() && !useOverrideColor )
  2416                 {
  2564                 {
  2417                 if ( iExtension->iTextColor != NULL )
  2565                 if ( iExtension->iTextColor != NULL )
  2418                     {
  2566                     {
  2419                     color = iExtension->iTextColor;
  2567                     color = iExtension->iTextColor;
  2420                     }
  2568                     }
  2421                 }
  2569                 }
  2422             }
  2570             }
  2423         
  2571         
  2424         // graphics or text column
  2572         // graphics or text column
  2425         if (iExtension->AtSL(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText)
  2573         if (iExtension->SLAt(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText)
  2426             {
  2574             {
  2427             const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  2575             const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  2428             const CFont* cellFont=Font(aProperties, subcell);
  2576             const CFont* cellFont=Font(aProperties, subcell);
  2429             const CFont* tempFont=(cellFont) ? cellFont : NULL;
  2577             const CFont* tempFont=(cellFont) ? cellFont : NULL;
  2430             const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  2578             const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  2436                 textLineLayout = textLines[subcell];
  2584                 textLineLayout = textLines[subcell];
  2437                 }
  2585                 }
  2438             else
  2586             else
  2439                 {
  2587                 {
  2440                 // check if there are icons affecting this text layout
  2588                 // check if there are icons affecting this text layout
  2441                 TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
  2589                 TInt gSC = iExtension->SLAt(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
  2442                 
  2590                 
  2443                 if (gSC > -1)
  2591                 if (gSC > -1)
  2444                     {
  2592                     {
  2445                     TInt tempIndex;
  2593                     TInt tempIndex;
  2446                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
  2594                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
  2447                         {
  2595                         {
  2448                         if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
  2596                         if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
  2449                         TextUtils::ColumnText(tempText,gSC, aText);
  2597                         TextUtils::ColumnText(tempText,gSC, aText);
  2450                         if (tempText != KNullDesC)
  2598                         if (tempText != KNullDesC)
  2451                             {
  2599                             {
  2452                             textLineLayout = iExtension->AtSL(tempIndex).iTextLayout;
  2600                             textLineLayout = iExtension->SLAt(tempIndex).iTextLayout;
  2453                             break;                      
  2601                             break;                      
  2454                             }
  2602                             }
  2455                         gSC = iExtension->AtSL(tempIndex).iConditionValue;
  2603                         gSC = iExtension->SLAt(tempIndex).iConditionValue;
  2456                         }
  2604                         }
  2457                     }
  2605                     }
  2458                     
  2606                     
  2459                 if (gSC == -1) // no affecting icons -> use default layout
  2607                 if (gSC == -1) // no affecting icons -> use default layout
  2460                     {
  2608                     {
  2461                     textLineLayout = iExtension->AtSL(SCindex).iTextLayout;
  2609                     textLineLayout = iExtension->SLAt(SCindex).iTextLayout;
  2462                     }
  2610                     }
  2463                 }
  2611                 }
  2464 
  2612 
  2465                       
  2613                       
  2466             CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
  2614             CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
  2492             textLayout.LayoutText(textRect, textLineLayout, usedFont);
  2640             textLayout.LayoutText(textRect, textLineLayout, usedFont);
  2493 
  2641 
  2494             SetUnderlineStyle( aProperties, aGc, subcell );
  2642             SetUnderlineStyle( aProperties, aGc, subcell );
  2495 
  2643 
  2496             // * 2 == leave some room for marquee
  2644             // * 2 == leave some room for marquee
  2497             const TInt maxlen( KMaxColumnDataLength * 2 ); 
  2645             const TInt maxlen( KMaxColumnDataLength * 3 );
  2498             TBuf<maxlen> convBuf = text.Left(maxlen);
  2646             TBuf<maxlen> convBuf = text.Left(maxlen);
       
  2647             TBool smileyDraw = EFalse;
       
  2648             // do smiley convert before clipping. don't worry marquee now.            
       
  2649             if ( iExtension->iSmileyMan && 
       
  2650                  iExtension->SLAt(SCindex).iSmileyCell &&
       
  2651                  iExtension->ConvertTextToSmiley( convBuf ) > 0 )
       
  2652                 {
       
  2653                 smileyDraw = ETrue;
       
  2654                 }
  2499 
  2655 
  2500             // Note that this potentially modifies the text so its lenght in pixels
  2656             // Note that this potentially modifies the text so its lenght in pixels
  2501             // might increase. Therefore, this should always be done before
  2657             // might increase. Therefore, this should always be done before
  2502             // wrapping/clipping text. In some cases, WordWrapListItem is called
  2658             // wrapping/clipping text. In some cases, WordWrapListItem is called
  2503             // before coming here. Is it certain that it is not done for number subcells?
  2659             // before coming here. Is it certain that it is not done for number subcells?
  2558                 if ( marquee && marqueeDisabled )
  2714                 if ( marquee && marqueeDisabled )
  2559                     {
  2715                     {
  2560                     marquee->Stop();
  2716                     marquee->Stop();
  2561                     }
  2717                     }
  2562 
  2718 
       
  2719                 if ( smileyDraw )
       
  2720                     {
       
  2721                     TRect tr(textLayout.TextRect());
       
  2722                     _AKNTRACE( "textLayout Width: %d (%d,%d)", tr.Width(), tr.iTl.iX, tr.iBr.iX );
       
  2723                     iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color );
       
  2724                     }
       
  2725                 else
       
  2726                     {
  2563                 textLayout.DrawText( aGc, convBuf, bidiConv, color );
  2727                 textLayout.DrawText( aGc, convBuf, bidiConv, color );
       
  2728                     }
  2564                 }
  2729                 }
  2565 
  2730 
  2566             if ( iExtension->iPictoInterface )
  2731             if ( iExtension->iPictoInterface )
  2567                 {
  2732                 {
  2568                 
  2733                 
  2633                 index = KColorIconIdx;
  2798                 index = KColorIconIdx;
  2634                 }
  2799                 }
  2635             
  2800             
  2636             if( !iIconArray )
  2801             if( !iIconArray )
  2637                 {
  2802                 {
       
  2803                 ++ subcell;
  2638                 continue;
  2804                 continue;
  2639                 }
  2805                 }
  2640 
  2806 
  2641             if (aHighlight && (index > 0xffff))
  2807             if (aHighlight && (index > 0xffff))
  2642                 {
  2808                 {
  2644                 }
  2810                 }
  2645 
  2811 
  2646              index = index & 0xffff; // mask off possible highlight icon
  2812              index = index & 0xffff; // mask off possible highlight icon
  2647             __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  2813             __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  2648             
  2814             
  2649             TAknWindowLineLayout graphicLayout = iExtension->AtSL(SCindex).iGraphicLayout;
  2815             TAknWindowLineLayout graphicLayout = iExtension->SLAt(SCindex).iGraphicLayout;
  2650             TAknLayoutRect graphicRect; 
  2816             TAknLayoutRect graphicRect; 
  2651             
  2817             
  2652             graphicRect.LayoutRect(textRect,graphicLayout);
  2818             graphicRect.LayoutRect(textRect,graphicLayout);
  2653             TSize graphicSize( graphicRect.Rect().Size() );
  2819             TSize graphicSize( graphicRect.Rect().Size() );
  2654             
  2820             
  2678     const_cast<CFormattedCellListBoxData*>( this )->
  2844     const_cast<CFormattedCellListBoxData*>( this )->
  2679         SetWordWrappedSubcellIndices( -1, -1 );
  2845         SetWordWrappedSubcellIndices( -1, -1 );
  2680     _AKNTRACE_FUNC_EXIT;
  2846     _AKNTRACE_FUNC_EXIT;
  2681     }
  2847     }
  2682 
  2848 
       
  2849 // -----------------------------------------------------------------------------
       
  2850 // CFormattedCellListBoxData::DrawMarkingModeIcons
       
  2851 // -----------------------------------------------------------------------------
       
  2852 //
       
  2853 void CFormattedCellListBoxData::DrawMarkingModeIcons( 
       
  2854                                             TListItemProperties& aProperties,
       
  2855                                             CWindowGc& aGc,
       
  2856                                             TRect& aItemRect ) const
       
  2857     {
       
  2858     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
       
  2859     TRect textRect( aItemRect );
       
  2860     
       
  2861     if ( listbox->View()->ItemDrawer()->Flags() 
       
  2862             & CListItemDrawer::EMarkingModeEnabled 
       
  2863             && !aProperties.IsSelectionHidden()            
       
  2864             && iExtension->iMarkingIconArray
       
  2865             &&  iExtension->iMarkingIconArray->Count() 
       
  2866                 == KMarkingModeIconArraySize )       
       
  2867         {
       
  2868         if ( AknLayoutUtils::LayoutMirrored() )
       
  2869             {
       
  2870             textRect.iBr.iX -= 
       
  2871                 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( 
       
  2872                     0 ).LayoutLine().ir;
       
  2873             }
       
  2874         else
       
  2875             {
       
  2876             textRect.iTl.iX += 
       
  2877                 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( 
       
  2878                     0 ).LayoutLine().il;
       
  2879             }                    
       
  2880 
       
  2881         TAknLayoutRect layoutRect;
       
  2882         layoutRect.LayoutRect( aItemRect, 
       
  2883                 AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) );
       
  2884 
       
  2885         // unchecked icon
       
  2886         CGulIcon* icon = ( *iExtension->iMarkingIconArray )[1];        
       
  2887         
       
  2888         if ( listbox->View()->ItemIsSelected( 
       
  2889                 iExtension->iCurrentlyDrawnItemIndex ) )
       
  2890             {
       
  2891             icon = ( *iExtension->iMarkingIconArray )[0];        
       
  2892             }
       
  2893         
       
  2894         CFbsBitmap* bitmap = icon->Bitmap();
       
  2895 
       
  2896         if ( bitmap )
       
  2897             {
       
  2898             TSize size( bitmap->SizeInPixels() ); // set size if not already
       
  2899             TSize targetSize( layoutRect.Rect().Size() );
       
  2900             
       
  2901             if ( size.iWidth != targetSize.iWidth && 
       
  2902                  size.iHeight != targetSize.iHeight )
       
  2903                 {
       
  2904                 AknIconUtils::SetSize( bitmap, targetSize,
       
  2905                         EAspectRatioPreservedAndUnusedSpaceRemoved ); 
       
  2906                 }
       
  2907             aGc.BitBltMasked( layoutRect.Rect().iTl, 
       
  2908                               bitmap, 
       
  2909                               TRect( layoutRect.Rect().Size() ),
       
  2910                               icon->Mask(), EFalse );
       
  2911             }
       
  2912         aItemRect = textRect;
       
  2913         }    
       
  2914     }
  2683 
  2915 
  2684 EXPORT_C 
  2916 EXPORT_C 
  2685 CFormattedCellListBoxData::CFormattedCellListBoxData()
  2917 CFormattedCellListBoxData::CFormattedCellListBoxData()
  2686     : CListBoxData()
  2918     : CListBoxData()
  2687     {
  2919     {
  2843 
  3075 
  2844 EXPORT_C void CPopupFormattedListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  3076 EXPORT_C void CPopupFormattedListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  2845     {
  3077     {
  2846     _AKNTRACE_FUNC_ENTER;
  3078     _AKNTRACE_FUNC_ENTER;
  2847     const TRect &aItemRect = aRect;
  3079     const TRect &aItemRect = aRect;
  2848     
  3080 
  2849     DrawPopupHighlight(aGc, aItemRect, aHighlight);
  3081     DrawDefaultHighlight( aGc, aItemRect, aHighlight );
  2850     
  3082 
  2851     // Draw the actual items.
  3083     // Draw the actual items.
  2852     DrawFormatted(aProperties,aGc,aText,aItemRect,aHighlight,aColors);
  3084     DrawFormatted(aProperties,aGc,aText,aItemRect,aHighlight,aColors);
  2853     _AKNTRACE_FUNC_EXIT;
  3085     _AKNTRACE_FUNC_EXIT;
  2854     }
  3086     }
  2855 
  3087 
  2856 void CFormattedCellListBoxData::DrawDefaultHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const
  3088 void CFormattedCellListBoxData::DrawDefaultHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const
  2857     {
  3089     {
  2858     _AKNTRACE_FUNC_ENTER;
  3090     _AKNTRACE_FUNC_ENTER;    
       
  3091     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  3092     
  2859     // When this flag set, draw pressed down state and don't use animation.
  3093     // When this flag set, draw pressed down state and don't use animation.
  2860     // There are several derived CListboxData in this file. All of them do  
  3094     // There are several derived CListboxData in this file. All of them do  
  2861     // this same thing.
  3095     // this same thing.
  2862     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  3096     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2863     TBool pressedDown = view->ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState;
  3097     TBool pressedDown = view->ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState;
  2946 #endif
  3180 #endif
  2947         }
  3181         }
  2948     _AKNTRACE_FUNC_EXIT;
  3182     _AKNTRACE_FUNC_EXIT;
  2949     }
  3183     }
  2950 
  3184 
  2951 void CFormattedCellListBoxData::DrawSettingHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const
       
  2952     {
       
  2953     _AKNTRACE_FUNC_ENTER;
       
  2954     DrawDefaultHighlight( aGc, aItemRect, aHighlight );
       
  2955     _AKNTRACE_FUNC_EXIT;
       
  2956     }
       
  2957 
       
  2958 void CFormattedCellListBoxData::DrawPopupHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const
       
  2959     {
       
  2960     _AKNTRACE_FUNC_ENTER;
       
  2961     DrawDefaultHighlight( aGc, aItemRect, aHighlight );
       
  2962     _AKNTRACE_FUNC_EXIT;
       
  2963     }
       
  2964 
       
  2965 void CFormattedCellListBoxData::DrawPopupFrame(CWindowGc &aGc) const
       
  2966     {
       
  2967     _AKNTRACE_FUNC_ENTER;
       
  2968     CCoeControl* control = Control();
       
  2969 
       
  2970     if ( control )
       
  2971         {
       
  2972         aGc.SetPenStyle( CGraphicsContext::ENullPen );
       
  2973 
       
  2974         TBool done = AknsDrawUtils::Background( AknsUtils::SkinInstance(), 
       
  2975                                                 iExtension->iPopupFrame, 
       
  2976                                                 control, 
       
  2977                                                 aGc, 
       
  2978                                                 control->Rect() );
       
  2979         
       
  2980         if ( !done )
       
  2981             {
       
  2982             aGc.Clear( control->Rect() );
       
  2983             }
       
  2984         }
       
  2985     _AKNTRACE_FUNC_EXIT;
       
  2986     }
       
  2987 
  3185 
  2988 void CFormattedCellListBoxData::SetWordWrappedSubcellIndices(
  3186 void CFormattedCellListBoxData::SetWordWrappedSubcellIndices(
  2989     TInt aFirstIndex,
  3187     TInt aFirstIndex,
  2990     TInt aSecondIndex )
  3188     TInt aSecondIndex )
  2991     {
  3189     {
       
  3190     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  2992     iExtension->iFirstWordWrappedSubcellIndex = (TInt16)aFirstIndex;
  3191     iExtension->iFirstWordWrappedSubcellIndex = (TInt16)aFirstIndex;
  2993     iExtension->iSecondWordWrappedSubcellIndex = (TInt16)aSecondIndex;
  3192     iExtension->iSecondWordWrappedSubcellIndex = (TInt16)aSecondIndex;
  2994     }
  3193     }
  2995 
  3194 
  2996 EXPORT_C void CFormattedCellListBoxData::EnableMarqueeL(TBool aEnable)
  3195 EXPORT_C void CFormattedCellListBoxData::EnableMarqueeL(TBool aEnable)
  2997     {
  3196     {
       
  3197     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  2998     // CreateMarqueeControlL does nothing if marquee already exists,
  3198     // CreateMarqueeControlL does nothing if marquee already exists,
  2999     // so let's just call it just in case.
  3199     // so let's just call it just in case.
  3000     CreateMarqueeControlL();
  3200     CreateMarqueeControlL();
  3001     iExtension->iMarquee->EnableMarquee(aEnable);
  3201     iExtension->iMarquee->EnableMarquee(aEnable);
  3002     iExtension->i2ndLineMarquee->EnableMarquee(aEnable);
  3202     iExtension->i2ndLineMarquee->EnableMarquee(aEnable);
  3004 
  3204 
  3005 // Two versions to eliminate compiler warnings.
  3205 // Two versions to eliminate compiler warnings.
  3006 #ifdef __WINS__
  3206 #ifdef __WINS__
  3007 EXPORT_C const TBool CFormattedCellListBoxData::IsMarqueeOn()
  3207 EXPORT_C const TBool CFormattedCellListBoxData::IsMarqueeOn()
  3008     {
  3208     {
       
  3209     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3009     return iExtension->IsMarqueeOn();
  3210     return iExtension->IsMarqueeOn();
  3010     }
  3211     }
  3011 #else
  3212 #else
  3012 EXPORT_C TBool CFormattedCellListBoxData::IsMarqueeOn()
  3213 EXPORT_C TBool CFormattedCellListBoxData::IsMarqueeOn()
  3013     {
  3214     {
       
  3215     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3014     return iExtension->IsMarqueeOn();
  3216     return iExtension->IsMarqueeOn();
  3015     }
  3217     }
  3016 #endif // __WINS__
  3218 #endif // __WINS__
  3017 
  3219 
  3018 
  3220 
  3019 void CFormattedCellListBoxData::FocusGained()
  3221 void CFormattedCellListBoxData::FocusGained()
  3020     {
  3222     {
       
  3223     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3021     iExtension->FocusGained();
  3224     iExtension->FocusGained();
  3022     }
  3225     }
  3023 
  3226 
  3024 void CFormattedCellListBoxData::FocusLost()
  3227 void CFormattedCellListBoxData::FocusLost()
  3025     {
  3228     {
       
  3229     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3026     iExtension->FocusLost();
  3230     iExtension->FocusLost();
  3027     }
  3231     }
  3028 
  3232 
  3029 void CFormattedCellListBoxData::HandleResourceChange( TInt aType )
  3233 void CFormattedCellListBoxData::HandleResourceChange( TInt aType )
  3030     {
  3234     {
  3031     _AKNTRACE_FUNC_ENTER;
  3235     _AKNTRACE_FUNC_ENTER;
       
  3236     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3032     // Animation is skin dependent, whenever skin changes animation changes
  3237     // Animation is skin dependent, whenever skin changes animation changes
  3033     // too.
  3238     // too.
  3034     if( KAknsMessageSkinChange == aType )
  3239     if( KAknsMessageSkinChange == aType )
  3035         {
  3240         {
  3036         iExtension->SkinChanged();
  3241         iExtension->SkinChanged();
  3060 // CFormattedCellListBoxData::HighlightAnim
  3265 // CFormattedCellListBoxData::HighlightAnim
  3061 // -----------------------------------------------------------------------------
  3266 // -----------------------------------------------------------------------------
  3062 //
  3267 //
  3063 EXPORT_C const CAknsEffectAnim* CFormattedCellListBoxData::HighlightAnim() const
  3268 EXPORT_C const CAknsEffectAnim* CFormattedCellListBoxData::HighlightAnim() const
  3064     {
  3269     {
  3065     if( iExtension )
  3270     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3066         return iExtension->iAnimation;
  3271     return iExtension->iAnimation;
  3067     return NULL;
       
  3068     }
  3272     }
  3069 
  3273 
  3070 // -----------------------------------------------------------------------------
  3274 // -----------------------------------------------------------------------------
  3071 // CFormattedCellListBoxData::AboutToDrawHighlightAnim
  3275 // CFormattedCellListBoxData::AboutToDrawHighlightAnim
  3072 // -----------------------------------------------------------------------------
  3276 // -----------------------------------------------------------------------------
  3073 //
  3277 //
  3074 EXPORT_C void CFormattedCellListBoxData::AboutToDrawHighlightAnim() const
  3278 EXPORT_C void CFormattedCellListBoxData::AboutToDrawHighlightAnim() const
  3075     {
  3279     {
  3076     if( !iExtension )
  3280     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3077         {
       
  3078         return;
       
  3079         }
       
  3080     if( !iExtension->iAnimation || !iExtension->iControl )
  3281     if( !iExtension->iAnimation || !iExtension->iControl )
  3081         {
  3282         {
  3082         return;
  3283         return;
  3083         }
  3284         }
  3084 
  3285 
  3103 // -----------------------------------------------------------------------------
  3304 // -----------------------------------------------------------------------------
  3104 //
  3305 //
  3105 EXPORT_C void CFormattedCellListBoxData::SetHighlightAnimBackgroundDrawer(
  3306 EXPORT_C void CFormattedCellListBoxData::SetHighlightAnimBackgroundDrawer(
  3106     MListBoxAnimBackgroundDrawer* aDrawer )
  3307     MListBoxAnimBackgroundDrawer* aDrawer )
  3107     {
  3308     {
  3108     if( iExtension )
  3309     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3109         {
  3310     iExtension->iHighlightBgDrawer = aDrawer;
  3110         iExtension->iHighlightBgDrawer = aDrawer;
       
  3111         }
       
  3112     }
  3311     }
  3113 
  3312 
  3114 // -----------------------------------------------------------------------------
  3313 // -----------------------------------------------------------------------------
  3115 // CFormattedCellListBoxData::SetItemCellSize
  3314 // CFormattedCellListBoxData::SetItemCellSize
  3116 // -----------------------------------------------------------------------------
  3315 // -----------------------------------------------------------------------------
  3117 //
  3316 //
  3118 EXPORT_C void CFormattedCellListBoxData::SetItemCellSize( const TSize& aSize )
  3317 EXPORT_C void CFormattedCellListBoxData::SetItemCellSize( const TSize& aSize )
  3119     {
  3318     {
  3120     if( iExtension )
  3319     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3121         {
  3320     if( iExtension->iAnimSize != aSize )
  3122         if( iExtension->iAnimSize != aSize )
  3321         {
  3123             {
  3322         iExtension->Play();
  3124             iExtension->Play();
  3323         }
  3125             }
  3324     iExtension->iAnimSize = aSize;
  3126         iExtension->iAnimSize = aSize;
       
  3127         }
       
  3128     }
  3325     }
  3129 
  3326 
  3130 // -----------------------------------------------------------------------------
  3327 // -----------------------------------------------------------------------------
  3131 // CFormattedCellListBoxData::HasHighlightAnim
  3328 // CFormattedCellListBoxData::HasHighlightAnim
  3132 // -----------------------------------------------------------------------------
  3329 // -----------------------------------------------------------------------------
  3133 //
  3330 //
  3134 EXPORT_C TBool CFormattedCellListBoxData::HasHighlightAnim() const
  3331 EXPORT_C TBool CFormattedCellListBoxData::HasHighlightAnim() const
  3135     {
  3332     {
  3136     if( !iExtension )
  3333     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3137         return EFalse;
  3334     return ( iExtension->iAnimation != NULL );
  3138     if( !iExtension->iAnimation )
       
  3139         return EFalse;
       
  3140     return ETrue;
       
  3141     }
  3335     }
  3142 
  3336 
  3143 // -----------------------------------------------------------------------------
  3337 // -----------------------------------------------------------------------------
  3144 // CFormattedCellListBoxData::DrawHighlightAnim
  3338 // CFormattedCellListBoxData::DrawHighlightAnim
  3145 // -----------------------------------------------------------------------------
  3339 // -----------------------------------------------------------------------------
  3146 //
  3340 //
  3147 EXPORT_C TBool CFormattedCellListBoxData::DrawHighlightAnim(
  3341 EXPORT_C TBool CFormattedCellListBoxData::DrawHighlightAnim(
  3148         CBitmapContext& aGc, const TRect& aRect ) const
  3342         CBitmapContext& aGc, const TRect& aRect ) const
  3149     {
  3343     {
  3150     if( !iExtension )
  3344     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3151         return EFalse;
       
  3152 
       
  3153     if( !iExtension->iAnimation )
  3345     if( !iExtension->iAnimation )
  3154         return EFalse;
  3346         return EFalse;
  3155 
  3347 
  3156     return iExtension->SyncAndDrawAnim( aGc, aRect );
  3348     return iExtension->SyncAndDrawAnim( aGc, aRect );
  3157     }
  3349     }
  3158 
  3350 
  3159 void CFormattedCellListBoxData::ResetMarquee()
  3351 void CFormattedCellListBoxData::ResetMarquee()
  3160     {
  3352     {
       
  3353     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3161     if (iExtension->iMarquee)
  3354     if (iExtension->iMarquee)
  3162         {
  3355         {
  3163         iExtension->iMarquee->Reset();
  3356         iExtension->iMarquee->Reset();
  3164         }
  3357         }
  3165     if (iExtension->i2ndLineMarquee)
  3358     if (iExtension->i2ndLineMarquee)
  3168         }
  3361         }
  3169     }
  3362     }
  3170 
  3363 
  3171 TInt CFormattedCellListBoxData::CurrentMarqueeItemIndex()
  3364 TInt CFormattedCellListBoxData::CurrentMarqueeItemIndex()
  3172     {
  3365     {
       
  3366     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3173     return iExtension->iCurrentItem;
  3367     return iExtension->iCurrentItem;
  3174     }
  3368     }
  3175 
  3369 
  3176 void CFormattedCellListBoxData::SetCurrentMarqueeItemIndex(TInt aIndex)
  3370 void CFormattedCellListBoxData::SetCurrentMarqueeItemIndex(TInt aIndex)
  3177     {
  3371     {
  3178     _AKNTRACE("CFormattedCellListBoxData::SetCurrentMarqueeItemIndex aIndex=%d",
  3372     _AKNTRACE("CFormattedCellListBoxData::SetCurrentMarqueeItemIndex aIndex=%d",
  3179             aIndex);
  3373             aIndex);
       
  3374     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3180     
  3375     
  3181     iExtension->iCurrentItem = aIndex;
  3376     iExtension->iCurrentItem = aIndex;
  3182     }
  3377     }
  3183 
  3378 
  3184 void CFormattedCellListBoxData::SetCurrentItemIndex(TInt aIndex)
  3379 void CFormattedCellListBoxData::SetCurrentItemIndex(TInt aIndex)
  3185     {
  3380     {
  3186     _AKNTRACE("CFormattedCellListBoxData::SetCurrentItemIndex aIndex=%d", aIndex);
  3381     _AKNTRACE("CFormattedCellListBoxData::SetCurrentItemIndex aIndex=%d", aIndex);
       
  3382     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3187     if( iExtension->iCurrentRow != aIndex )
  3383     if( iExtension->iCurrentRow != aIndex )
  3188         {
  3384         {
  3189         iExtension->iAnimFlags.Set( CFormattedCellListBoxDataExtension::EFlagUpdateBg );
  3385         iExtension->iAnimFlags.Set( CFormattedCellListBoxDataExtension::EFlagUpdateBg );
  3190         }
  3386         }
  3191     iExtension->iCurrentRow = aIndex;
  3387     iExtension->iCurrentRow = aIndex;
  3193 
  3389 
  3194 void CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex( TInt aIndex )
  3390 void CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex( TInt aIndex )
  3195     {
  3391     {
  3196     _AKNTRACE("CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex aIndex=%d", 
  3392     _AKNTRACE("CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex aIndex=%d", 
  3197             aIndex);
  3393             aIndex);
  3198     if ( iExtension )
  3394     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3199         {
  3395     iExtension->iCurrentlyDrawnItemIndex = aIndex;
  3200         iExtension->iCurrentlyDrawnItemIndex = aIndex;
       
  3201         }
       
  3202     }
  3396     }
  3203 
  3397 
  3204 EXPORT_C const CFont* 
  3398 EXPORT_C const CFont* 
  3205 CFormattedCellListBoxData::RowAndSubCellFont(TInt aRow,TInt aSubCellIndex) const
  3399 CFormattedCellListBoxData::RowAndSubCellFont(TInt aRow,TInt aSubCellIndex) const
  3206     {
  3400     {
  3207     if (!iExtension) return 0;
  3401     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3208     TInt index = 0;
  3402     TInt index = 0;
  3209     if (iExtension->FindRowAndSubCellIndex(index,aRow,aSubCellIndex)!=0)
  3403     if (iExtension->FindRowAndSubCellIndex(index,aRow,aSubCellIndex)!=0)
  3210         return 0;
  3404         return 0;
  3211     return(iExtension->At(index).iFont);
  3405     return(iExtension->At(index).iFont);
  3212     }
  3406     }
  3213 
  3407 
  3214 EXPORT_C void CFormattedCellListBoxData::SetSubCellFontForRowL(TInt aRowIndex,
  3408 EXPORT_C void CFormattedCellListBoxData::SetSubCellFontForRowL(TInt aRowIndex,
  3215                                                                TInt aSubCellIndex,
  3409                                                                TInt aSubCellIndex,
  3216                                                                const CFont* aFont)
  3410                                                                const CFont* aFont)
  3217     {
  3411     {
  3218     if (!iExtension) return;
  3412     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3219     TInt index = 0;
  3413     TInt index = 0;
  3220     iExtension->FindRowAndSubCellIndexOrAddL(index,aRowIndex,aSubCellIndex);
  3414     iExtension->FindRowAndSubCellIndexOrAddL(index,aRowIndex,aSubCellIndex);
  3221     iExtension->At(index).iFont=aFont;
  3415     iExtension->At(index).iFont=aFont;
  3222     }
  3416     }
  3223 
  3417 
  3225 * Enables / disables transparency effect, ie. does the listbox draw it's own background or not.
  3419 * Enables / disables transparency effect, ie. does the listbox draw it's own background or not.
  3226 * @param aDrawBackground  EFalse enables transparency
  3420 * @param aDrawBackground  EFalse enables transparency
  3227 */ 
  3421 */ 
  3228 EXPORT_C void CFormattedCellListBoxData::SetDrawBackground(const TBool aDrawBackground)
  3422 EXPORT_C void CFormattedCellListBoxData::SetDrawBackground(const TBool aDrawBackground)
  3229     {
  3423     {
       
  3424     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3230     iExtension->iDrawBackground = aDrawBackground;
  3425     iExtension->iDrawBackground = aDrawBackground;
  3231     if( !aDrawBackground )
  3426     if( !aDrawBackground )
  3232         {
  3427         {
  3233         iExtension->DeleteAnim();
  3428         iExtension->DeleteAnim();
  3234         }
  3429         }
  3237 /**
  3432 /**
  3238 * Is the listbox drawing the background itself or not (= "transparency")
  3433 * Is the listbox drawing the background itself or not (= "transparency")
  3239 */ 
  3434 */ 
  3240 TBool CFormattedCellListBoxData::IsBackgroundDrawingEnabled() const
  3435 TBool CFormattedCellListBoxData::IsBackgroundDrawingEnabled() const
  3241     {
  3436     {
       
  3437     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3242     return iExtension->iDrawBackground;
  3438     return iExtension->iDrawBackground;
  3243     }
  3439     }
  3244 
  3440 
  3245 
  3441 
  3246 /**
  3442 /**
  3247 * Enables / disables drawing background after scrollbar
  3443 * Enables / disables drawing background after scrollbar
  3248 * @param aDrawBackground  default ETrue
  3444 * @param aDrawBackground  default ETrue
  3249 */ 
  3445 */ 
  3250 void CFormattedCellListBoxData::SetDrawScrollbarBackground(const TBool aDrawBackground)
  3446 void CFormattedCellListBoxData::SetDrawScrollbarBackground(const TBool aDrawBackground)
  3251     {
  3447     {
       
  3448     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3252     iExtension->iDrawScrollbarBackground = aDrawBackground;
  3449     iExtension->iDrawScrollbarBackground = aDrawBackground;
  3253     }
  3450     }
  3254 
  3451 
  3255 /**
  3452 /**
  3256 * Is the listbox drawing the background after scrollbar or not
  3453 * Is the listbox drawing the background after scrollbar or not
  3257 */ 
  3454 */ 
  3258 TBool CFormattedCellListBoxData::IsScrollbarBackgroundDrawingEnabled() const
  3455 TBool CFormattedCellListBoxData::IsScrollbarBackgroundDrawingEnabled() const
  3259     {
  3456     {
       
  3457     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3260     return iExtension->iDrawScrollbarBackground;
  3458     return iExtension->iDrawScrollbarBackground;
  3261     }
  3459     }
  3262 
  3460 
  3263 
  3461 
  3264 EXPORT_C void CFormattedCellListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, 
  3462 EXPORT_C void CFormattedCellListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, 
  3265                                                           const TInt aScrollDelay, const TInt aInterval)
  3463                                                           const TInt aScrollDelay, const TInt aInterval)
  3266     {
  3464     {
       
  3465     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3267     if ( iExtension->iMarquee )
  3466     if ( iExtension->iMarquee )
  3268         {
  3467         {
  3269         iExtension->iMarquee->SetLoops( aLoops );
  3468         iExtension->iMarquee->SetLoops( aLoops );
  3270         iExtension->iMarquee->SetSpeedInPixels( aScrollAmount );
  3469         iExtension->iMarquee->SetSpeedInPixels( aScrollAmount );
  3271         iExtension->iMarquee->SetDelay( aScrollDelay );
  3470         iExtension->iMarquee->SetDelay( aScrollDelay );
  3281     }
  3480     }
  3282 
  3481 
  3283 
  3482 
  3284 EXPORT_C void CFormattedCellListBoxData::SetSubCellIconSize(TInt aIndex, TSize aSize)
  3483 EXPORT_C void CFormattedCellListBoxData::SetSubCellIconSize(TInt aIndex, TSize aSize)
  3285     {
  3484     {
  3286     if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0)
  3485     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  3486     if ( aIndex <= KMaxSubCellIndex && aIndex >= 0)
  3287         {
  3487         {
  3288         iExtension->iSubCellIconSize[aIndex] = aSize;
  3488         iExtension->iSubCellIconSize[aIndex] = aSize;
  3289         }
  3489         }
  3290     }
  3490     }
  3291 
  3491 
  3292 TSize CFormattedCellListBoxData::GetSubCellIconSize(TInt aIndex)
  3492 TSize CFormattedCellListBoxData::GetSubCellIconSize(TInt aIndex)
  3293     {
  3493     {
  3294     if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0)
  3494     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  3495     if ( aIndex <= KMaxSubCellIndex && aIndex >= 0)
  3295         {
  3496         {
  3296         return iExtension->iSubCellIconSize[aIndex];
  3497         return iExtension->iSubCellIconSize[aIndex];
  3297         }
  3498         }
  3298     return TSize(0,0);
  3499     return TSize(0,0);
  3299     }
  3500     }
  3358     }
  3559     }
  3359 
  3560 
  3360 // extended skin support
  3561 // extended skin support
  3361 void CFormattedCellListBoxData::SetESSTextColor( TAknsQsnTextColorsIndex aIndex )
  3562 void CFormattedCellListBoxData::SetESSTextColor( TAknsQsnTextColorsIndex aIndex )
  3362     {
  3563     {
       
  3564     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  3565     
  3363     TRgb color;
  3566     TRgb color;
  3364     
  3567     
  3365     TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  3568     TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  3366                                             color,
  3569                                             color,
  3367                                             KAknsIIDQsnTextColors,
  3570                                             KAknsIIDQsnTextColors,
  3374 
  3577 
  3375 
  3578 
  3376 // extended skin support
  3579 // extended skin support
  3377 void CFormattedCellListBoxData::SetESSHighlightedTextColor( TAknsQsnTextColorsIndex aIndex )
  3580 void CFormattedCellListBoxData::SetESSHighlightedTextColor( TAknsQsnTextColorsIndex aIndex )
  3378     {
  3581     {
       
  3582     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3379     TRgb color;
  3583     TRgb color;
  3380     
  3584     
  3381     TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  3585     TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  3382                                             color,
  3586                                             color,
  3383                                             KAknsIIDQsnTextColors,
  3587                                             KAknsIIDQsnTextColors,
  3390 
  3594 
  3391 
  3595 
  3392 void CFormattedCellListBoxData::SetGraphicSubCellL( TInt aSubCell,
  3596 void CFormattedCellListBoxData::SetGraphicSubCellL( TInt aSubCell,
  3393                                                     const TAknWindowLineLayout &aGraphicLayout )
  3597                                                     const TAknWindowLineLayout &aGraphicLayout )
  3394     {
  3598     {
  3395     if ( !iExtension ) return;
  3599     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3396     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3600     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3397     // this does happen with caknsetstyle, caknform(wide)style lists.
  3601     // this does happen with caknsetstyle, caknform(wide)style lists.
  3398     // eventually they'll get here again with list!=0, so this check is enough
  3602     // eventually they'll get here again with list!=0, so this check is enough
  3399     if ( !list ) return;  
  3603     if ( !list ) return;  
  3400     
  3604     
  3401     TInt index = 0;
  3605     TInt index = 0;
  3402     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3606     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3403     iExtension->AtSL(index).iTextLayout=NULL;
  3607     iExtension->SLAt(index).iTextLayout=NULL;
  3404     iExtension->AtSL(index).iGraphicLayout=aGraphicLayout;
  3608     iExtension->SLAt(index).iGraphicLayout=aGraphicLayout;
  3405     iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic;
  3609     iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic;
  3406 
  3610 
  3407     // For compabitility - needed at least for text wrapping.
  3611     // For compabitility - needed at least for text wrapping.
  3408     // Beware - some of these WILL be overriden if you got here trough
  3612     // Beware - some of these WILL be overriden if you got here trough
  3409     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3613     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3410     // & friends.
  3614     // & friends.
  3439     }
  3643     }
  3440 
  3644 
  3441 void CFormattedCellListBoxData::SetTextSubCellL( TInt aSubCell,
  3645 void CFormattedCellListBoxData::SetTextSubCellL( TInt aSubCell,
  3442                                                  const TAknTextLineLayout &aTextLayout )
  3646                                                  const TAknTextLineLayout &aTextLayout )
  3443     {
  3647     {
  3444     if (!iExtension) return;
  3648     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3445     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3649     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3446     // this does happen with caknsetstyle, caknform(wide)style lists.
  3650     // this does happen with caknsetstyle, caknform(wide)style lists.
  3447     // eventually they'll get here again with list!=0, so this check is enough
  3651     // eventually they'll get here again with list!=0, so this check is enough
  3448     if ( !list ) return;  
  3652     if ( !list ) return;  
  3449 
  3653 
  3450     TInt index = 0;
  3654     TInt index = 0;
  3451     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3655     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3452     iExtension->AtSL(index).iTextLayout=aTextLayout;
  3656     iExtension->SLAt(index).iTextLayout=aTextLayout;
  3453     iExtension->AtSL(index).iGraphicLayout=NULL;
  3657     iExtension->SLAt(index).iGraphicLayout=NULL;
  3454     iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText;
  3658     iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText;
  3455 
  3659 
  3456     
  3660     
  3457     // For compabitility - needed at least for text wrapping.
  3661     // For compabitility - needed at least for text wrapping.
  3458     // Beware - some of these WILL be overriden if you got here trough
  3662     // Beware - some of these WILL be overriden if you got here trough
  3459     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3663     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3492 
  3696 
  3493 void CFormattedCellListBoxData::SetConditionalSubCellL(TInt aSubCell,
  3697 void CFormattedCellListBoxData::SetConditionalSubCellL(TInt aSubCell,
  3494                                                        const TAknTextLineLayout &aTextLayout,
  3698                                                        const TAknTextLineLayout &aTextLayout,
  3495                                                        TInt aAffectedSubCell)  
  3699                                                        TInt aAffectedSubCell)  
  3496     {
  3700     {
       
  3701     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3497     // iConditionValue of affected subcell (=text subcell, which has different layouts)
  3702     // iConditionValue of affected subcell (=text subcell, which has different layouts)
  3498     // contains index of graphical subcell, which existence should be checked first.
  3703     // contains index of graphical subcell, which existence should be checked first.
  3499     // This graphical subcell has in iConditionValue index of graphical subcell,
  3704     // This graphical subcell has in iConditionValue index of graphical subcell,
  3500     // which existence should be checked second etc. Each graphical subcell can
  3705     // which existence should be checked second etc. Each graphical subcell can
  3501     // affect only to 1 text subcell (or none).
  3706     // affect only to 1 text subcell (or none).
  3502 
  3707 
  3503     // for compabitility - needed at least for text wrapping
  3708     // for compabitility - needed at least for text wrapping
  3504     SetNotAlwaysDrawnSubCellL( aSubCell, ETrue );
  3709     SetNotAlwaysDrawnSubCellL( aSubCell, ETrue );
  3505 
  3710 
  3506     if (!iExtension) return;
       
  3507 
       
  3508     TInt i = 0x01;
  3711     TInt i = 0x01;
  3509     i = i << aSubCell;
  3712     i = i << aSubCell;
  3510     iExtension->iConditionalCells = iExtension->iConditionalCells | i;
  3713     iExtension->iConditionalCells = iExtension->iConditionalCells | i;
  3511 
  3714 
  3512     TInt graphicalIndex = 0;
  3715     TInt graphicalIndex = 0;
  3513     if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found
  3716     if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found
  3514     // conditional layoutline can be only added to graphical subcells
  3717     // conditional layoutline can be only added to graphical subcells
  3515     if (iExtension->AtSL(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3718     if (iExtension->SLAt(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3516     
  3719     
  3517     TInt textIndex = 0; // index of affected subcell
  3720     TInt textIndex = 0; // index of affected subcell
  3518     if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found
  3721     if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found
  3519     // affected subcell can only be text subcell
  3722     // affected subcell can only be text subcell
  3520     if (iExtension->AtSL(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3723     if (iExtension->SLAt(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3521     
  3724     
  3522     TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain
  3725     TInt gSC = iExtension->SLAt(textIndex).iConditionValue; // text subcell to be added in priority chain
  3523 
  3726 
  3524     while (gSC > -1)
  3727     while (gSC > -1)
  3525         {
  3728         {
  3526         if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found
  3729         if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found
  3527         gSC = iExtension->AtSL(textIndex).iConditionValue;
  3730         gSC = iExtension->SLAt(textIndex).iConditionValue;
  3528         }
  3731         }
  3529     iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain
  3732     iExtension->SLAt(textIndex).iConditionValue = aSubCell; // add next subcell to chain
  3530     iExtension->AtSL(graphicalIndex).iTextLayout=aTextLayout;
  3733     iExtension->SLAt(graphicalIndex).iTextLayout=aTextLayout;
  3531 
  3734 
  3532     iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) );
  3735     iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) );
  3533     
  3736     
  3534     TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) );
  3737     TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) );
  3535     if ( iExtension->iMarginRect == TRect::EUninitialized )
  3738     if ( iExtension->iMarginRect == TRect::EUninitialized )
  3538         }
  3741         }
  3539     else
  3742     else
  3540         {
  3743         {
  3541         iExtension->iMarginRect.BoundingRect( r );
  3744         iExtension->iMarginRect.BoundingRect( r );
  3542         }
  3745         }
       
  3746 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3543     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3747     CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3544 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3545     MAknListBoxTfxInternal* transApi =
  3748     MAknListBoxTfxInternal* transApi =
  3546         CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
  3749         CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
  3547     if ( transApi )
  3750     if ( transApi )
  3548         {
  3751         {
  3549         transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, iExtension->iMarginRect.iTl );
  3752         transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, iExtension->iMarginRect.iTl );
  3559 // CFormattedCellListBoxData::UsesScalableLayoutData
  3762 // CFormattedCellListBoxData::UsesScalableLayoutData
  3560 // -----------------------------------------------------------------------------
  3763 // -----------------------------------------------------------------------------
  3561 //
  3764 //
  3562 TBool CFormattedCellListBoxData::UsesScalableLayoutData() const
  3765 TBool CFormattedCellListBoxData::UsesScalableLayoutData() const
  3563     {
  3766     {
  3564     if (iExtension)
  3767     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3565         return iExtension->iSimpleList;
  3768     return iExtension->iSimpleList;
  3566 
       
  3567     return EFalse;
       
  3568     }
  3769     }
  3569 void CFormattedCellListBoxData::UseScalableLayoutData( TBool aUse )
  3770 void CFormattedCellListBoxData::UseScalableLayoutData( TBool aUse )
  3570     {
  3771     {
  3571     if ( iExtension )
  3772     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3572         {
  3773     if ( !aUse && iExtension->iSimpleList )
  3573         if ( !aUse && iExtension->iSimpleList )
  3774         {
  3574             {
       
  3575 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3775 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3576             CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3776         CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
  3577             MAknListBoxTfxInternal* transApi =
  3777         MAknListBoxTfxInternal* transApi =
  3578                 CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
  3778             CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
  3579             if ( transApi )
  3779         if ( transApi )
  3580                 {
  3780             {
  3581                 transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
  3781             transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
  3582                 transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
  3782             transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
  3583                 }
  3783             }
  3584 #endif
  3784 #endif
  3585             }
  3785         }
  3586         iExtension->iSimpleList = aUse;
  3786     iExtension->iSimpleList = aUse;
  3587         }
       
  3588     }
  3787     }
  3589 
  3788 
  3590 EXPORT_C void CFormattedCellListBoxData::SetSubcellUnderlined( TBitFlags32 aUnderlinedCells )
  3789 EXPORT_C void CFormattedCellListBoxData::SetSubcellUnderlined( TBitFlags32 aUnderlinedCells )
  3591     {
  3790     {
  3592     if ( iExtension )
  3791     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3593         {
  3792     iExtension->iUnderlineFlagSet = ETrue;
  3594         iExtension->iUnderlineFlagSet = ETrue;
  3793     iExtension->iUnderlineFlags   = aUnderlinedCells;
  3595         iExtension->iUnderlineFlags   = aUnderlinedCells;
       
  3596         }
       
  3597     }
  3794     }
  3598 
  3795 
  3599 void CFormattedCellListBoxData::SetUnderlineStyle( TListItemProperties aProperties,
  3796 void CFormattedCellListBoxData::SetUnderlineStyle( TListItemProperties aProperties,
  3600                                                    CWindowGc& aGc,
  3797                                                    CWindowGc& aGc,
  3601                                                    TInt aSubCell ) const
  3798                                                    TInt aSubCell ) const
  3602     {
  3799     {
  3603     if ( !iExtension )
  3800     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3604         {
       
  3605         return;
       
  3606         }
       
  3607 
       
  3608     if ( !iExtension->iUnderlineFlagSet )
  3801     if ( !iExtension->iUnderlineFlagSet )
  3609         {
  3802         {
  3610         // underlining is already either on or off and
  3803         // underlining is already either on or off and
  3611         // hardcoded off turning will ensure old style
  3804         // hardcoded off turning will ensure old style
  3612         // behaviour
  3805         // behaviour
  3625         }
  3818         }
  3626     }
  3819     }
  3627 
  3820 
  3628 void CFormattedCellListBoxData::UseHighlightIconSwapping( TBool aUse )
  3821 void CFormattedCellListBoxData::UseHighlightIconSwapping( TBool aUse )
  3629     {
  3822     {
  3630     if ( iExtension )
  3823     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3631         {
  3824     iExtension->iUseHighligthIconSwapping = aUse;
  3632         iExtension->iUseHighligthIconSwapping = aUse;
       
  3633         }
       
  3634     }
  3825     }
  3635 
  3826 
  3636 TBool CFormattedCellListBoxData::UseHighlightIconSwapping() const
  3827 TBool CFormattedCellListBoxData::UseHighlightIconSwapping() const
  3637     {
  3828     {
  3638     if ( iExtension )
  3829     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3639         {
  3830     return iExtension->iUseHighligthIconSwapping;
  3640         return iExtension->iUseHighligthIconSwapping;
       
  3641         }
       
  3642     return EFalse;
       
  3643     }
  3831     }
  3644 
  3832 
  3645 // -----------------------------------------------------------------------------
  3833 // -----------------------------------------------------------------------------
  3646 // CFormattedCellListBoxData::SetStretchableGraphicSubCellL
  3834 // CFormattedCellListBoxData::SetStretchableGraphicSubCellL
  3647 // -----------------------------------------------------------------------------
  3835 // -----------------------------------------------------------------------------
  3693     const TAknTextComponentLayout& aNormalLayout,
  3881     const TAknTextComponentLayout& aNormalLayout,
  3694     const TAknTextComponentLayout& aStretchedLayout,
  3882     const TAknTextComponentLayout& aStretchedLayout,
  3695     TInt aNormalSubCell,
  3883     TInt aNormalSubCell,
  3696     TInt aStretchedSubCell )
  3884     TInt aStretchedSubCell )
  3697     {
  3885     {
       
  3886     _AKNTRACE_FUNC_ENTER;
  3698     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
  3887     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
  3699          Layout_Meta_Data::IsListStretchingEnabled() &&
  3888          Layout_Meta_Data::IsListStretchingEnabled() &&
  3700          StretchingEnabled() )
  3889          StretchingEnabled() )
  3701         {
  3890         {
       
  3891         _AKNTRACE("Layout_Meta_Data::IsListStretchingEnabled");
  3702         SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell );
  3892         SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell );
  3703         }
  3893         }
  3704     else
  3894     else
  3705         {
  3895         {
  3706         SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell );
  3896         SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell );
  3707         }
  3897         }
       
  3898     _AKNTRACE_FUNC_EXIT;
  3708     }
  3899     }
  3709 
  3900 
  3710 
  3901 
  3711 // -----------------------------------------------------------------------------
  3902 // -----------------------------------------------------------------------------
  3712 // CFormattedCellListBoxData::ResetSLSubCellArray
  3903 // CFormattedCellListBoxData::ResetSLSubCellArray
  3713 // -----------------------------------------------------------------------------
  3904 // -----------------------------------------------------------------------------
  3714 //
  3905 //
  3715 void CFormattedCellListBoxData::ResetSLSubCellArray()
  3906 void CFormattedCellListBoxData::ResetSLSubCellArray()
  3716     {
  3907     {
  3717     if ( !iExtension )
  3908     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3718         {
       
  3719         return;
       
  3720         }
       
  3721 
       
  3722     iExtension->iMarginRect = TRect::EUninitialized;
  3909     iExtension->iMarginRect = TRect::EUninitialized;
  3723 
  3910 
  3724     UseScalableLayoutData( EFalse );
  3911     UseScalableLayoutData( EFalse );
  3725     iExtension->ResetSLSubCellArray();        
  3912     iExtension->ResetSLSubCellArray();        
  3726     // This function gets called always when size changes, so here is called
  3913     // This function gets called always when size changes, so here is called
  3734 // -----------------------------------------------------------------------------
  3921 // -----------------------------------------------------------------------------
  3735 //
  3922 //
  3736 TBool CFormattedCellListBoxData::StretchingEnabled() const
  3923 TBool CFormattedCellListBoxData::StretchingEnabled() const
  3737     {
  3924     {
  3738 #ifdef RD_LIST_STRETCH    
  3925 #ifdef RD_LIST_STRETCH    
  3739     if ( !iExtension )
  3926     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));        
  3740         {
       
  3741         return EFalse;
       
  3742         }
       
  3743         
       
  3744     return iExtension->iStretchingEnabled;
  3927     return iExtension->iStretchingEnabled;
  3745 #else
  3928 #else
  3746     return EFalse;
  3929     return EFalse;
  3747 #endif // #ifdef RD_LIST_STRETCH        
  3930 #endif // #ifdef RD_LIST_STRETCH        
  3748     }
  3931     }
  3752 // CFormattedCellListBoxData::EnableStretching
  3935 // CFormattedCellListBoxData::EnableStretching
  3753 // -----------------------------------------------------------------------------
  3936 // -----------------------------------------------------------------------------
  3754 //
  3937 //
  3755 void CFormattedCellListBoxData::EnableStretching( const TBool aEnabled )
  3938 void CFormattedCellListBoxData::EnableStretching( const TBool aEnabled )
  3756     {
  3939     {
  3757     if ( !iExtension )
  3940     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));        
  3758         {
       
  3759         return;
       
  3760         }
       
  3761         
       
  3762     iExtension->iStretchingEnabled = aEnabled;        
  3941     iExtension->iStretchingEnabled = aEnabled;        
  3763     }
  3942     }
  3764 
  3943 
  3765 // -----------------------------------------------------------------------------
  3944 // -----------------------------------------------------------------------------
  3766 // CFormattedCellListBoxData::HideSecondRow
  3945 // CFormattedCellListBoxData::HideSecondRow
  3767 // -----------------------------------------------------------------------------
  3946 // -----------------------------------------------------------------------------
  3768 //
  3947 //
  3769 void CFormattedCellListBoxData::HideSecondRow( const TBool aHide )
  3948 void CFormattedCellListBoxData::HideSecondRow( const TBool aHide )
  3770     {
  3949     {
  3771     if ( !iExtension )
  3950     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));        
  3772         {
       
  3773         return;
       
  3774         }
       
  3775         
       
  3776     iExtension->iHideSecondRow = aHide;        
  3951     iExtension->iHideSecondRow = aHide;        
  3777     }
  3952     }
  3778 #endif // RD_LIST_STRETCH
  3953 #endif // RD_LIST_STRETCH
  3779 
  3954 
  3780 // -----------------------------------------------------------------------------
  3955 // -----------------------------------------------------------------------------
  3781 // CFormattedCellListBoxData::SecondRowHidden
  3956 // CFormattedCellListBoxData::SecondRowHidden
  3782 // -----------------------------------------------------------------------------
  3957 // -----------------------------------------------------------------------------
  3783 //
  3958 //
  3784 TBool CFormattedCellListBoxData::SecondRowHidden() const
  3959 TBool CFormattedCellListBoxData::SecondRowHidden() const
  3785     {
  3960     {
  3786     if ( !iExtension )
  3961     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));        
  3787         {
       
  3788         return EFalse;
       
  3789         }
       
  3790         
       
  3791     return iExtension->iHideSecondRow;        
  3962     return iExtension->iHideSecondRow;        
  3792     }
  3963     }
  3793 
  3964 
  3794 // -----------------------------------------------------------------------------
  3965 // -----------------------------------------------------------------------------
  3795 // CFormattedCellListBoxData::ToggleDropShadows
  3966 // CFormattedCellListBoxData::ToggleDropShadows
  3796 // -----------------------------------------------------------------------------
  3967 // -----------------------------------------------------------------------------
  3797 //
  3968 //
  3798 void CFormattedCellListBoxData::ToggleDropShadows( const TBool aEnable )
  3969 void CFormattedCellListBoxData::ToggleDropShadows( const TBool aEnable )
  3799     {
  3970     {
  3800     if ( !iExtension )
  3971     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3801         {
       
  3802         return;
       
  3803         }
       
  3804     iExtension->iUseDropShadows = aEnable;
  3972     iExtension->iUseDropShadows = aEnable;
  3805     }
  3973     }
  3806 
  3974 
  3807 // -----------------------------------------------------------------------------
  3975 // -----------------------------------------------------------------------------
  3808 // CFormattedCellListBoxData::CheckIfSubCellsIntersect
  3976 // CFormattedCellListBoxData::CheckIfSubCellsIntersect
  3812     TAknTextLineLayout* aLayouts, 
  3980     TAknTextLineLayout* aLayouts, 
  3813     TBool* aResults, 
  3981     TBool* aResults, 
  3814     const TDesC& aText, 
  3982     const TDesC& aText, 
  3815     const TRect& aItemRect ) const
  3983     const TRect& aItemRect ) const
  3816     {
  3984     {
       
  3985     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3817     TInt subCell = 0;
  3986     TInt subCell = 0;
  3818     TInt subCell2;
  3987     TInt subCell2;
  3819     TInt subCellIndex;
  3988     TInt subCellIndex;
  3820     TInt subCellIndex2;
  3989     TInt subCellIndex2;
  3821     TInt lastSubCell = Min( KMaxSubCellIndex, LastSubCell() );
  3990     TInt lastSubCell = Min( KMaxSubCellIndex, LastSubCell() );
  3895                 }
  4064                 }
  3896             }
  4065             }
  3897             
  4066             
  3898         if ( aResults[subCell] )
  4067         if ( aResults[subCell] )
  3899             {
  4068             {
  3900             if ( iExtension->AtSL( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText )
  4069             if ( iExtension->SLAt( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText )
  3901                 {
  4070                 {
  3902                 TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout;
  4071                 TAknTextLineLayout textLine = iExtension->SLAt( subCellIndex ).iTextLayout;
  3903                 
  4072                 
  3904                 textLine.iW = bRect.Width();
  4073                 textLine.iW = bRect.Width();
  3905 
  4074 
  3906                 if ( !AknLayoutUtils::LayoutMirrored() )
  4075                 if ( !AknLayoutUtils::LayoutMirrored() )
  3907                     {
  4076                     {
  3924 // CFormattedCellListBoxData::SubCellsMightIntersect
  4093 // CFormattedCellListBoxData::SubCellsMightIntersect
  3925 // -----------------------------------------------------------------------------
  4094 // -----------------------------------------------------------------------------
  3926 //
  4095 //
  3927 void CFormattedCellListBoxData::SubCellsMightIntersect( const TBool aMightIntersect )
  4096 void CFormattedCellListBoxData::SubCellsMightIntersect( const TBool aMightIntersect )
  3928     {
  4097     {
       
  4098     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  3929     iExtension->iSubCellsMightIntersect = aMightIntersect;
  4099     iExtension->iSubCellsMightIntersect = aMightIntersect;
  3930     }
  4100     }
  3931 
  4101 
  3932 
  4102 
  3933 void CFormattedCellListBoxDataExtension::CreateColorBitmapsL( )
  4103 void CFormattedCellListBoxDataExtension::CreateColorBitmapsL( )
  4023     CleanupStack::PopAndDestroy( fbsBitGc );
  4193     CleanupStack::PopAndDestroy( fbsBitGc );
  4024     _AKNTRACE_FUNC_EXIT;
  4194     _AKNTRACE_FUNC_EXIT;
  4025     }
  4195     }
  4026 
  4196 
  4027 
  4197 
       
  4198 struct TCellInfo
       
  4199     {
       
  4200     TBool iTextNull;
       
  4201     TPtrC iTextPtr;
       
  4202     };
       
  4203 
  4028 void 
  4204 void 
  4029 CFormattedCellListBoxData::DrawFormattedOld( TListItemProperties& aProperties,
  4205 CFormattedCellListBoxData::DrawFormattedOld( TListItemProperties& aProperties,
  4030                                              CWindowGc& aGc,
  4206                                              CWindowGc& aGc,
  4031                                              const TDesC* aText,
  4207                                              const TDesC* aText,
  4032                                              const TRect& aItemRect,
  4208                                              const TRect& aItemRect,
  4033                                              TBool aHighlight,
  4209                                              TBool aHighlight,
  4034                                              const TColors& aColors ) const
  4210                                              const TColors& aColors ) const
  4035     {
  4211     {
  4036     _AKNTRACE_FUNC_ENTER;
  4212     _AKNTRACE_FUNC_ENTER;
  4037     TRect aRect(aItemRect);
  4213     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  4038     const TColors *subcellColors = &aColors;
  4214     _AKNTRACE( "DrawFormattedOld: aText=%S, aItemRect=(%d,%d,%d,%d)",
  4039     
  4215                aText, aItemRect.iTl.iX,
  4040     TInt lastSubCell=LastSubCell();
  4216                aItemRect.iTl.iY,
  4041     if (lastSubCell==KErrNotFound)
  4217                aItemRect.iBr.iX, 
  4042         {
  4218                aItemRect.iBr.iY );
  4043         aGc.UseFont(CEikonEnv::Static()->NormalFont());
  4219 
  4044         aGc.DrawText(TPtrC(),aRect,0); // use draw text so that don't need to change pen color/style
  4220     TRect itemRect( aItemRect );
       
  4221     
       
  4222     TInt lastSubCell = LastSubCell();
       
  4223     if ( lastSubCell == KErrNotFound )
       
  4224         {
       
  4225         aGc.UseFont( CEikonEnv::Static()->NormalFont() );
       
  4226         // Use draw text so that there's no need to change pen color/style.
       
  4227         aGc.DrawText( TPtrC(), itemRect, 0 );
  4045         aGc.DiscardFont(); // Release the font cache
  4228         aGc.DiscardFont(); // Release the font cache
       
  4229         _AKNTRACE_FUNC_EXIT;
  4046         return;
  4230         return;
  4047         }
  4231         }
       
  4232     
       
  4233     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
       
  4234     
       
  4235     DrawMarkingModeIcons( aProperties, aGc, itemRect );
       
  4236     TInt iconOffset = aItemRect.Width() - itemRect.Width();
       
  4237     
       
  4238     const TColors* subcellColors = &aColors;
       
  4239     
  4048     const CFont* font=SubCellFont(0);
  4240     const CFont* font=SubCellFont(0);
  4049     if (font==NULL)
  4241     if (font==NULL)
  4050         {
  4242         {
  4051         font=CEikonEnv::Static()->NormalFont();
  4243         font=CEikonEnv::Static()->NormalFont();
  4052         }
  4244         }
  4053     
  4245     
  4054     TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels());
  4246     TRect textRect( itemRect );
  4055     TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels();
  4247     textRect.iBr.iX = itemRect.iTl.iX;
  4056     TRect textRect=aRect;
       
  4057     textRect.iBr.iX=aRect.iTl.iX;
       
  4058     TInt subcell=0;
  4248     TInt subcell=0;
  4059     TInt subcell2=0;
  4249     TInt subcell2=0;
  4060     TPtrC text;
  4250 
  4061     TBool textNull[30];
  4251     TCellInfo textNull[30];
  4062     TRgb bmpBackColor, bmpForeColor;
       
  4063     TRect textShadowRect;           // For transparent list
  4252     TRect textShadowRect;           // For transparent list
  4064     TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215);    // Black shadow for item text.
  4253     TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215);    // Black shadow for item text.
  4065 
  4254 
  4066     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
       
  4067     TBool layoutMirrored = AknLayoutUtils::LayoutMirrored();
  4255     TBool layoutMirrored = AknLayoutUtils::LayoutMirrored();
  4068     TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
  4256     TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
  4069     
  4257     
  4070     if (!cc)
       
  4071         {
       
  4072         cc = SkinBackgroundContext();
       
  4073         }
       
  4074 
       
  4075     Mem::FillZ( textNull, sizeof( textNull ) );
       
  4076 
  4258 
  4077     // cache the text states.
  4259     // cache the text states.
  4078     subcell = 0;
  4260     subcell = 0;
       
  4261     
       
  4262     SSubCell defaultCell;
       
  4263     TMargins tm = {0,0,0,0};
       
  4264     defaultCell.iPosition = TPoint(0,0);
       
  4265     defaultCell.iSize = TSize(0,0);
       
  4266     defaultCell.iRealSize = TSize(0,0);
       
  4267     defaultCell.iRealTextSize = TSize(0,0);
       
  4268     defaultCell.iMargin = tm;
       
  4269     defaultCell.iUseSubCellColors = EFalse;
       
  4270     defaultCell.iColors = defaultcolors;
       
  4271     defaultCell.iGraphics = EFalse;
       
  4272     defaultCell.iAlign = CGraphicsContext::ELeft;
       
  4273     defaultCell.iBaseline = 0;
       
  4274     defaultCell.iNumberCell = EFalse;
       
  4275     defaultCell.iTextClipGap = 0;
       
  4276     defaultCell.iNotAlwaysDrawn = EFalse;
       
  4277     defaultCell.iTransparent = EFalse;
       
  4278     defaultCell.iBaseFont = 0;
       
  4279     SSubCell* sc;
       
  4280     
       
  4281     
  4079     for(;;)
  4282     for(;;)
  4080         {
  4283         {
  4081         if (subcell>lastSubCell)
  4284         if (subcell>lastSubCell)
  4082             {
  4285             {
  4083             break;
  4286             break;
  4084             }
  4287             }
  4085         
  4288         
  4086         TextUtils::ColumnText(text,subcell, aText);
  4289         TInt subcellindex = 0;
  4087         if (text == KNullDesC && SubCellIsNotAlwaysDrawn(subcell))
  4290         TInt subcellfound = 0;
  4088             {
  4291         subcellfound = FindSubCellIndex(subcellindex,subcell);
  4089             textNull[subcell] = ETrue;
  4292         if (subcellfound != KErrNotFound)
       
  4293             {
       
  4294             sc = &(iSubCellArray->At(subcellindex));
       
  4295             }
       
  4296         else
       
  4297             {
       
  4298             sc = &defaultCell;
       
  4299             }
       
  4300         
       
  4301         TextUtils::ColumnText(textNull[subcell].iTextPtr,subcell, aText);
       
  4302         
       
  4303         if (textNull[subcell].iTextPtr == KNullDesC && sc->iNotAlwaysDrawn)
       
  4304             {
       
  4305             textNull[subcell].iTextNull = ETrue;
       
  4306             }
       
  4307         else
       
  4308             {
       
  4309             textNull[subcell].iTextNull = EFalse;
  4090             }
  4310             }
  4091 
  4311 
  4092         subcell++;
  4312         subcell++;
  4093         }
  4313         }
  4094     
  4314     
  4100         if (subcell>lastSubCell)
  4320         if (subcell>lastSubCell)
  4101             {
  4321             {
  4102             break;
  4322             break;
  4103             }
  4323             }
  4104         
  4324         
  4105         if (textNull[subcell])
  4325         if (textNull[subcell].iTextNull)
  4106             {
  4326             {
  4107             ++subcell;
  4327             ++subcell;
  4108             continue;
  4328             continue;
  4109             }
  4329             }
  4110         
  4330         
  4111         TRect bRect(SubCellPosition(subcell),SubCellSize(subcell));
  4331         TInt subcellindex = 0;
  4112         TMargins m(SubCellMargins(subcell));
  4332         TInt subcellfound = 0;
  4113         TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
  4333         subcellfound = FindSubCellIndex(subcellindex,subcell);
       
  4334         if (subcellfound != KErrNotFound)
       
  4335             {
       
  4336             sc = &(iSubCellArray->At(subcellindex));
       
  4337             }
       
  4338         else
       
  4339             {
       
  4340             sc = &defaultCell;
       
  4341             }
  4114         
  4342         
  4115         for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) 
  4343         TRect bRect = TRect(sc->iPosition,sc->iSize);
  4116             {
  4344         bRect.iBr.iX -= iconOffset;
  4117             if (textNull[subcell2])
  4345         TMargins m = sc->iMargin;
       
  4346         TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
       
  4347         const TBool istrans = sc->iTransparent;
       
  4348         if (!layoutMirrored)
       
  4349             {
       
  4350             for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) 
  4118                 {
  4351                 {
  4119                 continue;
  4352                 if (textNull[subcell2].iTextNull)
  4120                 }
  4353                     {
  4121             
  4354                     continue;
  4122             // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing!
  4355                     }
  4123             TRect bRect2 = TRect(SubCellPosition(subcell2),SubCellSize(subcell2));
  4356                 
  4124             if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !SubCellIsTransparent(subcell) && !SubCellIsTransparent(subcell2)) 
  4357                 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing!
  4125                 {
  4358                 TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) );
  4126                 if (!layoutMirrored)
  4359                 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) 
  4127                     {
  4360                     {
  4128                     cRect.iBr.iX = bRect2.iTl.iX;
  4361                     cRect.iBr.iX = bRect2.iTl.iX;
  4129                     bRect.iBr.iX = bRect2.iTl.iX;
  4362                     bRect.iBr.iX = bRect2.iTl.iX;
  4130                     }
  4363                     }
  4131                 else
  4364                 }
       
  4365             }
       
  4366         else
       
  4367             {
       
  4368             for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) 
       
  4369                 {
       
  4370                 if (textNull[subcell2].iTextNull)
       
  4371                     {
       
  4372                     continue;
       
  4373                     }
       
  4374                 
       
  4375                 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing!
       
  4376                 TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) );
       
  4377                 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) 
  4132                     {
  4378                     {
  4133                     cRect.iTl.iX = bRect2.iBr.iX;
  4379                     cRect.iTl.iX = bRect2.iBr.iX;
  4134                     bRect.iTl.iX = bRect2.iBr.iX;
  4380                     bRect.iTl.iX = bRect2.iBr.iX;
  4135                     }
  4381                     }
  4136                 }
  4382                 }
  4137             }
  4383             }
  4138         SetSubCellRealTextSize(subcell, cRect.Size());
  4384         SetSubCellRealTextSize(subcell, cRect.Size());
  4139         SetSubCellRealSize(subcell, bRect.Size());
  4385         SetSubCellRealSize(subcell, bRect.Size());
       
  4386         sc->iRealTextSize = cRect.Size();
       
  4387         sc->iRealSize = bRect.Size();
  4140         subcell++;
  4388         subcell++;
  4141         }
  4389         }
  4142     
  4390     
  4143     // This loop does the drawing.    
  4391     // This loop does the drawing.    
  4144     aGc.SetPenStyle(CGraphicsContext::ENullPen);
  4392     aGc.SetPenStyle(CGraphicsContext::ENullPen);
  4148         if (subcell>lastSubCell)
  4396         if (subcell>lastSubCell)
  4149             {
  4397             {
  4150             break;
  4398             break;
  4151             }
  4399             }
  4152         
  4400         
  4153         if (textNull[subcell])
  4401         if (textNull[subcell].iTextNull)
  4154             {
  4402             {
  4155             ++ subcell;
  4403             ++ subcell;
  4156             continue;
  4404             continue;
  4157             }
  4405             }
  4158         
  4406         
       
  4407         
       
  4408         TInt subcellindex = 0;
       
  4409         TInt subcellfound = 0;
       
  4410         subcellfound = FindSubCellIndex(subcellindex,subcell);
       
  4411         if (subcellfound != KErrNotFound)
       
  4412             {
       
  4413             sc = &(iSubCellArray->At(subcellindex));
       
  4414             }
       
  4415         else
       
  4416             {
       
  4417             sc = &defaultCell;
       
  4418             }
       
  4419         
  4159         // SetPosition, SetSize and margins support
  4420         // SetPosition, SetSize and margins support
  4160         TRect bRect(SubCellPosition(subcell),SubCellRealSize(subcell));
  4421         TRect bRect = TRect(sc->iPosition,sc->iRealSize);
  4161         TMargins m(SubCellMargins(subcell));
  4422         TMargins m = sc->iMargin;
  4162         TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),SubCellRealTextSize(subcell));
  4423         TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),sc->iRealTextSize);
  4163         
  4424         
  4164         
  4425         
  4165         if (bRect.iBr.iX == 0)
  4426         if (bRect.iBr.iX == 0)
  4166             {
  4427             {
  4167             ++subcell;
  4428             ++subcell;
  4168             continue;
  4429             continue;
  4169             }
  4430             }
  4170         
  4431         
  4171         if ( layoutMirrored ) 
  4432         if ( layoutMirrored ) 
  4172             {
  4433             {
  4173             TRect bRect = TRect(SubCellPosition(subcell),SubCellSize(subcell));
  4434             TRect bRect( sc->iPosition, sc->iSize );
  4174             TRect cRect2 = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
  4435             bRect.iBr.iX -= iconOffset;
       
  4436             TRect cRect2( bRect.iTl + TSize( m.iLeft, m.iTop ),
       
  4437                           bRect.Size() - TSize( m.iRight + m.iLeft,
       
  4438                                                 m.iBottom + m.iTop ) );
  4175             
  4439             
  4176             TInt shift = (cRect2.Size() - SubCellRealTextSize(subcell)).iWidth;
  4440             TInt shift = (cRect2.Size() - sc->iRealTextSize).iWidth;
  4177             cRect.iTl.iX += shift;
  4441             cRect.iTl.iX += shift;
  4178             cRect.iBr.iX += shift;
  4442             cRect.iBr.iX += shift;
  4179             }
  4443             }
  4180         
  4444         
  4181         textRect.SetRect(aItemRect.iTl+cRect.iTl,cRect.Size());
  4445         textRect = TRect( itemRect.iTl + cRect.iTl, cRect.Size() );
  4182         
  4446         
  4183         if (UseSubCellColors(subcell))
  4447         if (sc->iUseSubCellColors)
  4184             {
  4448             {
  4185             subcellColors = &SubCellColors(subcell);
  4449             subcellColors = &sc->iColors;
  4186             }
  4450             }
  4187         else
  4451         else
  4188             {
  4452             {
  4189             subcellColors = &aColors;
  4453             subcellColors = &aColors;
  4190             }
  4454             }
  4191 
  4455         CListBoxView* view = listbox->View();
       
  4456         TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor; 
  4192         if (aHighlight)
  4457         if (aHighlight)
  4193             {
  4458             {
  4194             aGc.SetPenColor(subcellColors->iHighlightedText);
  4459             aGc.SetPenColor(subcellColors->iHighlightedText);
  4195             aGc.SetBrushColor(subcellColors->iHighlightedBack); 
  4460             aGc.SetBrushColor(subcellColors->iHighlightedBack); 
  4196             bmpBackColor = subcellColors->iHighlightedBack;
  4461             if ( skinEnabled && !useOverrideColor )
  4197             bmpForeColor = subcellColors->iHighlightedText;
       
  4198             if ( skinEnabled && iExtension )
       
  4199                 {
  4462                 {
  4200                 if ( iExtension->iHighlightedTextColor != NULL )
  4463                 if ( iExtension->iHighlightedTextColor != NULL )
  4201                     {
  4464                     {
  4202                     aGc.SetPenColor( iExtension->iHighlightedTextColor );
  4465                     aGc.SetPenColor( iExtension->iHighlightedTextColor );
  4203                     bmpForeColor = iExtension->iHighlightedTextColor;
       
  4204                     }
  4466                     }
  4205                 }
  4467                 }
  4206             }
  4468             }
  4207         else
  4469         else
  4208             {
  4470             {
  4209             aGc.SetPenColor(subcellColors->iText);
  4471             aGc.SetPenColor(subcellColors->iText);
  4210             aGc.SetBrushColor(subcellColors->iBack);
  4472             aGc.SetBrushColor(subcellColors->iBack);
  4211             bmpBackColor = subcellColors->iBack;
       
  4212             bmpForeColor = subcellColors->iText;
       
  4213             
  4473             
  4214             if ( skinEnabled && iExtension )
  4474             if ( skinEnabled && !useOverrideColor )
  4215                 {
  4475                 {
  4216                 if ( iExtension->iTextColor != NULL )
  4476                 if ( iExtension->iTextColor != NULL )
  4217                     {
  4477                     {
  4218                     aGc.SetPenColor( iExtension->iTextColor );
  4478                     aGc.SetPenColor( iExtension->iTextColor );
  4219                     bmpForeColor = iExtension->iTextColor;
       
  4220                     }
  4479                     }
  4221                 }
  4480                 }
  4222             }
  4481             }
  4223         
  4482         
  4224         aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
  4483         aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
  4225         
  4484         
  4226         // The following draws subcells to textRect
  4485         // The following draws subcells to textRect
  4227         if (textRect.iBr.iX!=textRect.iTl.iX)
  4486         if (textRect.iBr.iX!=textRect.iTl.iX)
  4228             {
  4487             {          
  4229             TextUtils::ColumnText(text,subcell,aText);
       
  4230             
       
  4231             // graphics or text column
  4488             // graphics or text column
  4232             CGraphicsContext::TTextAlign align=SubCellAlignment(subcell);
  4489             CGraphicsContext::TTextAlign align=sc->iAlign;
  4233             if (!SubCellIsGraphics(subcell))
  4490             if (!sc->iGraphics)
  4234                 {
  4491                 {
  4235                 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  4492                 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  4236                 const CFont* cellFont=Font(aProperties, subcell);
  4493                 const CFont* cellFont=sc->iBaseFont;
  4237                 const CFont* tempFont=(cellFont) ? cellFont : font;
  4494                 const CFont* tempFont=(cellFont) ? cellFont : font;
  4238                 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  4495                 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  4239                 aGc.UseFont(usedFont);
  4496                 aGc.UseFont(usedFont);
  4240                 SetUnderlineStyle( aProperties, aGc, subcell );
  4497                 SetUnderlineStyle( aProperties, aGc, subcell );
  4241                 
  4498                 
  4242                 // baseline calc needed for each cell.
  4499                 // baseline calc needed for each cell.
  4243                 baseLineOffset = SubCellBaselinePos(subcell);
  4500                 TInt baseLineOffset = sc->iBaseline;
  4244                 baseLineOffset -= cRect.iTl.iY;
  4501                 baseLineOffset -= cRect.iTl.iY;
  4245                 if (!baseLineOffset)
  4502                 if (!baseLineOffset)
  4246                     {
  4503                     {
  4247                     baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels();
  4504                     baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels();
  4248                     }
  4505                     }
  4249                 
  4506                 
  4250                 TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf = 
  4507                 TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf;// = sc->iColumnText.Left(KMaxColumnDataLength);
  4251                     text.Left(KMaxColumnDataLength);
       
  4252                 
  4508                 
  4253                 // Note that this potentially modifies the text so its lenght in pixels
  4509                 // Note that this potentially modifies the text so its lenght in pixels
  4254                 // might increase. Therefore, this should always be done before
  4510                 // might increase. Therefore, this should always be done before
  4255                 // wrapping/clipping text. In some cases, WordWrapListItem is called
  4511                 // wrapping/clipping text. In some cases, WordWrapListItem is called
  4256                 // before coming here. Is it certain that it is not done for number subcells?
  4512                 // before coming here. Is it certain that it is not done for number subcells?
  4257                 if (SubCellIsNumberCell(subcell))
  4513                 TBool bufset = EFalse;
       
  4514                 if (sc->iNumberCell)
  4258                     {
  4515                     {
       
  4516                     clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength);
  4259                     AknTextUtils::LanguageSpecificNumberConversion(clipbuf);
  4517                     AknTextUtils::LanguageSpecificNumberConversion(clipbuf);
       
  4518                     bufset = ETrue;
  4260                     }
  4519                     }
  4261                 
  4520                 
  4262                 TBool clipped( EFalse );
  4521                 TBool clipped( EFalse );
  4263                 TInt clipgap = SubCellTextClipGap( subcell );
  4522                 TInt clipgap = sc->iTextClipGap;
  4264                 
  4523                 
  4265                 if ( iExtension->iUseLogicalToVisualConversion &&
  4524                 if ( iExtension->iUseLogicalToVisualConversion &&
  4266                      subcell != iExtension->iFirstWordWrappedSubcellIndex &&
  4525                      subcell != iExtension->iFirstWordWrappedSubcellIndex &&
  4267                      subcell != iExtension->iSecondWordWrappedSubcellIndex )
  4526                      subcell != iExtension->iSecondWordWrappedSubcellIndex )
  4268                     {
  4527                     {
  4269                     TInt maxClipWidth = textRect.Size().iWidth + clipgap;
  4528                     TInt maxClipWidth = textRect.Size().iWidth + clipgap;
  4270                     
  4529                 
  4271                     clipped = AknBidiTextUtils::ConvertToVisualAndClip(
  4530                     clipped = AknBidiTextUtils::ConvertToVisualAndClip(
  4272                         text.Left(KMaxColumnDataLength), 
  4531                         textNull[subcell].iTextPtr.Left(KMaxColumnDataLength), 
  4273                         clipbuf,
  4532                         clipbuf,
  4274                         *usedFont,
  4533                         *usedFont,
  4275                         textRect.Size().iWidth, 
  4534                         textRect.Width(), 
  4276                         maxClipWidth );
  4535                         maxClipWidth );
       
  4536                     }
       
  4537                 else if (!bufset)
       
  4538                     {
       
  4539                     clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength);
  4277                     }
  4540                     }
  4278                 
  4541                 
  4279                 if (clipped) 
  4542                 if (clipped) 
  4280                     {
  4543                     {
  4281                     if (!layoutMirrored)
  4544                     if (!layoutMirrored)
  4308                 CAknMarqueeControl* marquee =
  4571                 CAknMarqueeControl* marquee =
  4309                     subcell == 1 ? iExtension->iMarquee :
  4572                     subcell == 1 ? iExtension->iMarquee :
  4310                                    iExtension->i2ndLineMarquee;
  4573                                    iExtension->i2ndLineMarquee;
  4311                 
  4574                 
  4312                 TBool marqueeDisabled =
  4575                 TBool marqueeDisabled =
  4313                         static_cast<CEikListBox*>(
  4576                     listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
  4314                             Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
       
  4315                 
  4577                 
  4316                 if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled )
  4578                 if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled )
  4317                     {                    
  4579                     {                    
  4318                     // Let marquee know if it needs to do bidi conversion.
  4580                     // Let marquee know if it needs to do bidi conversion.
  4319                     marquee->UseLogicalToVisualConversion( clipped );
  4581                     marquee->UseLogicalToVisualConversion( clipped );
  4320                     
  4582                     
  4321                     if ( marquee->DrawText( aGc, textRect, text, baseLineOffset, align, *usedFont ) )
  4583                     if ( marquee->DrawText( aGc, textRect, textNull[subcell].iTextPtr, baseLineOffset, align, *usedFont ) )
  4322                         {
  4584                         {
  4323                         // All the loops have been executed -> the text needs to be truncated.
  4585                         // All the loops have been executed -> the text needs to be truncated.
  4324                         aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 );
  4586                         aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 );
  4325                         }
  4587                         }
  4326                     }
  4588                     }
  4363                 aGc.SetUnderlineStyle(EUnderlineOff);
  4625                 aGc.SetUnderlineStyle(EUnderlineOff);
  4364                 aGc.DiscardFont(); // Release the font cache
  4626                 aGc.DiscardFont(); // Release the font cache
  4365                 }
  4627                 }
  4366             else // Graphics subcell
  4628             else // Graphics subcell
  4367                 {
  4629                 {
  4368                 TLex lex(text);
  4630                 TLex lex(textNull[subcell].iTextPtr);
  4369                 TInt index;
  4631                 TInt index;
  4370                 __ASSERT_ALWAYS(lex.Val(index)==KErrNone,Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  4632                 __ASSERT_ALWAYS(lex.Val(index)==KErrNone,Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  4371                 __ASSERT_DEBUG(iIconArray, Panic(EAknPanicOutOfRange));
  4633                 __ASSERT_DEBUG(iIconArray, Panic(EAknPanicOutOfRange));
  4372                 if ( index == KColorIconFlag ) index = KColorIconIdx;
  4634                 if ( index == KColorIconFlag ) index = KColorIconIdx;
  4373                 __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  4635                 __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  4377                 if (index>=0 && iIconArray)
  4639                 if (index>=0 && iIconArray)
  4378                     {
  4640                     {
  4379                     CGulIcon* icon=(*iIconArray)[index];
  4641                     CGulIcon* icon=(*iIconArray)[index];
  4380                     CFbsBitmap* bitmap=icon->Bitmap();
  4642                     CFbsBitmap* bitmap=icon->Bitmap();
  4381                     
  4643                     
  4382                     if ( iExtension )
  4644 
       
  4645                     TInt w, h;
       
  4646                     TSize sz = bitmap->SizeInPixels();
       
  4647 
       
  4648                     w = iExtension->iSubCellIconSize[subcell].iWidth;
       
  4649                     h = iExtension->iSubCellIconSize[subcell].iHeight;
       
  4650 
       
  4651                     if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) )
  4383                         {
  4652                         {
  4384                         TInt w, h;
  4653                         AknIconUtils::SetSize( bitmap,
  4385                         TSize sz = bitmap->SizeInPixels();
  4654                                                iExtension->iSubCellIconSize[subcell],
  4386                         
  4655                                                EAspectRatioPreservedAndUnusedSpaceRemoved );
  4387                         w = iExtension->iSubCellIconSize[subcell].iWidth;
       
  4388                         h = iExtension->iSubCellIconSize[subcell].iHeight;
       
  4389                         
       
  4390                         if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) )
       
  4391                             {
       
  4392                             AknIconUtils::SetSize( bitmap,
       
  4393                                                    iExtension->iSubCellIconSize[subcell],
       
  4394                                                    EAspectRatioPreservedAndUnusedSpaceRemoved );
       
  4395                             }
       
  4396                         else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all
       
  4397                             {
       
  4398                             // just in case fallback
       
  4399                             AknIconUtils::SetSize( bitmap,
       
  4400                                                    textRect.Size(),
       
  4401                                                    EAspectRatioPreservedAndUnusedSpaceRemoved );
       
  4402                             }
       
  4403                         }
  4656                         }
       
  4657                     else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all
       
  4658                         {
       
  4659                         // just in case fallback
       
  4660                         AknIconUtils::SetSize( bitmap,
       
  4661                                                textRect.Size(),
       
  4662                                                EAspectRatioPreservedAndUnusedSpaceRemoved );
       
  4663                         }
       
  4664 
  4404                     
  4665                     
  4405                     TSize size=bitmap->SizeInPixels();
  4666                     TSize size=bitmap->SizeInPixels();
  4406                     
  4667                     
  4407                     if (size.iWidth>textRect.Size().iWidth)
  4668                     if (size.iWidth>textRect.Width())
  4408                         {
  4669                         {
  4409                         size.iWidth = textRect.Size().iWidth;
  4670                         size.iWidth = textRect.Width();
  4410                         }
  4671                         }
  4411                     
  4672                     
  4412                     if (size.iHeight>textRect.Size().iHeight)
  4673                     if (size.iHeight>textRect.Height())
  4413                         {
  4674                         {
  4414                         size.iHeight = textRect.Size().iHeight;
  4675                         size.iHeight = textRect.Height();
  4415                         }
  4676                         }
  4416                     
  4677                     
  4417                     TPoint bmpPos=textRect.iTl;
  4678                     TPoint bmpPos=textRect.iTl;
  4418                     bmpPos.iY+=(textRect.Height()-size.iHeight)>>1;
  4679                     bmpPos.iY+=(textRect.Height()-size.iHeight)>>1;
  4419                     switch (align)
  4680                     switch (align)
  4463     _AKNTRACE_FUNC_EXIT;
  4724     _AKNTRACE_FUNC_EXIT;
  4464     }
  4725     }
  4465 
  4726 
  4466 void CFormattedCellListBoxData::SetClippedByWrap( TUint32 aClippedCells, TBool aUseClippedByWrap )
  4727 void CFormattedCellListBoxData::SetClippedByWrap( TUint32 aClippedCells, TBool aUseClippedByWrap )
  4467     {
  4728     {
       
  4729     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  4730     iExtension->iClippedByWrap = aClippedCells;
       
  4731     iExtension->iUseClippedByWrap = aUseClippedByWrap;
       
  4732     }
       
  4733 
       
  4734 EXPORT_C TUint32 CFormattedCellListBoxData::CurrentItemTextWasClipped() const
       
  4735     {
       
  4736     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  4737     return iExtension->iClippedSubcells;
       
  4738     }
       
  4739 
       
  4740 
       
  4741 
       
  4742 TBool CFormattedCellListBoxData::KineticScrollingEnabled() const
       
  4743     {
       
  4744     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  4745     return iExtension->iKineticScrolling;
       
  4746     }
       
  4747     
       
  4748     
       
  4749 CEikListBox* CFormattedCellListBoxData::ListBox() const
       
  4750     {
       
  4751     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
       
  4752     if ( iExtension->iControl )
       
  4753         {
       
  4754         return static_cast<CEikListBox*>( iExtension->iControl );
       
  4755         }
       
  4756     return NULL;
       
  4757     }
       
  4758 void CFormattedCellListBoxData::InitSmileyL()
       
  4759     {
       
  4760     __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
       
  4761     if ( !iExtension->iSmileyMan )
       
  4762         {
       
  4763         iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension );
       
  4764         }
       
  4765     }
       
  4766 
       
  4767 void CFormattedCellListBoxData::SetSmileySubCellL( TInt aSubCell )
       
  4768     {    
       
  4769     __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
       
  4770     TInt index = 0;
  4468     if ( iExtension )
  4771     if ( iExtension )
  4469         {
  4772         {
  4470         iExtension->iClippedByWrap = aClippedCells;
  4773         iExtension->FindSLSubCellIndexOrAddL( index,aSubCell );
  4471         iExtension->iUseClippedByWrap = aUseClippedByWrap;
  4774         iExtension->SLAt(index).iSmileyCell = ETrue;
  4472         }
  4775         }
  4473     }
  4776     }
  4474 
  4777 #ifdef __ARMCC__
  4475 EXPORT_C TUint32 CFormattedCellListBoxData::CurrentItemTextWasClipped() const
  4778 #pragma pop
  4476     {
  4779 #endif // __ARMCC__
  4477     return iExtension ? iExtension->iClippedSubcells : 0;
       
  4478     }
       
  4479 
       
  4480 
       
  4481 
       
  4482 TBool CFormattedCellListBoxData::KineticScrollingEnabled() const
       
  4483     {
       
  4484     if ( iExtension )
       
  4485         {
       
  4486         return iExtension->iKineticScrolling;       
       
  4487         }
       
  4488     return EFalse;
       
  4489     }
       
  4490     
       
  4491     
       
  4492 CEikListBox* CFormattedCellListBoxData::ListBox() const
       
  4493     {
       
  4494     if ( iExtension && iExtension->iControl )
       
  4495         {
       
  4496         return static_cast<CEikListBox*>( iExtension->iControl );
       
  4497         }
       
  4498     return NULL;
       
  4499     }
       
  4500     
       
  4501     
  4780     
  4502 // End of File
  4781 // End of File