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