uifw/AvKon/src/eikfrlbd.cpp
branchRCL_3
changeset 15 08e69e956a8c
parent 10 9f56a4e1b8ab
child 16 71dd06cfe933
equal deleted inserted replaced
10:9f56a4e1b8ab 15:08e69e956a8c
    46 #include <aknlistloadertfx.h>
    46 #include <aknlistloadertfx.h>
    47 #include <aknlistboxtfxinternal.h>
    47 #include <aknlistboxtfxinternal.h>
    48 #endif //RD_UI_TRANSITION_EFFECTS_LIST
    48 #endif //RD_UI_TRANSITION_EFFECTS_LIST
    49 
    49 
    50 #include <touchfeedback.h>
    50 #include <touchfeedback.h>
       
    51 #include <AknSmileyUtils.h>
    51 #include "akntrace.h"
    52 #include "akntrace.h"
    52 
    53 
    53 // there are 17(!) subcells in qdial grid (0 ... 16)
    54 // there are 17(!) subcells in qdial grid (0 ... 16)
    54 const TInt KMaxSubCellIndex = 16 + 1;
    55 const TInt KMaxSubCellIndex = 16 + 1;
    55 
    56 
    56 // colored tick marks support
    57 // colored tick marks support
    57 const TInt KColorIconFlag = -1;
    58 const TInt KColorIconFlag = -1;
    58 const TInt KColorIconIdx  =  0;
    59 const TInt KColorIconIdx  =  0;
       
    60 // smiley text place holder
       
    61 _LIT( KPlaceHolder, "\xFFF0i" );
    59 
    62 
    60 /**
    63 /**
    61 * This class needs to be in .cpp file so that we do not accidentally make it
    64 * This class needs to be in .cpp file so that we do not accidentally make it
    62 * derivable; that would destroy all the binary compability advantages this
    65 * derivable; that would destroy all the binary compability advantages this
    63 * class has..
    66 * class has..
    75 NONSHARABLE_CLASS(CFormattedCellListBoxDataExtension) :
    78 NONSHARABLE_CLASS(CFormattedCellListBoxDataExtension) :
    76     public CActive,
    79     public CActive,
    77     public MAknPictographAnimatorCallBack,
    80     public MAknPictographAnimatorCallBack,
    78     public MCoeForegroundObserver,
    81     public MCoeForegroundObserver,
    79     public MAknsEffectAnimObserver,
    82     public MAknsEffectAnimObserver,
    80     public MListBoxItemChangeObserver
    83     public MListBoxItemChangeObserver,
       
    84     public MAknSmileyObserver
    81     {
    85     {
    82 public:
    86 public:
    83     enum TFlag
    87     enum TFlag
    84         {
    88         {
    85         // Set if current item background should be copied to animation as
    89         // Set if current item background should be copied to animation as
   121         TInt iSubCell; // Must be first entry
   125         TInt iSubCell; // Must be first entry
   122         TAknTextLineLayout iTextLayout;
   126         TAknTextLineLayout iTextLayout;
   123         TAknWindowLineLayout iGraphicLayout;
   127         TAknWindowLineLayout iGraphicLayout;
   124         TInt iSubCellType;
   128         TInt iSubCellType;
   125         TInt iConditionValue; // used with conditional layouts for not always drawn subcells
   129         TInt iConditionValue; // used with conditional layouts for not always drawn subcells
       
   130         TBool iSmileyCell;
   126         };
   131         };
   127 
   132 
   128     SRowAndSubCell& At(TInt aArrayIndex);
   133     SRowAndSubCell& At(TInt aArrayIndex);
   129     const SRowAndSubCell& At(TInt aArrayIndex) const;
   134     const SRowAndSubCell& At(TInt aArrayIndex) const;
   130     void AddRowAndSubCellL(TInt aRow,TInt aSubCell);
   135     void AddRowAndSubCellL(TInt aRow,TInt aSubCell);
   131     TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const;
   136     TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const;
   132     void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell);
   137     void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell);
   133 
   138 
   134     SSLSubCell& AtSL(TInt aArrayIndex);
   139     SSLSubCell& SLAt(TInt aArrayIndex);
   135     const SSLSubCell& AtSL(TInt aArrayIndex) const;
   140     const SSLSubCell& SLAt(TInt aArrayIndex) const;
   136     void AddSLSubCellL(TInt aSubCell);
   141     void AddSLSubCellL(TInt aSubCell);
   137     TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const;
   142     TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const;
   138     void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell);
   143     void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell);
   139     void ResetSLSubCellArray();
   144     void ResetSLSubCellArray();
   140 
   145 
   171     
   176     
   172     TBool DrawPressedDownEffect( MAknsSkinInstance* aSkin, 
   177     TBool DrawPressedDownEffect( MAknsSkinInstance* aSkin, 
   173                                  CWindowGc& aGc, 
   178                                  CWindowGc& aGc, 
   174                                  const TRect& aOutRect, 
   179                                  const TRect& aOutRect, 
   175                                  const TRect& aInnerRect ) const;
   180                                  const TRect& aInnerRect ) const;
       
   181     void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, 
       
   182                              const TAknLayoutText& aLayout, 
       
   183                              TBool aUseLogicalToVisualConversion, 
       
   184                              const TRgb &aColor);
       
   185     TInt ConvertTextToSmiley( TDes& aText );
   176 private: // New internal methods
   186 private: // New internal methods
   177     TBool DrawHighlightBackground( CFbsBitGc& aGc );
   187     TBool DrawHighlightBackground( CFbsBitGc& aGc );
   178     void PostDeleteAnimation();
   188     void PostDeleteAnimation();
   179     void CreateAnimationL();
   189     void CreateAnimationL();
   180     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
   190     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
   192     void SetSubCellLayoutAlignmentL( TInt aSubCellIndex );        
   202     void SetSubCellLayoutAlignmentL( TInt aSubCellIndex );        
   193         
   203         
   194         
   204         
   195     TInt FindSubCellExtIndex(TInt& aArrayIndex,TInt aSubCell) const;
   205     TInt FindSubCellExtIndex(TInt& aArrayIndex,TInt aSubCell) const;
   196     TBool SubCellLayoutAlignment(TInt aSubCellIndex) const;        
   206     TBool SubCellLayoutAlignment(TInt aSubCellIndex) const;        
   197 
   207 public: // from MAknSmileyObserver
       
   208     void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon );
       
   209     void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon );
   198 private: // From MAknPictographAnimatorCallBack
   210 private: // From MAknPictographAnimatorCallBack
   199     void DrawPictographArea();
   211     void DrawPictographArea();
   200 
   212 
   201 public:
   213 public:
   202     CCoeControl *iControl; // not owned
   214     CCoeControl *iControl; // not owned
   261 
   273 
   262     CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment
   274     CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment
   263 
   275 
   264     TRect iMarginRect;    
   276     TRect iMarginRect;    
   265     TBool iKineticScrolling;
   277     TBool iKineticScrolling;
       
   278     CAknSmileyManager* iSmileyMan;
       
   279     TSize iSmileySize; // last set simley size
   266     };
   280     };
   267 
   281 
   268 
   282 
   269 /**
   283 /**
   270 * High priority is well argumented because running the active object will
   284 * High priority is well argumented because running the active object will
   320     Cancel();
   334     Cancel();
   321 
   335 
   322     // Stop receiving foreground events
   336     // Stop receiving foreground events
   323     CCoeEnv* env = CCoeEnv::Static();
   337     CCoeEnv* env = CCoeEnv::Static();
   324     env->RemoveForegroundObserver( *this );
   338     env->RemoveForegroundObserver( *this );
       
   339     delete iSmileyMan;
   325 
   340 
   326     delete iRowAndSubCellArray;
   341     delete iRowAndSubCellArray;
   327     iRowAndSubCellArray = NULL;
   342     iRowAndSubCellArray = NULL;
   328     delete iSLSubCellArray;
   343     delete iSLSubCellArray;
   329     iSLSubCellArray = NULL;
   344     iSLSubCellArray = NULL;
   407     subcell.iSubCell = aSubCell;
   422     subcell.iSubCell = aSubCell;
   408     subcell.iTextLayout = NULL;
   423     subcell.iTextLayout = NULL;
   409     subcell.iGraphicLayout = NULL;
   424     subcell.iGraphicLayout = NULL;
   410     subcell.iSubCellType = 0;
   425     subcell.iSubCellType = 0;
   411     subcell.iConditionValue = -1;
   426     subcell.iConditionValue = -1;
       
   427     subcell.iSmileyCell = EFalse;
   412 
   428 
   413     TKeyArrayFix key(0,ECmpTInt32);
   429     TKeyArrayFix key(0,ECmpTInt32);
   414     iSLSubCellArray->InsertIsqL(subcell,key);
   430     iSLSubCellArray->InsertIsqL(subcell,key);
   415     }
   431     }
   416 
   432 
   417 
   433 
   418 CFormattedCellListBoxDataExtension::SSLSubCell& 
   434 CFormattedCellListBoxDataExtension::SSLSubCell& 
   419 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex)
   435 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex)
   420     {
   436     {
   421     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   437     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   422     return(iSLSubCellArray->At(aArrayIndex));
   438     return(iSLSubCellArray->At(aArrayIndex));
   423     }
   439     }
   424 
   440 
   425 const CFormattedCellListBoxDataExtension::SSLSubCell& 
   441 const CFormattedCellListBoxDataExtension::SSLSubCell& 
   426 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) const
   442 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) const
   427     {
   443     {
   428     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   444     __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange));
   429     return(iSLSubCellArray->At(aArrayIndex));
   445     return(iSLSubCellArray->At(aArrayIndex));
   430     }
   446     }
   431 
   447 
  1189     if (FindSubCellExtIndex(index,aSubCellIndex)==KErrNotFound)
  1205     if (FindSubCellExtIndex(index,aSubCellIndex)==KErrNotFound)
  1190         return (ETrue);
  1206         return (ETrue);
  1191     return(iSubCellExtArray->At(index).iLayoutAlign);    
  1207     return(iSubCellExtArray->At(index).iLayoutAlign);    
  1192     }   
  1208     }   
  1193 
  1209 
  1194 
  1210 void CFormattedCellListBoxDataExtension::SmileyStillImageLoaded(
       
  1211     CAknSmileyIcon* /*aSmileyIcon*/)
       
  1212     {
       
  1213     iControl->DrawDeferred();
       
  1214     }
       
  1215 
       
  1216 void CFormattedCellListBoxDataExtension::SmileyAnimationChanged( 
       
  1217     CAknSmileyIcon* /*aSmileyIcon*/ )
       
  1218     {
       
  1219     }
  1195 
  1220 
  1196 ///////////handling TSubCellExt,end
  1221 ///////////handling TSubCellExt,end
  1197 
  1222 
  1198 void CFormattedCellListBoxDataExtension::DrawPictographArea()
  1223 void CFormattedCellListBoxDataExtension::DrawPictographArea()
  1199     {
  1224     {
  1253                                      aInnerRect,
  1278                                      aInnerRect,
  1254                                      KAknsIIDQsnFrListPressed,
  1279                                      KAknsIIDQsnFrListPressed,
  1255                                      KAknsIIDQsnFrListCenterPressed );
  1280                                      KAknsIIDQsnFrListCenterPressed );
  1256     }
  1281     }
  1257 
  1282 
       
  1283 void CFormattedCellListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc,
       
  1284                                                              const TDesC& aSmileyText,
       
  1285                                                              const TAknLayoutText& aLayout,
       
  1286                                                              TBool aUseLogicalToVisualConversion,
       
  1287                                                              const TRgb& aColor )
       
  1288     {
       
  1289     __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
       
  1290     TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), 
       
  1291                   aLayout.Font()->HeightInPixels() );
       
  1292     TSize s(l,l);
       
  1293     if ( iSmileySize != s )
       
  1294         {
       
  1295         iSmileyMan->SetSize( s );
       
  1296         iSmileySize = s;
       
  1297         }
       
  1298     aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor...
       
  1299     iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion );
       
  1300     }
       
  1301 TInt CFormattedCellListBoxDataExtension::ConvertTextToSmiley( TDes& aText)
       
  1302     {
       
  1303     __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
       
  1304     TInt count = 0;
       
  1305     TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ;
       
  1306     return err == KErrNone ? count : err;
       
  1307     }
  1258 
  1308 
  1259 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const 
  1309 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const 
  1260     {
  1310     {
  1261     return iExtension->iControl;
  1311     return iExtension->iControl;
  1262     }
  1312     }
  2189     }
  2239     }
  2190 
  2240 
  2191 EXPORT_C void CFormattedCellListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  2241 EXPORT_C void CFormattedCellListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const
  2192     {
  2242     {
  2193     _AKNTRACE_FUNC_ENTER;
  2243     _AKNTRACE_FUNC_ENTER;
       
  2244     _AKNTRACE("Highlight width: %d, (%d,%d)", aRect.Width(), aRect.iTl.iX, aRect.iBr.iX );
  2194     DrawDefaultHighlight(aGc, aRect, aHighlight);
  2245     DrawDefaultHighlight(aGc, aRect, aHighlight);
  2195 
  2246 
  2196     // Draw the actual items.
  2247     // Draw the actual items.
  2197     DrawFormatted(aProperties,aGc,aText,aRect,aHighlight,aColors);
  2248     DrawFormatted(aProperties,aGc,aText,aRect,aHighlight,aColors);
  2198     _AKNTRACE_FUNC_EXIT;
  2249     _AKNTRACE_FUNC_EXIT;
  2205                                           const TRect& aItemRect,
  2256                                           const TRect& aItemRect,
  2206                                           TBool aHighlight,
  2257                                           TBool aHighlight,
  2207                                           const TColors& aColors ) const
  2258                                           const TColors& aColors ) const
  2208     {
  2259     {
  2209     _AKNTRACE_FUNC_ENTER;
  2260     _AKNTRACE_FUNC_ENTER;
  2210     _AKNTRACE("DrawFormatted: aText=%S, aItemRect=(%d,%d,%d,%d)",
  2261     _AKNTRACE("DrawFormatted: aItemRect=(%d,%d,%d,%d)",
  2211             aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2262             aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2212             aItemRect.iBr.iY);
  2263             aItemRect.iBr.iY);
  2213     
  2264     
  2214     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2265     CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2215     if (!view->ViewRect().Intersects(aItemRect))
  2266     if (!view->ViewRect().Intersects(aItemRect))
  2216         {
  2267         {
  2234             }
  2285             }
  2235         }
  2286         }
  2236 #else
  2287 #else
  2237     aGc.SetClippingRect( view->ViewRect() );
  2288     aGc.SetClippingRect( view->ViewRect() );
  2238 #endif //RD_UI_TRANSITION_EFFECTS_LIST
  2289 #endif //RD_UI_TRANSITION_EFFECTS_LIST
  2239     
  2290     TRect vr(view->ViewRect());
       
  2291     _AKNTRACE("Clipping: Width %d, (%d,%d)", vr.Width(), vr.iTl.iX, vr.iBr.iX );
  2240     if ( UsesScalableLayoutData() )
  2292     if ( UsesScalableLayoutData() )
  2241         {
  2293         {
  2242         /* this is a AvKon list or list is created using methods in aknlists.cpp
  2294         /* this is a AvKon list or list is created using methods in aknlists.cpp
  2243         * which is _the_ way to set up a list
  2295         * which is _the_ way to set up a list
  2244         */
  2296         */
  2335                                                 const TRect& aItemRect,
  2387                                                 const TRect& aItemRect,
  2336                                                 TBool aHighlight,
  2388                                                 TBool aHighlight,
  2337                                                 const TColors& aColors ) const
  2389                                                 const TColors& aColors ) const
  2338     {
  2390     {
  2339     _AKNTRACE_FUNC_ENTER;
  2391     _AKNTRACE_FUNC_ENTER;
  2340     _AKNTRACE("DrawFormattedSimple: aText=%S, aItemRect=(%d,%d,%d,%d)",
  2392     _AKNTRACE("DrawFormattedSimple: aItemRect=(%d,%d,%d,%d)",
  2341             aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2393             aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, 
  2342             aItemRect.iBr.iY);
  2394             aItemRect.iBr.iY);
  2343     
  2395     
  2344     TRect textRect(aItemRect);
  2396     TRect textRect(aItemRect);
  2345     const TColors *subcellColors = &aColors;
  2397     const TColors *subcellColors = &aColors;
  2346 
  2398 
  2425                     }
  2477                     }
  2426                 }
  2478                 }
  2427             }
  2479             }
  2428         
  2480         
  2429         // graphics or text column
  2481         // graphics or text column
  2430         if (iExtension->AtSL(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText)
  2482         if (iExtension->SLAt(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText)
  2431             {
  2483             {
  2432             const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  2484             const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
  2433             const CFont* cellFont=Font(aProperties, subcell);
  2485             const CFont* cellFont=Font(aProperties, subcell);
  2434             const CFont* tempFont=(cellFont) ? cellFont : NULL;
  2486             const CFont* tempFont=(cellFont) ? cellFont : NULL;
  2435             const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  2487             const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
  2441                 textLineLayout = textLines[subcell];
  2493                 textLineLayout = textLines[subcell];
  2442                 }
  2494                 }
  2443             else
  2495             else
  2444                 {
  2496                 {
  2445                 // check if there are icons affecting this text layout
  2497                 // check if there are icons affecting this text layout
  2446                 TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
  2498                 TInt gSC = iExtension->SLAt(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
  2447                 
  2499                 
  2448                 if (gSC > -1)
  2500                 if (gSC > -1)
  2449                     {
  2501                     {
  2450                     TInt tempIndex;
  2502                     TInt tempIndex;
  2451                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
  2503                     while (gSC > -1) // when gSC == -1, we have found our graphical subcell
  2452                         {
  2504                         {
  2453                         if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
  2505                         if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
  2454                         TextUtils::ColumnText(tempText,gSC, aText);
  2506                         TextUtils::ColumnText(tempText,gSC, aText);
  2455                         if (tempText != KNullDesC)
  2507                         if (tempText != KNullDesC)
  2456                             {
  2508                             {
  2457                             textLineLayout = iExtension->AtSL(tempIndex).iTextLayout;
  2509                             textLineLayout = iExtension->SLAt(tempIndex).iTextLayout;
  2458                             break;                      
  2510                             break;                      
  2459                             }
  2511                             }
  2460                         gSC = iExtension->AtSL(tempIndex).iConditionValue;
  2512                         gSC = iExtension->SLAt(tempIndex).iConditionValue;
  2461                         }
  2513                         }
  2462                     }
  2514                     }
  2463                     
  2515                     
  2464                 if (gSC == -1) // no affecting icons -> use default layout
  2516                 if (gSC == -1) // no affecting icons -> use default layout
  2465                     {
  2517                     {
  2466                     textLineLayout = iExtension->AtSL(SCindex).iTextLayout;
  2518                     textLineLayout = iExtension->SLAt(SCindex).iTextLayout;
  2467                     }
  2519                     }
  2468                 }
  2520                 }
  2469 
  2521 
  2470                       
  2522                       
  2471             CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
  2523             CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
  2497             textLayout.LayoutText(textRect, textLineLayout, usedFont);
  2549             textLayout.LayoutText(textRect, textLineLayout, usedFont);
  2498 
  2550 
  2499             SetUnderlineStyle( aProperties, aGc, subcell );
  2551             SetUnderlineStyle( aProperties, aGc, subcell );
  2500 
  2552 
  2501             // * 2 == leave some room for marquee
  2553             // * 2 == leave some room for marquee
  2502             const TInt maxlen( KMaxColumnDataLength * 2 ); 
  2554             const TInt maxlen( KMaxColumnDataLength * 3 );
  2503             TBuf<maxlen> convBuf = text.Left(maxlen);
  2555             TBuf<maxlen> convBuf = text.Left(maxlen);
       
  2556             TBool smileyDraw = EFalse;
       
  2557             // do smiley convert before clipping. don't worry marquee now.            
       
  2558             if ( iExtension->iSmileyMan && 
       
  2559                  iExtension->SLAt(SCindex).iSmileyCell &&
       
  2560                  iExtension->ConvertTextToSmiley( convBuf ) > 0 )
       
  2561                 {
       
  2562                 smileyDraw = ETrue;
       
  2563                 }
  2504 
  2564 
  2505             // Note that this potentially modifies the text so its lenght in pixels
  2565             // Note that this potentially modifies the text so its lenght in pixels
  2506             // might increase. Therefore, this should always be done before
  2566             // might increase. Therefore, this should always be done before
  2507             // wrapping/clipping text. In some cases, WordWrapListItem is called
  2567             // wrapping/clipping text. In some cases, WordWrapListItem is called
  2508             // before coming here. Is it certain that it is not done for number subcells?
  2568             // before coming here. Is it certain that it is not done for number subcells?
  2563                 if ( marquee && marqueeDisabled )
  2623                 if ( marquee && marqueeDisabled )
  2564                     {
  2624                     {
  2565                     marquee->Stop();
  2625                     marquee->Stop();
  2566                     }
  2626                     }
  2567 
  2627 
       
  2628                 if ( smileyDraw )
       
  2629                     {
       
  2630                     TRect tr(textLayout.TextRect());
       
  2631                     _AKNTRACE( "textLayout Width: %d (%d,%d)", tr.Width(), tr.iTl.iX, tr.iBr.iX );
       
  2632                     iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color );
       
  2633                     }
       
  2634                 else
       
  2635                     {
  2568                 textLayout.DrawText( aGc, convBuf, bidiConv, color );
  2636                 textLayout.DrawText( aGc, convBuf, bidiConv, color );
       
  2637                     }
  2569                 }
  2638                 }
  2570 
  2639 
  2571             if ( iExtension->iPictoInterface )
  2640             if ( iExtension->iPictoInterface )
  2572                 {
  2641                 {
  2573                 
  2642                 
  2650                 }
  2719                 }
  2651 
  2720 
  2652              index = index & 0xffff; // mask off possible highlight icon
  2721              index = index & 0xffff; // mask off possible highlight icon
  2653             __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  2722             __ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex));
  2654             
  2723             
  2655             TAknWindowLineLayout graphicLayout = iExtension->AtSL(SCindex).iGraphicLayout;
  2724             TAknWindowLineLayout graphicLayout = iExtension->SLAt(SCindex).iGraphicLayout;
  2656             TAknLayoutRect graphicRect; 
  2725             TAknLayoutRect graphicRect; 
  2657             
  2726             
  2658             graphicRect.LayoutRect(textRect,graphicLayout);
  2727             graphicRect.LayoutRect(textRect,graphicLayout);
  2659             TSize graphicSize( graphicRect.Rect().Size() );
  2728             TSize graphicSize( graphicRect.Rect().Size() );
  2660             
  2729             
  3404     // eventually they'll get here again with list!=0, so this check is enough
  3473     // eventually they'll get here again with list!=0, so this check is enough
  3405     if ( !list ) return;  
  3474     if ( !list ) return;  
  3406     
  3475     
  3407     TInt index = 0;
  3476     TInt index = 0;
  3408     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3477     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3409     iExtension->AtSL(index).iTextLayout=NULL;
  3478     iExtension->SLAt(index).iTextLayout=NULL;
  3410     iExtension->AtSL(index).iGraphicLayout=aGraphicLayout;
  3479     iExtension->SLAt(index).iGraphicLayout=aGraphicLayout;
  3411     iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic;
  3480     iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic;
  3412 
  3481 
  3413     // For compabitility - needed at least for text wrapping.
  3482     // For compabitility - needed at least for text wrapping.
  3414     // Beware - some of these WILL be overriden if you got here trough
  3483     // Beware - some of these WILL be overriden if you got here trough
  3415     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3484     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3416     // & friends.
  3485     // & friends.
  3453     // eventually they'll get here again with list!=0, so this check is enough
  3522     // eventually they'll get here again with list!=0, so this check is enough
  3454     if ( !list ) return;  
  3523     if ( !list ) return;  
  3455 
  3524 
  3456     TInt index = 0;
  3525     TInt index = 0;
  3457     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3526     iExtension->FindSLSubCellIndexOrAddL(index,aSubCell);
  3458     iExtension->AtSL(index).iTextLayout=aTextLayout;
  3527     iExtension->SLAt(index).iTextLayout=aTextLayout;
  3459     iExtension->AtSL(index).iGraphicLayout=NULL;
  3528     iExtension->SLAt(index).iGraphicLayout=NULL;
  3460     iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText;
  3529     iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText;
  3461 
  3530 
  3462     
  3531     
  3463     // For compabitility - needed at least for text wrapping.
  3532     // For compabitility - needed at least for text wrapping.
  3464     // Beware - some of these WILL be overriden if you got here trough
  3533     // Beware - some of these WILL be overriden if you got here trough
  3465     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3534     // old layout methods like AknListBoxLayouts::SetupFormTextCell()
  3516     iExtension->iConditionalCells = iExtension->iConditionalCells | i;
  3585     iExtension->iConditionalCells = iExtension->iConditionalCells | i;
  3517 
  3586 
  3518     TInt graphicalIndex = 0;
  3587     TInt graphicalIndex = 0;
  3519     if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found
  3588     if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found
  3520     // conditional layoutline can be only added to graphical subcells
  3589     // conditional layoutline can be only added to graphical subcells
  3521     if (iExtension->AtSL(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3590     if (iExtension->SLAt(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3522     
  3591     
  3523     TInt textIndex = 0; // index of affected subcell
  3592     TInt textIndex = 0; // index of affected subcell
  3524     if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found
  3593     if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found
  3525     // affected subcell can only be text subcell
  3594     // affected subcell can only be text subcell
  3526     if (iExtension->AtSL(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3595     if (iExtension->SLAt(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return;
  3527     
  3596     
  3528     TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain
  3597     TInt gSC = iExtension->SLAt(textIndex).iConditionValue; // text subcell to be added in priority chain
  3529 
  3598 
  3530     while (gSC > -1)
  3599     while (gSC > -1)
  3531         {
  3600         {
  3532         if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found
  3601         if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found
  3533         gSC = iExtension->AtSL(textIndex).iConditionValue;
  3602         gSC = iExtension->SLAt(textIndex).iConditionValue;
  3534         }
  3603         }
  3535     iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain
  3604     iExtension->SLAt(textIndex).iConditionValue = aSubCell; // add next subcell to chain
  3536     iExtension->AtSL(graphicalIndex).iTextLayout=aTextLayout;
  3605     iExtension->SLAt(graphicalIndex).iTextLayout=aTextLayout;
  3537 
  3606 
  3538     iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) );
  3607     iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) );
  3539     
  3608     
  3540     TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) );
  3609     TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) );
  3541     if ( iExtension->iMarginRect == TRect::EUninitialized )
  3610     if ( iExtension->iMarginRect == TRect::EUninitialized )
  3699     const TAknTextComponentLayout& aNormalLayout,
  3768     const TAknTextComponentLayout& aNormalLayout,
  3700     const TAknTextComponentLayout& aStretchedLayout,
  3769     const TAknTextComponentLayout& aStretchedLayout,
  3701     TInt aNormalSubCell,
  3770     TInt aNormalSubCell,
  3702     TInt aStretchedSubCell )
  3771     TInt aStretchedSubCell )
  3703     {
  3772     {
       
  3773     _AKNTRACE_FUNC_ENTER;
  3704     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
  3774     if ( Layout_Meta_Data::IsLandscapeOrientation() &&
  3705          Layout_Meta_Data::IsListStretchingEnabled() &&
  3775          Layout_Meta_Data::IsListStretchingEnabled() &&
  3706          StretchingEnabled() )
  3776          StretchingEnabled() )
  3707         {
  3777         {
       
  3778         _AKNTRACE("Layout_Meta_Data::IsListStretchingEnabled");
  3708         SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell );
  3779         SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell );
  3709         }
  3780         }
  3710     else
  3781     else
  3711         {
  3782         {
  3712         SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell );
  3783         SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell );
  3713         }
  3784         }
       
  3785     _AKNTRACE_FUNC_EXIT;
  3714     }
  3786     }
  3715 
  3787 
  3716 
  3788 
  3717 // -----------------------------------------------------------------------------
  3789 // -----------------------------------------------------------------------------
  3718 // CFormattedCellListBoxData::ResetSLSubCellArray
  3790 // CFormattedCellListBoxData::ResetSLSubCellArray
  3901                 }
  3973                 }
  3902             }
  3974             }
  3903             
  3975             
  3904         if ( aResults[subCell] )
  3976         if ( aResults[subCell] )
  3905             {
  3977             {
  3906             if ( iExtension->AtSL( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText )
  3978             if ( iExtension->SLAt( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText )
  3907                 {
  3979                 {
  3908                 TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout;
  3980                 TAknTextLineLayout textLine = iExtension->SLAt( subCellIndex ).iTextLayout;
  3909                 
  3981                 
  3910                 textLine.iW = bRect.Width();
  3982                 textLine.iW = bRect.Width();
  3911 
  3983 
  3912                 if ( !AknLayoutUtils::LayoutMirrored() )
  3984                 if ( !AknLayoutUtils::LayoutMirrored() )
  3913                     {
  3985                     {
  4574         {
  4646         {
  4575         return static_cast<CEikListBox*>( iExtension->iControl );
  4647         return static_cast<CEikListBox*>( iExtension->iControl );
  4576         }
  4648         }
  4577     return NULL;
  4649     return NULL;
  4578     }
  4650     }
  4579 
  4651 void CFormattedCellListBoxData::InitSmileyL()
       
  4652     {
       
  4653     __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
       
  4654     if ( iExtension && !iExtension->iSmileyMan )
       
  4655         {
       
  4656         iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension );
       
  4657         }
       
  4658     }
       
  4659 
       
  4660 void CFormattedCellListBoxData::SetSmileySubCellL( TInt aSubCell )
       
  4661     {    
       
  4662     __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
       
  4663     TInt index = 0;
       
  4664     if ( iExtension )
       
  4665         {
       
  4666         iExtension->FindSLSubCellIndexOrAddL( index,aSubCell );
       
  4667         iExtension->SLAt(index).iSmileyCell = ETrue;
       
  4668         }
       
  4669     }
  4580 #ifdef __ARMCC__
  4670 #ifdef __ARMCC__
  4581 #pragma pop
  4671 #pragma pop
  4582 #endif // __ARMCC__
  4672 #endif // __ARMCC__
  4583     
  4673     
  4584 // End of File
  4674 // End of File