diff -r fcdfafb36fe7 -r aecbbf00d063 uifw/AvKon/src/eikfrlbd.cpp --- a/uifw/AvKon/src/eikfrlbd.cpp Thu Aug 19 10:11:06 2010 +0300 +++ b/uifw/AvKon/src/eikfrlbd.cpp Tue Aug 31 15:28:30 2010 +0300 @@ -15,12 +15,6 @@ * */ -#ifdef __ARMCC__ -#pragma push -#pragma O3 -#pragma Otime -#pragma arm -#endif // __ARMCC__ #include #include @@ -40,8 +34,6 @@ #include #include #include -#include -#include #ifdef RD_UI_TRANSITION_EFFECTS_LIST @@ -50,7 +42,6 @@ #endif //RD_UI_TRANSITION_EFFECTS_LIST #include -#include #include "akntrace.h" // there are 17(!) subcells in qdial grid (0 ... 16) @@ -60,12 +51,6 @@ const TInt KColorIconFlag = -1; const TInt KColorIconIdx = 0; -// Number of icons in marking mode icon array -const TInt KMarkingModeIconArraySize = 2; - -// smiley text place holder -_LIT( KPlaceHolder, "\xFFF0i" ); - /** * This class needs to be in .cpp file so that we do not accidentally make it * derivable; that would destroy all the binary compability advantages this @@ -86,8 +71,7 @@ public MAknPictographAnimatorCallBack, public MCoeForegroundObserver, public MAknsEffectAnimObserver, - public MListBoxItemChangeObserver, - public MAknSmileyObserver + public MListBoxItemChangeObserver { public: enum TFlag @@ -133,7 +117,6 @@ TAknWindowLineLayout iGraphicLayout; TInt iSubCellType; TInt iConditionValue; // used with conditional layouts for not always drawn subcells - TBool iSmileyCell; }; SRowAndSubCell& At(TInt aArrayIndex); @@ -142,8 +125,8 @@ TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const; void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell); - SSLSubCell& SLAt(TInt aArrayIndex); - const SSLSubCell& SLAt(TInt aArrayIndex) const; + SSLSubCell& AtSL(TInt aArrayIndex); + const SSLSubCell& AtSL(TInt aArrayIndex) const; void AddSLSubCellL(TInt aSubCell); TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const; void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell); @@ -184,13 +167,6 @@ CWindowGc& aGc, const TRect& aOutRect, const TRect& aInnerRect ) const; - void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, - const TAknLayoutText& aLayout, - TBool aUseLogicalToVisualConversion, - const TRgb &aColor); - TInt ConvertTextToSmiley( TDes& aText ); - void LoadMarkingIconsL(); - private: // New internal methods TBool DrawHighlightBackground( CFbsBitGc& aGc ); void PostDeleteAnimation(); @@ -212,9 +188,7 @@ TInt FindSubCellExtIndex(TInt& aArrayIndex,TInt aSubCell) const; TBool SubCellLayoutAlignment(TInt aSubCellIndex) const; -public: // from MAknSmileyObserver - void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon ); - void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon ); + private: // From MAknPictographAnimatorCallBack void DrawPictographArea(); @@ -283,9 +257,6 @@ TRect iMarginRect; TBool iKineticScrolling; - CAknSmileyManager* iSmileyMan; - TSize iSmileySize; // last set simley size - CAknIconArray* iMarkingIconArray; }; @@ -334,7 +305,6 @@ #endif iKineticScrolling = CAknPhysics::FeatureEnabled(); - LoadMarkingIconsL(); _AKNTRACE_FUNC_EXIT; } @@ -346,7 +316,6 @@ // Stop receiving foreground events CCoeEnv* env = CCoeEnv::Static(); env->RemoveForegroundObserver( *this ); - delete iSmileyMan; delete iRowAndSubCellArray; iRowAndSubCellArray = NULL; @@ -363,13 +332,6 @@ delete iAnimation; delete iColorBmp; delete iHiliBmp; - - if ( iMarkingIconArray ) - { - iMarkingIconArray->ResetAndDestroy(); - } - - delete iMarkingIconArray; _AKNTRACE_FUNC_EXIT; } @@ -441,7 +403,6 @@ subcell.iGraphicLayout = NULL; subcell.iSubCellType = 0; subcell.iConditionValue = -1; - subcell.iSmileyCell = EFalse; TKeyArrayFix key(0,ECmpTInt32); iSLSubCellArray->InsertIsqL(subcell,key); @@ -449,14 +410,14 @@ CFormattedCellListBoxDataExtension::SSLSubCell& -CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) +CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) { __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndexCount(),Panic(EAknPanicOutOfRange)); return(iSLSubCellArray->At(aArrayIndex)); } const CFormattedCellListBoxDataExtension::SSLSubCell& -CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) const +CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) const { __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndexCount(),Panic(EAknPanicOutOfRange)); return(iSLSubCellArray->At(aArrayIndex)); @@ -714,7 +675,6 @@ DeleteAnim(); TryCreateAnimation(); TRAP_IGNORE(CreateColorBitmapsL()); - TRAP_IGNORE( LoadMarkingIconsL() ); _AKNTRACE_FUNC_EXIT; } @@ -1225,16 +1185,7 @@ return(iSubCellExtArray->At(index).iLayoutAlign); } -void CFormattedCellListBoxDataExtension::SmileyStillImageLoaded( - CAknSmileyIcon* /*aSmileyIcon*/) - { - iControl->DrawDeferred(); - } - -void CFormattedCellListBoxDataExtension::SmileyAnimationChanged( - CAknSmileyIcon* /*aSmileyIcon*/ ) - { - } + ///////////handling TSubCellExt,end @@ -1298,89 +1249,23 @@ KAknsIIDQsnFrListCenterPressed ); } -void CFormattedCellListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc, - const TDesC& aSmileyText, - const TAknLayoutText& aLayout, - TBool aUseLogicalToVisualConversion, - const TRgb& aColor ) - { - __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); - TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), - aLayout.Font()->HeightInPixels() ); - TSize s(l,l); - if ( iSmileySize != s ) - { - iSmileyMan->SetSize( s ); - iSmileySize = s; - } - aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor... - iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion ); - } -TInt CFormattedCellListBoxDataExtension::ConvertTextToSmiley( TDes& aText) - { - __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); - TInt count = 0; - TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ; - return err == KErrNone ? count : err; - } - - -// ----------------------------------------------------------------------------- -// CFormattedCellListBoxDataExtension::LoadMarkingIconsL -// ----------------------------------------------------------------------------- -// -void CFormattedCellListBoxDataExtension::LoadMarkingIconsL() - { - if ( !iMarkingIconArray ) - { - iMarkingIconArray = new ( ELeave ) CAknIconArray( - KMarkingModeIconArraySize ); - } - else - { - iMarkingIconArray->ResetAndDestroy(); - } - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - const TDesC& avkonIconFile = AknIconUtils::AvkonIconFileName(); - - CGulIcon* icon = AknsUtils::CreateGulIconL( skin, - KAknsIIDQgnPropCheckboxOn, - avkonIconFile, - EMbmAvkonQgn_prop_checkbox_on, - EMbmAvkonQgn_prop_checkbox_on_mask ); - - CleanupStack::PushL( icon ); - iMarkingIconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - icon = AknsUtils::CreateGulIconL( skin, - KAknsIIDQgnPropCheckboxOff, - avkonIconFile, - EMbmAvkonQgn_prop_checkbox_off, - EMbmAvkonQgn_prop_checkbox_off_mask ); - - CleanupStack::PushL( icon ); - iMarkingIconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - } - EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->iControl; } EXPORT_C void CFormattedCellListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iSeparatorLinePosition = aPosition; + if (iExtension) + iExtension->iSeparatorLinePosition = aPosition; } EXPORT_C TAknSeparatorLinePosition CFormattedCellListBoxData::SeparatorLinePosition() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iSeparatorLinePosition; + if (iExtension) + return iExtension->iSeparatorLinePosition; + else + return ENoLine; } EXPORT_C CAknLayoutData *CFormattedCellListBoxData::LayoutData() const { @@ -1400,13 +1285,11 @@ EXPORT_C void CFormattedCellListBoxData::SetControl(CCoeControl *aControl) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->SetControl( aControl ); } EXPORT_C MAknsControlContext* CFormattedCellListBoxData::SkinBackgroundContext() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if (iExtension->iSkinEnabled) { if (iExtension->iPopupFrame) @@ -1427,20 +1310,18 @@ EXPORT_C void CFormattedCellListBoxData::SetSkinEnabledL(TBool aEnabled) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); CListBoxData::SetSkinEnabledL(aEnabled); iExtension->iSkinEnabled = aEnabled; } EXPORT_C TBool CFormattedCellListBoxData::SkinEnabled() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->iSkinEnabled; } EXPORT_C void CFormattedCellListBoxData::SetSkinStyle(const TAknsItemID *id, const TRect &aTileRect) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if (iExtension->iSkinControlContext) { iExtension->iSkinControlContext->SetTiledBitmap(*id); @@ -1449,7 +1330,6 @@ } EXPORT_C void CFormattedCellListBoxData::SetSkinParentPos(const TPoint &aPos) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if (iExtension->iSkinControlContext) { iExtension->iSkinControlContext->SetParentPos(aPos); @@ -1457,7 +1337,6 @@ } EXPORT_C void CFormattedCellListBoxData::SetBackgroundSkinStyle(const TAknsItemID *aId, const TRect &aRect) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if (iExtension->iSkinControlContext) { iExtension->iSkinControlContext->SetBitmap(*aId); @@ -1466,7 +1345,6 @@ } EXPORT_C void CFormattedCellListBoxData::SetListEndSkinStyle(const TAknsItemID *aListEndId, const TRect &aRect) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if (iExtension->iSkinControlContext) { iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId); @@ -1476,15 +1354,13 @@ EXPORT_C void CFormattedCellListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iSkinHighlightFrameId = aFrameId; iExtension->iSkinHighlightFrameCenterId = aFrameCenterId; } EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( iExtension->iPopupFrame) + if (iExtension && iExtension->iPopupFrame) { iExtension->iPopupFrame->SetFrame(*aFrameId); iExtension->iPopupFrame->SetCenter(*aFrameCenterId); @@ -1506,27 +1382,24 @@ EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFramePosition(const TRect &aOuterRect, const TRect &aInnerRect) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( iExtension->iPopupFrame) + if (iExtension && iExtension->iPopupFrame) iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect); } EXPORT_C void CFormattedCellListBoxData::UseLogicalToVisualConversion( TBool aUseConversion ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if (iExtension) iExtension->iUseLogicalToVisualConversion = aUseConversion; } void CFormattedCellListBoxData::CreatePictographInterfaceL() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->CreatePictographInterfaceL(); } void CFormattedCellListBoxData::CreateMarqueeControlL() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); TCallBack callBack(CFormattedCellListBoxDataExtension::RedrawEvent, iExtension->iControl); //iExtension->iMarquee = CAknMarqueeControl::NewL(); iExtension->CreateMarqueeControlL(); @@ -1784,7 +1657,6 @@ EXPORT_C void CFormattedCellListBoxData::SetSubCellAlignmentL(TInt aSubCellIndex, CGraphicsContext::TTextAlign aAlign) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); TInt index = 0; FindSubCellIndexOrAddL(index,aSubCellIndex); At(index).iAlign=aAlign; @@ -1932,14 +1804,15 @@ EXPORT_C TBool CFormattedCellListBoxData::RespectFocus() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iRespectFocus; + if (iExtension) + return iExtension->iRespectFocus; + return EFalse; } EXPORT_C void CFormattedCellListBoxData::SetRespectFocus(TBool aBool) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iRespectFocus = aBool; + if (iExtension) + iExtension->iRespectFocus = aBool; } EXPORT_C CFont* @@ -2312,7 +2185,6 @@ EXPORT_C void CFormattedCellListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const { _AKNTRACE_FUNC_ENTER; - _AKNTRACE("Highlight width: %d, (%d,%d)", aRect.Width(), aRect.iTl.iX, aRect.iBr.iX ); DrawDefaultHighlight(aGc, aRect, aHighlight); // Draw the actual items. @@ -2329,16 +2201,11 @@ const TColors& aColors ) const { _AKNTRACE_FUNC_ENTER; - _AKNTRACE("DrawFormatted: aItemRect=(%d,%d,%d,%d)", - aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, + _AKNTRACE("DrawFormatted: aText=%S, aItemRect=(%d,%d,%d,%d)", + aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, aItemRect.iBr.iY); - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - __ASSERT_DEBUG( iExtension->iControl, Panic( EAknPanicNullPointer )); - - CEikListBox* listbox = static_cast( iExtension->iControl ); - CListBoxView* view = listbox->View(); - + CListBoxView* view = static_cast( iExtension->iControl )->View(); if (!view->ViewRect().Intersects(aItemRect)) { // outside of the clipping rect -> don't process this item @@ -2349,12 +2216,10 @@ { iExtension->iClippedSubcells = 0; } - - TBool backgroundDrawingSuppressed = listbox->BackgroundDrawingSuppressed(); #ifdef RD_UI_TRANSITION_EFFECTS_LIST MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); - if ( transApi && !backgroundDrawingSuppressed ) + if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); if(transApi->EffectsDisabled()) @@ -2363,13 +2228,10 @@ } } #else - if ( !backgroundDrawingSuppressed ) - { - aGc.SetClippingRect( view->ViewRect() ); - } + CListBoxView* view = static_cast( iExtension->iControl )->View(); + aGc.SetClippingRect( view->ViewRect() ); #endif //RD_UI_TRANSITION_EFFECTS_LIST - TRect vr(view->ViewRect()); - _AKNTRACE("Clipping: Width %d, (%d,%d)", vr.Width(), vr.iTl.iX, vr.iBr.iX ); + if ( UsesScalableLayoutData() ) { /* this is a AvKon list or list is created using methods in aknlists.cpp @@ -2387,7 +2249,7 @@ } #ifdef RD_UI_TRANSITION_EFFECTS_LIST - if ( transApi && !backgroundDrawingSuppressed ) + if ( transApi ) { if(transApi->EffectsDisabled()) { @@ -2397,10 +2259,7 @@ transApi->StopDrawing(); } #else - if ( !backgroundDrawingSuppressed ) - { - aGc.CancelClippingRect(); - } + aGc.CancelClippingRect(); #endif //RD_UI_TRANSITION_EFFECTS_LIST _AKNTRACE_FUNC_EXIT; } @@ -2414,8 +2273,6 @@ TBool aColorIcon, const TRect& aGraphicRect ) const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - // se also eikclbd.cpp ( sigh ). CFbsBitmap* bitmap( aIcon->Bitmap() ); CFbsBitmap* mask( aIcon->Mask() ); @@ -2475,15 +2332,11 @@ const TColors& aColors ) const { _AKNTRACE_FUNC_ENTER; - _AKNTRACE("DrawFormattedSimple: aItemRect=(%d,%d,%d,%d)", - aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, + _AKNTRACE("DrawFormattedSimple: aText=%S, aItemRect=(%d,%d,%d,%d)", + aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, aItemRect.iBr.iY); - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - TRect textRect(aItemRect); - DrawMarkingModeIcons( aProperties, aGc, textRect ); - const TColors *subcellColors = &aColors; TInt lastSubCell = Min( LastSubCell(), KMaxSubCellIndex ); @@ -2507,7 +2360,7 @@ if ( iExtension->iSubCellsMightIntersect ) { - CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, textRect ); + CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aItemRect ); } TInt SCindex=0; @@ -2529,7 +2382,7 @@ ++ subcell; continue; } - + if (!iExtension) break; if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break; if (UseSubCellColors(subcell)) @@ -2542,13 +2395,12 @@ } TRgb color; - CListBoxView* view = static_cast( Control() )->View(); - TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor; + if (aHighlight) { color = subcellColors->iHighlightedText; aGc.SetBrushColor(subcellColors->iHighlightedBack); - if ( AknsUtils::AvkonSkinEnabled() && !useOverrideColor ) + if ( AknsUtils::AvkonSkinEnabled() ) { if ( iExtension->iHighlightedTextColor != NULL ) { @@ -2560,7 +2412,7 @@ { color = subcellColors->iText; aGc.SetBrushColor(subcellColors->iBack); - if ( AknsUtils::AvkonSkinEnabled() && !useOverrideColor ) + if ( AknsUtils::AvkonSkinEnabled() ) { if ( iExtension->iTextColor != NULL ) { @@ -2570,7 +2422,7 @@ } // graphics or text column - if (iExtension->SLAt(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText) + if (iExtension->AtSL(SCindex).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText) { const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); const CFont* cellFont=Font(aProperties, subcell); @@ -2586,7 +2438,7 @@ else { // check if there are icons affecting this text layout - TInt gSC = iExtension->SLAt(SCindex).iConditionValue; // graphical subcell which might affect this text subcell + TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell if (gSC > -1) { @@ -2597,16 +2449,16 @@ TextUtils::ColumnText(tempText,gSC, aText); if (tempText != KNullDesC) { - textLineLayout = iExtension->SLAt(tempIndex).iTextLayout; + textLineLayout = iExtension->AtSL(tempIndex).iTextLayout; break; } - gSC = iExtension->SLAt(tempIndex).iConditionValue; + gSC = iExtension->AtSL(tempIndex).iConditionValue; } } if (gSC == -1) // no affecting icons -> use default layout { - textLineLayout = iExtension->SLAt(SCindex).iTextLayout; + textLineLayout = iExtension->AtSL(SCindex).iTextLayout; } } @@ -2642,16 +2494,8 @@ SetUnderlineStyle( aProperties, aGc, subcell ); // * 2 == leave some room for marquee - const TInt maxlen( KMaxColumnDataLength * 3 ); + const TInt maxlen( KMaxColumnDataLength * 2 ); TBuf convBuf = text.Left(maxlen); - TBool smileyDraw = EFalse; - // do smiley convert before clipping. don't worry marquee now. - if ( iExtension->iSmileyMan && - iExtension->SLAt(SCindex).iSmileyCell && - iExtension->ConvertTextToSmiley( convBuf ) > 0 ) - { - smileyDraw = ETrue; - } // Note that this potentially modifies the text so its lenght in pixels // might increase. Therefore, this should always be done before @@ -2716,16 +2560,7 @@ marquee->Stop(); } - if ( smileyDraw ) - { - TRect tr(textLayout.TextRect()); - _AKNTRACE( "textLayout Width: %d (%d,%d)", tr.Width(), tr.iTl.iX, tr.iBr.iX ); - iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color ); - } - else - { textLayout.DrawText( aGc, convBuf, bidiConv, color ); - } } if ( iExtension->iPictoInterface ) @@ -2800,7 +2635,6 @@ if( !iIconArray ) { - ++ subcell; continue; } @@ -2812,7 +2646,7 @@ index = index & 0xffff; // mask off possible highlight icon __ASSERT_DEBUG((index>=0 && indexCount()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); - TAknWindowLineLayout graphicLayout = iExtension->SLAt(SCindex).iGraphicLayout; + TAknWindowLineLayout graphicLayout = iExtension->AtSL(SCindex).iGraphicLayout; TAknLayoutRect graphicRect; graphicRect.LayoutRect(textRect,graphicLayout); @@ -2846,72 +2680,6 @@ _AKNTRACE_FUNC_EXIT; } -// ----------------------------------------------------------------------------- -// CFormattedCellListBoxData::DrawMarkingModeIcons -// ----------------------------------------------------------------------------- -// -void CFormattedCellListBoxData::DrawMarkingModeIcons( - TListItemProperties& aProperties, - CWindowGc& aGc, - TRect& aItemRect ) const - { - CEikListBox* listbox = static_cast( Control() ); - TRect textRect( aItemRect ); - - if ( listbox->View()->ItemDrawer()->Flags() - & CListItemDrawer::EMarkingModeEnabled - && !aProperties.IsSelectionHidden() - && iExtension->iMarkingIconArray - && iExtension->iMarkingIconArray->Count() - == KMarkingModeIconArraySize ) - { - if ( AknLayoutUtils::LayoutMirrored() ) - { - textRect.iBr.iX -= - AknLayoutScalable_Avkon::list_double_graphic_pane_t1( - 0 ).LayoutLine().ir; - } - else - { - textRect.iTl.iX += - AknLayoutScalable_Avkon::list_double_graphic_pane_t1( - 0 ).LayoutLine().il; - } - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( aItemRect, - AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) ); - - // unchecked icon - CGulIcon* icon = ( *iExtension->iMarkingIconArray )[1]; - - if ( listbox->View()->ItemIsSelected( - iExtension->iCurrentlyDrawnItemIndex ) ) - { - icon = ( *iExtension->iMarkingIconArray )[0]; - } - - CFbsBitmap* bitmap = icon->Bitmap(); - - if ( bitmap ) - { - TSize size( bitmap->SizeInPixels() ); // set size if not already - TSize targetSize( layoutRect.Rect().Size() ); - - if ( size.iWidth != targetSize.iWidth && - size.iHeight != targetSize.iHeight ) - { - AknIconUtils::SetSize( bitmap, targetSize, - EAspectRatioPreservedAndUnusedSpaceRemoved ); - } - aGc.BitBltMasked( layoutRect.Rect().iTl, - bitmap, - TRect( layoutRect.Rect().Size() ), - icon->Mask(), EFalse ); - } - aItemRect = textRect; - } - } EXPORT_C CFormattedCellListBoxData::CFormattedCellListBoxData() @@ -3077,9 +2845,9 @@ { _AKNTRACE_FUNC_ENTER; const TRect &aItemRect = aRect; - - DrawDefaultHighlight( aGc, aItemRect, aHighlight ); - + + DrawPopupHighlight(aGc, aItemRect, aHighlight); + // Draw the actual items. DrawFormatted(aProperties,aGc,aText,aItemRect,aHighlight,aColors); _AKNTRACE_FUNC_EXIT; @@ -3087,9 +2855,7 @@ void CFormattedCellListBoxData::DrawDefaultHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const { - _AKNTRACE_FUNC_ENTER; - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - + _AKNTRACE_FUNC_ENTER; // When this flag set, draw pressed down state and don't use animation. // There are several derived CListboxData in this file. All of them do // this same thing. @@ -3182,19 +2948,53 @@ _AKNTRACE_FUNC_EXIT; } +void CFormattedCellListBoxData::DrawSettingHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const + { + _AKNTRACE_FUNC_ENTER; + DrawDefaultHighlight( aGc, aItemRect, aHighlight ); + _AKNTRACE_FUNC_EXIT; + } + +void CFormattedCellListBoxData::DrawPopupHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const + { + _AKNTRACE_FUNC_ENTER; + DrawDefaultHighlight( aGc, aItemRect, aHighlight ); + _AKNTRACE_FUNC_EXIT; + } + +void CFormattedCellListBoxData::DrawPopupFrame(CWindowGc &aGc) const + { + _AKNTRACE_FUNC_ENTER; + CCoeControl* control = Control(); + + if ( control ) + { + aGc.SetPenStyle( CGraphicsContext::ENullPen ); + + TBool done = AknsDrawUtils::Background( AknsUtils::SkinInstance(), + iExtension->iPopupFrame, + control, + aGc, + control->Rect() ); + + if ( !done ) + { + aGc.Clear( control->Rect() ); + } + } + _AKNTRACE_FUNC_EXIT; + } void CFormattedCellListBoxData::SetWordWrappedSubcellIndices( TInt aFirstIndex, TInt aSecondIndex ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iFirstWordWrappedSubcellIndex = (TInt16)aFirstIndex; iExtension->iSecondWordWrappedSubcellIndex = (TInt16)aSecondIndex; } EXPORT_C void CFormattedCellListBoxData::EnableMarqueeL(TBool aEnable) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); // CreateMarqueeControlL does nothing if marquee already exists, // so let's just call it just in case. CreateMarqueeControlL(); @@ -3206,13 +3006,11 @@ #ifdef __WINS__ EXPORT_C const TBool CFormattedCellListBoxData::IsMarqueeOn() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->IsMarqueeOn(); } #else EXPORT_C TBool CFormattedCellListBoxData::IsMarqueeOn() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->IsMarqueeOn(); } #endif // __WINS__ @@ -3220,20 +3018,17 @@ void CFormattedCellListBoxData::FocusGained() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->FocusGained(); } void CFormattedCellListBoxData::FocusLost() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->FocusLost(); } void CFormattedCellListBoxData::HandleResourceChange( TInt aType ) { _AKNTRACE_FUNC_ENTER; - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); // Animation is skin dependent, whenever skin changes animation changes // too. if( KAknsMessageSkinChange == aType ) @@ -3267,8 +3062,9 @@ // EXPORT_C const CAknsEffectAnim* CFormattedCellListBoxData::HighlightAnim() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iAnimation; + if( iExtension ) + return iExtension->iAnimation; + return NULL; } // ----------------------------------------------------------------------------- @@ -3277,7 +3073,10 @@ // EXPORT_C void CFormattedCellListBoxData::AboutToDrawHighlightAnim() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if( !iExtension ) + { + return; + } if( !iExtension->iAnimation || !iExtension->iControl ) { return; @@ -3306,8 +3105,10 @@ EXPORT_C void CFormattedCellListBoxData::SetHighlightAnimBackgroundDrawer( MListBoxAnimBackgroundDrawer* aDrawer ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iHighlightBgDrawer = aDrawer; + if( iExtension ) + { + iExtension->iHighlightBgDrawer = aDrawer; + } } // ----------------------------------------------------------------------------- @@ -3316,12 +3117,14 @@ // EXPORT_C void CFormattedCellListBoxData::SetItemCellSize( const TSize& aSize ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if( iExtension->iAnimSize != aSize ) + if( iExtension ) { - iExtension->Play(); + if( iExtension->iAnimSize != aSize ) + { + iExtension->Play(); + } + iExtension->iAnimSize = aSize; } - iExtension->iAnimSize = aSize; } // ----------------------------------------------------------------------------- @@ -3330,8 +3133,11 @@ // EXPORT_C TBool CFormattedCellListBoxData::HasHighlightAnim() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return ( iExtension->iAnimation != NULL ); + if( !iExtension ) + return EFalse; + if( !iExtension->iAnimation ) + return EFalse; + return ETrue; } // ----------------------------------------------------------------------------- @@ -3341,7 +3147,9 @@ EXPORT_C TBool CFormattedCellListBoxData::DrawHighlightAnim( CBitmapContext& aGc, const TRect& aRect ) const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if( !iExtension ) + return EFalse; + if( !iExtension->iAnimation ) return EFalse; @@ -3350,7 +3158,6 @@ void CFormattedCellListBoxData::ResetMarquee() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if (iExtension->iMarquee) { iExtension->iMarquee->Reset(); @@ -3363,7 +3170,6 @@ TInt CFormattedCellListBoxData::CurrentMarqueeItemIndex() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->iCurrentItem; } @@ -3371,7 +3177,6 @@ { _AKNTRACE("CFormattedCellListBoxData::SetCurrentMarqueeItemIndex aIndex=%d", aIndex); - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iCurrentItem = aIndex; } @@ -3379,7 +3184,6 @@ void CFormattedCellListBoxData::SetCurrentItemIndex(TInt aIndex) { _AKNTRACE("CFormattedCellListBoxData::SetCurrentItemIndex aIndex=%d", aIndex); - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if( iExtension->iCurrentRow != aIndex ) { iExtension->iAnimFlags.Set( CFormattedCellListBoxDataExtension::EFlagUpdateBg ); @@ -3391,14 +3195,16 @@ { _AKNTRACE("CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex aIndex=%d", aIndex); - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iCurrentlyDrawnItemIndex = aIndex; + if ( iExtension ) + { + iExtension->iCurrentlyDrawnItemIndex = aIndex; + } } EXPORT_C const CFont* CFormattedCellListBoxData::RowAndSubCellFont(TInt aRow,TInt aSubCellIndex) const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if (!iExtension) return 0; TInt index = 0; if (iExtension->FindRowAndSubCellIndex(index,aRow,aSubCellIndex)!=0) return 0; @@ -3409,7 +3215,7 @@ TInt aSubCellIndex, const CFont* aFont) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if (!iExtension) return; TInt index = 0; iExtension->FindRowAndSubCellIndexOrAddL(index,aRowIndex,aSubCellIndex); iExtension->At(index).iFont=aFont; @@ -3421,7 +3227,6 @@ */ EXPORT_C void CFormattedCellListBoxData::SetDrawBackground(const TBool aDrawBackground) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iDrawBackground = aDrawBackground; if( !aDrawBackground ) { @@ -3434,7 +3239,6 @@ */ TBool CFormattedCellListBoxData::IsBackgroundDrawingEnabled() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->iDrawBackground; } @@ -3445,7 +3249,6 @@ */ void CFormattedCellListBoxData::SetDrawScrollbarBackground(const TBool aDrawBackground) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iDrawScrollbarBackground = aDrawBackground; } @@ -3454,7 +3257,6 @@ */ TBool CFormattedCellListBoxData::IsScrollbarBackgroundDrawingEnabled() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); return iExtension->iDrawScrollbarBackground; } @@ -3462,7 +3264,6 @@ EXPORT_C void CFormattedCellListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, const TInt aScrollDelay, const TInt aInterval) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); if ( iExtension->iMarquee ) { iExtension->iMarquee->SetLoops( aLoops ); @@ -3482,8 +3283,7 @@ EXPORT_C void CFormattedCellListBoxData::SetSubCellIconSize(TInt aIndex, TSize aSize) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( aIndex <= KMaxSubCellIndex && aIndex >= 0) + if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0) { iExtension->iSubCellIconSize[aIndex] = aSize; } @@ -3491,8 +3291,7 @@ TSize CFormattedCellListBoxData::GetSubCellIconSize(TInt aIndex) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( aIndex <= KMaxSubCellIndex && aIndex >= 0) + if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0) { return iExtension->iSubCellIconSize[aIndex]; } @@ -3561,8 +3360,6 @@ // extended skin support void CFormattedCellListBoxData::SetESSTextColor( TAknsQsnTextColorsIndex aIndex ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - TRgb color; TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), @@ -3579,7 +3376,6 @@ // extended skin support void CFormattedCellListBoxData::SetESSHighlightedTextColor( TAknsQsnTextColorsIndex aIndex ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); TRgb color; TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), @@ -3596,7 +3392,7 @@ void CFormattedCellListBoxData::SetGraphicSubCellL( TInt aSubCell, const TAknWindowLineLayout &aGraphicLayout ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) return; CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); // this does happen with caknsetstyle, caknform(wide)style lists. // eventually they'll get here again with list!=0, so this check is enough @@ -3604,9 +3400,9 @@ TInt index = 0; iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); - iExtension->SLAt(index).iTextLayout=NULL; - iExtension->SLAt(index).iGraphicLayout=aGraphicLayout; - iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic; + iExtension->AtSL(index).iTextLayout=NULL; + iExtension->AtSL(index).iGraphicLayout=aGraphicLayout; + iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic; // For compabitility - needed at least for text wrapping. // Beware - some of these WILL be overriden if you got here trough @@ -3645,7 +3441,7 @@ void CFormattedCellListBoxData::SetTextSubCellL( TInt aSubCell, const TAknTextLineLayout &aTextLayout ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if (!iExtension) return; CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); // this does happen with caknsetstyle, caknform(wide)style lists. // eventually they'll get here again with list!=0, so this check is enough @@ -3653,9 +3449,9 @@ TInt index = 0; iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); - iExtension->SLAt(index).iTextLayout=aTextLayout; - iExtension->SLAt(index).iGraphicLayout=NULL; - iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText; + iExtension->AtSL(index).iTextLayout=aTextLayout; + iExtension->AtSL(index).iGraphicLayout=NULL; + iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText; // For compabitility - needed at least for text wrapping. @@ -3698,7 +3494,6 @@ const TAknTextLineLayout &aTextLayout, TInt aAffectedSubCell) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); // iConditionValue of affected subcell (=text subcell, which has different layouts) // contains index of graphical subcell, which existence should be checked first. // This graphical subcell has in iConditionValue index of graphical subcell, @@ -3708,6 +3503,8 @@ // for compabitility - needed at least for text wrapping SetNotAlwaysDrawnSubCellL( aSubCell, ETrue ); + if (!iExtension) return; + TInt i = 0x01; i = i << aSubCell; iExtension->iConditionalCells = iExtension->iConditionalCells | i; @@ -3715,22 +3512,22 @@ TInt graphicalIndex = 0; if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found // conditional layoutline can be only added to graphical subcells - if (iExtension->SLAt(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return; + if (iExtension->AtSL(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return; TInt textIndex = 0; // index of affected subcell if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found // affected subcell can only be text subcell - if (iExtension->SLAt(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return; + if (iExtension->AtSL(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return; - TInt gSC = iExtension->SLAt(textIndex).iConditionValue; // text subcell to be added in priority chain + TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain while (gSC > -1) { if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found - gSC = iExtension->SLAt(textIndex).iConditionValue; + gSC = iExtension->AtSL(textIndex).iConditionValue; } - iExtension->SLAt(textIndex).iConditionValue = aSubCell; // add next subcell to chain - iExtension->SLAt(graphicalIndex).iTextLayout=aTextLayout; + iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain + iExtension->AtSL(graphicalIndex).iTextLayout=aTextLayout; iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) ); @@ -3743,8 +3540,8 @@ { iExtension->iMarginRect.BoundingRect( r ); } + CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST - CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); if ( transApi ) @@ -3764,40 +3561,50 @@ // TBool CFormattedCellListBoxData::UsesScalableLayoutData() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iSimpleList; + if (iExtension) + return iExtension->iSimpleList; + + return EFalse; } void CFormattedCellListBoxData::UseScalableLayoutData( TBool aUse ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( !aUse && iExtension->iSimpleList ) + if ( iExtension ) { + if ( !aUse && iExtension->iSimpleList ) + { #ifdef RD_UI_TRANSITION_EFFECTS_LIST - CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); - MAknListBoxTfxInternal* transApi = - CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); - if ( transApi ) - { - transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) ); - transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) ); + CEikFormattedCellListBox* list = static_cast( iExtension->iControl ); + MAknListBoxTfxInternal* transApi = + CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); + if ( transApi ) + { + transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) ); + transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) ); + } +#endif } -#endif + iExtension->iSimpleList = aUse; } - iExtension->iSimpleList = aUse; } EXPORT_C void CFormattedCellListBoxData::SetSubcellUnderlined( TBitFlags32 aUnderlinedCells ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iUnderlineFlagSet = ETrue; - iExtension->iUnderlineFlags = aUnderlinedCells; + if ( iExtension ) + { + iExtension->iUnderlineFlagSet = ETrue; + iExtension->iUnderlineFlags = aUnderlinedCells; + } } void CFormattedCellListBoxData::SetUnderlineStyle( TListItemProperties aProperties, CWindowGc& aGc, TInt aSubCell ) const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return; + } + if ( !iExtension->iUnderlineFlagSet ) { // underlining is already either on or off and @@ -3820,14 +3627,19 @@ void CFormattedCellListBoxData::UseHighlightIconSwapping( TBool aUse ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iUseHighligthIconSwapping = aUse; + if ( iExtension ) + { + iExtension->iUseHighligthIconSwapping = aUse; + } } TBool CFormattedCellListBoxData::UseHighlightIconSwapping() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iUseHighligthIconSwapping; + if ( iExtension ) + { + return iExtension->iUseHighligthIconSwapping; + } + return EFalse; } // ----------------------------------------------------------------------------- @@ -3883,19 +3695,16 @@ TInt aNormalSubCell, TInt aStretchedSubCell ) { - _AKNTRACE_FUNC_ENTER; if ( Layout_Meta_Data::IsLandscapeOrientation() && Layout_Meta_Data::IsListStretchingEnabled() && StretchingEnabled() ) { - _AKNTRACE("Layout_Meta_Data::IsListStretchingEnabled"); SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell ); } else { SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell ); } - _AKNTRACE_FUNC_EXIT; } @@ -3905,7 +3714,11 @@ // void CFormattedCellListBoxData::ResetSLSubCellArray() { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return; + } + iExtension->iMarginRect = TRect::EUninitialized; UseScalableLayoutData( EFalse ); @@ -3923,7 +3736,11 @@ TBool CFormattedCellListBoxData::StretchingEnabled() const { #ifdef RD_LIST_STRETCH - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return EFalse; + } + return iExtension->iStretchingEnabled; #else return EFalse; @@ -3937,7 +3754,11 @@ // void CFormattedCellListBoxData::EnableStretching( const TBool aEnabled ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return; + } + iExtension->iStretchingEnabled = aEnabled; } @@ -3947,7 +3768,11 @@ // void CFormattedCellListBoxData::HideSecondRow( const TBool aHide ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return; + } + iExtension->iHideSecondRow = aHide; } #endif // RD_LIST_STRETCH @@ -3958,7 +3783,11 @@ // TBool CFormattedCellListBoxData::SecondRowHidden() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return EFalse; + } + return iExtension->iHideSecondRow; } @@ -3968,7 +3797,10 @@ // void CFormattedCellListBoxData::ToggleDropShadows( const TBool aEnable ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); + if ( !iExtension ) + { + return; + } iExtension->iUseDropShadows = aEnable; } @@ -3982,7 +3814,6 @@ const TDesC& aText, const TRect& aItemRect ) const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); TInt subCell = 0; TInt subCell2; TInt subCellIndex; @@ -4066,9 +3897,9 @@ if ( aResults[subCell] ) { - if ( iExtension->SLAt( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText ) + if ( iExtension->AtSL( subCellIndex ).iSubCellType == CFormattedCellListBoxDataExtension::EAknSLText ) { - TAknTextLineLayout textLine = iExtension->SLAt( subCellIndex ).iTextLayout; + TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout; textLine.iW = bRect.Width(); @@ -4095,7 +3926,6 @@ // void CFormattedCellListBoxData::SubCellsMightIntersect( const TBool aMightIntersect ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); iExtension->iSubCellsMightIntersect = aMightIntersect; } @@ -4195,12 +4025,6 @@ } -struct TCellInfo - { - TBool iTextNull; - TPtrC iTextPtr; - }; - void CFormattedCellListBoxData::DrawFormattedOld( TListItemProperties& aProperties, CWindowGc& aGc, @@ -4210,75 +4034,48 @@ const TColors& aColors ) const { _AKNTRACE_FUNC_ENTER; - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - _AKNTRACE( "DrawFormattedOld: aText=%S, aItemRect=(%d,%d,%d,%d)", - aText, aItemRect.iTl.iX, - aItemRect.iTl.iY, - aItemRect.iBr.iX, - aItemRect.iBr.iY ); - - TRect itemRect( aItemRect ); + TRect aRect(aItemRect); + const TColors *subcellColors = &aColors; - TInt lastSubCell = LastSubCell(); - if ( lastSubCell == KErrNotFound ) + TInt lastSubCell=LastSubCell(); + if (lastSubCell==KErrNotFound) { - aGc.UseFont( CEikonEnv::Static()->NormalFont() ); - // Use draw text so that there's no need to change pen color/style. - aGc.DrawText( TPtrC(), itemRect, 0 ); + aGc.UseFont(CEikonEnv::Static()->NormalFont()); + aGc.DrawText(TPtrC(),aRect,0); // use draw text so that don't need to change pen color/style aGc.DiscardFont(); // Release the font cache - _AKNTRACE_FUNC_EXIT; return; } - - CEikListBox* listbox = static_cast( Control() ); - - DrawMarkingModeIcons( aProperties, aGc, itemRect ); - TInt iconOffset = aItemRect.Width() - itemRect.Width(); - - const TColors* subcellColors = &aColors; - const CFont* font=SubCellFont(0); if (font==NULL) { font=CEikonEnv::Static()->NormalFont(); } - TRect textRect( itemRect ); - textRect.iBr.iX = itemRect.iTl.iX; + TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels()); + TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels(); + TRect textRect=aRect; + textRect.iBr.iX=aRect.iTl.iX; TInt subcell=0; TInt subcell2=0; - - TCellInfo textNull[30]; + TPtrC text; + TBool textNull[30]; + TRgb bmpBackColor, bmpForeColor; TRect textShadowRect; // For transparent list TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text. + MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() ); TBool layoutMirrored = AknLayoutUtils::LayoutMirrored(); TBool skinEnabled = AknsUtils::AvkonSkinEnabled(); + if (!cc) + { + cc = SkinBackgroundContext(); + } + + Mem::FillZ( textNull, sizeof( textNull ) ); // cache the text states. subcell = 0; - - SSubCell defaultCell; - TMargins tm = {0,0,0,0}; - defaultCell.iPosition = TPoint(0,0); - defaultCell.iSize = TSize(0,0); - defaultCell.iRealSize = TSize(0,0); - defaultCell.iRealTextSize = TSize(0,0); - defaultCell.iMargin = tm; - defaultCell.iUseSubCellColors = EFalse; - defaultCell.iColors = defaultcolors; - defaultCell.iGraphics = EFalse; - defaultCell.iAlign = CGraphicsContext::ELeft; - defaultCell.iBaseline = 0; - defaultCell.iNumberCell = EFalse; - defaultCell.iTextClipGap = 0; - defaultCell.iNotAlwaysDrawn = EFalse; - defaultCell.iTransparent = EFalse; - defaultCell.iBaseFont = 0; - SSubCell* sc; - - for(;;) { if (subcell>lastSubCell) @@ -4286,27 +4083,10 @@ break; } - TInt subcellindex = 0; - TInt subcellfound = 0; - subcellfound = FindSubCellIndex(subcellindex,subcell); - if (subcellfound != KErrNotFound) - { - sc = &(iSubCellArray->At(subcellindex)); - } - else + TextUtils::ColumnText(text,subcell, aText); + if (text == KNullDesC && SubCellIsNotAlwaysDrawn(subcell)) { - sc = &defaultCell; - } - - TextUtils::ColumnText(textNull[subcell].iTextPtr,subcell, aText); - - if (textNull[subcell].iTextPtr == KNullDesC && sc->iNotAlwaysDrawn) - { - textNull[subcell].iTextNull = ETrue; - } - else - { - textNull[subcell].iTextNull = EFalse; + textNull[subcell] = ETrue; } subcell++; @@ -4322,59 +4102,33 @@ break; } - if (textNull[subcell].iTextNull) + if (textNull[subcell]) { ++subcell; continue; } - TInt subcellindex = 0; - TInt subcellfound = 0; - subcellfound = FindSubCellIndex(subcellindex,subcell); - if (subcellfound != KErrNotFound) - { - sc = &(iSubCellArray->At(subcellindex)); - } - else - { - sc = &defaultCell; - } + TRect bRect(SubCellPosition(subcell),SubCellSize(subcell)); + TMargins m(SubCellMargins(subcell)); + TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); - TRect bRect = TRect(sc->iPosition,sc->iSize); - bRect.iBr.iX -= iconOffset; - TMargins m = sc->iMargin; - TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); - const TBool istrans = sc->iTransparent; - if (!layoutMirrored) + for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) { - for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) + if (textNull[subcell2]) { - if (textNull[subcell2].iTextNull) - { - continue; - } - - // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! - TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) ); - if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) + continue; + } + + // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! + TRect bRect2 = TRect(SubCellPosition(subcell2),SubCellSize(subcell2)); + if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !SubCellIsTransparent(subcell) && !SubCellIsTransparent(subcell2)) + { + if (!layoutMirrored) { cRect.iBr.iX = bRect2.iTl.iX; bRect.iBr.iX = bRect2.iTl.iX; } - } - } - else - { - for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) - { - if (textNull[subcell2].iTextNull) - { - continue; - } - - // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! - TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) ); - if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) + else { cRect.iTl.iX = bRect2.iBr.iX; bRect.iTl.iX = bRect2.iBr.iX; @@ -4383,8 +4137,6 @@ } SetSubCellRealTextSize(subcell, cRect.Size()); SetSubCellRealSize(subcell, bRect.Size()); - sc->iRealTextSize = cRect.Size(); - sc->iRealSize = bRect.Size(); subcell++; } @@ -4398,29 +4150,16 @@ break; } - if (textNull[subcell].iTextNull) + if (textNull[subcell]) { ++ subcell; continue; } - - TInt subcellindex = 0; - TInt subcellfound = 0; - subcellfound = FindSubCellIndex(subcellindex,subcell); - if (subcellfound != KErrNotFound) - { - sc = &(iSubCellArray->At(subcellindex)); - } - else - { - sc = &defaultCell; - } - // SetPosition, SetSize and margins support - TRect bRect = TRect(sc->iPosition,sc->iRealSize); - TMargins m = sc->iMargin; - TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),sc->iRealTextSize); + TRect bRect(SubCellPosition(subcell),SubCellRealSize(subcell)); + TMargins m(SubCellMargins(subcell)); + TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),SubCellRealTextSize(subcell)); if (bRect.iBr.iX == 0) @@ -4431,38 +4170,37 @@ if ( layoutMirrored ) { - TRect bRect( sc->iPosition, sc->iSize ); - bRect.iBr.iX -= iconOffset; - TRect cRect2( bRect.iTl + TSize( m.iLeft, m.iTop ), - bRect.Size() - TSize( m.iRight + m.iLeft, - m.iBottom + m.iTop ) ); + TRect bRect = TRect(SubCellPosition(subcell),SubCellSize(subcell)); + TRect cRect2 = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); - TInt shift = (cRect2.Size() - sc->iRealTextSize).iWidth; + TInt shift = (cRect2.Size() - SubCellRealTextSize(subcell)).iWidth; cRect.iTl.iX += shift; cRect.iBr.iX += shift; } - textRect = TRect( itemRect.iTl + cRect.iTl, cRect.Size() ); + textRect.SetRect(aItemRect.iTl+cRect.iTl,cRect.Size()); - if (sc->iUseSubCellColors) + if (UseSubCellColors(subcell)) { - subcellColors = &sc->iColors; + subcellColors = &SubCellColors(subcell); } else { subcellColors = &aColors; } - CListBoxView* view = listbox->View(); - TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor; + if (aHighlight) { aGc.SetPenColor(subcellColors->iHighlightedText); aGc.SetBrushColor(subcellColors->iHighlightedBack); - if ( skinEnabled && !useOverrideColor ) + bmpBackColor = subcellColors->iHighlightedBack; + bmpForeColor = subcellColors->iHighlightedText; + if ( skinEnabled && iExtension ) { if ( iExtension->iHighlightedTextColor != NULL ) { aGc.SetPenColor( iExtension->iHighlightedTextColor ); + bmpForeColor = iExtension->iHighlightedTextColor; } } } @@ -4470,12 +4208,15 @@ { aGc.SetPenColor(subcellColors->iText); aGc.SetBrushColor(subcellColors->iBack); + bmpBackColor = subcellColors->iBack; + bmpForeColor = subcellColors->iText; - if ( skinEnabled && !useOverrideColor ) + if ( skinEnabled && iExtension ) { if ( iExtension->iTextColor != NULL ) { aGc.SetPenColor( iExtension->iTextColor ); + bmpForeColor = iExtension->iTextColor; } } } @@ -4484,60 +4225,56 @@ // The following draws subcells to textRect if (textRect.iBr.iX!=textRect.iTl.iX) - { + { + TextUtils::ColumnText(text,subcell,aText); + // graphics or text column - CGraphicsContext::TTextAlign align=sc->iAlign; - if (!sc->iGraphics) + CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); + if (!SubCellIsGraphics(subcell)) { const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); - const CFont* cellFont=sc->iBaseFont; + const CFont* cellFont=Font(aProperties, subcell); const CFont* tempFont=(cellFont) ? cellFont : font; const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont; aGc.UseFont(usedFont); SetUnderlineStyle( aProperties, aGc, subcell ); // baseline calc needed for each cell. - TInt baseLineOffset = sc->iBaseline; + baseLineOffset = SubCellBaselinePos(subcell); baseLineOffset -= cRect.iTl.iY; if (!baseLineOffset) { baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels(); } - TBuf clipbuf;// = sc->iColumnText.Left(KMaxColumnDataLength); + TBuf clipbuf = + text.Left(KMaxColumnDataLength); // Note that this potentially modifies the text so its lenght in pixels // might increase. Therefore, this should always be done before // wrapping/clipping text. In some cases, WordWrapListItem is called // before coming here. Is it certain that it is not done for number subcells? - TBool bufset = EFalse; - if (sc->iNumberCell) + if (SubCellIsNumberCell(subcell)) { - clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength); AknTextUtils::LanguageSpecificNumberConversion(clipbuf); - bufset = ETrue; } TBool clipped( EFalse ); - TInt clipgap = sc->iTextClipGap; + TInt clipgap = SubCellTextClipGap( subcell ); if ( iExtension->iUseLogicalToVisualConversion && subcell != iExtension->iFirstWordWrappedSubcellIndex && subcell != iExtension->iSecondWordWrappedSubcellIndex ) { TInt maxClipWidth = textRect.Size().iWidth + clipgap; - + clipped = AknBidiTextUtils::ConvertToVisualAndClip( - textNull[subcell].iTextPtr.Left(KMaxColumnDataLength), + text.Left(KMaxColumnDataLength), clipbuf, *usedFont, - textRect.Width(), + textRect.Size().iWidth, maxClipWidth ); } - else if (!bufset) - { - clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength); - } if (clipped) { @@ -4573,14 +4310,15 @@ iExtension->i2ndLineMarquee; TBool marqueeDisabled = - listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; + static_cast( + Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled ) { // Let marquee know if it needs to do bidi conversion. marquee->UseLogicalToVisualConversion( clipped ); - if ( marquee->DrawText( aGc, textRect, textNull[subcell].iTextPtr, baseLineOffset, align, *usedFont ) ) + if ( marquee->DrawText( aGc, textRect, text, baseLineOffset, align, *usedFont ) ) { // All the loops have been executed -> the text needs to be truncated. aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); @@ -4627,7 +4365,7 @@ } else // Graphics subcell { - TLex lex(textNull[subcell].iTextPtr); + TLex lex(text); TInt index; __ASSERT_ALWAYS(lex.Val(index)==KErrNone,Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); __ASSERT_DEBUG(iIconArray, Panic(EAknPanicOutOfRange)); @@ -4641,38 +4379,39 @@ CGulIcon* icon=(*iIconArray)[index]; CFbsBitmap* bitmap=icon->Bitmap(); - - TInt w, h; - TSize sz = bitmap->SizeInPixels(); - - w = iExtension->iSubCellIconSize[subcell].iWidth; - h = iExtension->iSubCellIconSize[subcell].iHeight; - - if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) ) + if ( iExtension ) { - AknIconUtils::SetSize( bitmap, - iExtension->iSubCellIconSize[subcell], - EAspectRatioPreservedAndUnusedSpaceRemoved ); + TInt w, h; + TSize sz = bitmap->SizeInPixels(); + + w = iExtension->iSubCellIconSize[subcell].iWidth; + h = iExtension->iSubCellIconSize[subcell].iHeight; + + if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) ) + { + AknIconUtils::SetSize( bitmap, + iExtension->iSubCellIconSize[subcell], + EAspectRatioPreservedAndUnusedSpaceRemoved ); + } + else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all + { + // just in case fallback + AknIconUtils::SetSize( bitmap, + textRect.Size(), + EAspectRatioPreservedAndUnusedSpaceRemoved ); + } } - else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all - { - // just in case fallback - AknIconUtils::SetSize( bitmap, - textRect.Size(), - EAspectRatioPreservedAndUnusedSpaceRemoved ); - } - TSize size=bitmap->SizeInPixels(); - if (size.iWidth>textRect.Width()) + if (size.iWidth>textRect.Size().iWidth) { - size.iWidth = textRect.Width(); + size.iWidth = textRect.Size().iWidth; } - if (size.iHeight>textRect.Height()) + if (size.iHeight>textRect.Size().iHeight) { - size.iHeight = textRect.Height(); + size.iHeight = textRect.Size().iHeight; } TPoint bmpPos=textRect.iTl; @@ -4726,56 +4465,38 @@ void CFormattedCellListBoxData::SetClippedByWrap( TUint32 aClippedCells, TBool aUseClippedByWrap ) { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - iExtension->iClippedByWrap = aClippedCells; - iExtension->iUseClippedByWrap = aUseClippedByWrap; + if ( iExtension ) + { + iExtension->iClippedByWrap = aClippedCells; + iExtension->iUseClippedByWrap = aUseClippedByWrap; + } } EXPORT_C TUint32 CFormattedCellListBoxData::CurrentItemTextWasClipped() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iClippedSubcells; + return iExtension ? iExtension->iClippedSubcells : 0; } TBool CFormattedCellListBoxData::KineticScrollingEnabled() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - return iExtension->iKineticScrolling; + if ( iExtension ) + { + return iExtension->iKineticScrolling; + } + return EFalse; } CEikListBox* CFormattedCellListBoxData::ListBox() const { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); - if ( iExtension->iControl ) + if ( iExtension && iExtension->iControl ) { return static_cast( iExtension->iControl ); } return NULL; } -void CFormattedCellListBoxData::InitSmileyL() - { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); - if ( !iExtension->iSmileyMan ) - { - iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension ); - } - } - -void CFormattedCellListBoxData::SetSmileySubCellL( TInt aSubCell ) - { - __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); - TInt index = 0; - if ( iExtension ) - { - iExtension->FindSLSubCellIndexOrAddL( index,aSubCell ); - iExtension->SLAt(index).iSmileyCell = ETrue; - } - } -#ifdef __ARMCC__ -#pragma pop -#endif // __ARMCC__ + // End of File