--- a/menufw/menufwui/mmwidgets/src/mmlistboxitemdrawer.cpp Wed Apr 14 15:47:59 2010 +0300
+++ b/menufw/menufwui/mmwidgets/src/mmlistboxitemdrawer.cpp Tue Apr 27 16:26:12 2010 +0300
@@ -1,22 +1,22 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
+ * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
#include <eikfrlb.h>
+#include <e32math.h>
#include "mmwidgetsconstants.h"
#include "hnconvutils.h"
#include <gdi.h>
@@ -47,13 +47,13 @@
#include "mmmarqueeadapter.h"
#include "mmfloatingitem.h"
#include "mmgridview.h"
+#include "mmlistboxview.h"
#include "mmcacheforitem.h"
#include "mmitemsdatacache.h"
#include "mmwidgetcontainer.h"
#include "hnsuitemodel.h"
#include "menudebug.h"
-
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -71,24 +71,25 @@
iTemplateLibrary = aTemplateLibrary;
iMmModel = aMmListBoxModel;
iRedrawBackground = ETrue;
+ iDrawSeparatorLines = EFalse;
iZoomIconIndex = -1;
iIconAnimationZoomRatio = 1;
// this is needed to get iColors initialized on first use:
iLastDrawnItemWasFloating = ETrue;
SetFlags( CListItemDrawer::EDisableHighlight );
- }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
CMmListBoxItemDrawer::~CMmListBoxItemDrawer()
- {
- iFloatingItems.Close();
- delete iItemsDataCache;
- delete iAnimator;
- delete iSubcellText;
- }
+ {
+ iFloatingItems.Close();
+ delete iItemsDataCache;
+ delete iAnimator;
+ delete iSubcellText;
+ }
// -----------------------------------------------------------------------------
//
@@ -97,7 +98,7 @@
void CMmListBoxItemDrawer::EnableCachedDataUse( TBool aEnable )
{
iUseCache = aEnable;
- if ( aEnable )
+ if( aEnable )
{
RemoveFloatingItems();
}
@@ -138,18 +139,18 @@
//
CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewLC(
CMmListBoxModel* aMmListBoxModel,
- const CFont* aFont,
- CFormattedCellListBoxData* aFormattedCellData,
- TMmWidgetType aWidgetType,
- CMmTemplateLibrary* aTemplateLibrary )
- {
- CMmListBoxItemDrawer* self = new (ELeave)CMmListBoxItemDrawer(
- aMmListBoxModel, aFont, aFormattedCellData, aWidgetType,
- aTemplateLibrary );
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
+ const CFont* aFont,
+ CFormattedCellListBoxData* aFormattedCellData,
+ TMmWidgetType aWidgetType,
+ CMmTemplateLibrary* aTemplateLibrary )
+ {
+ CMmListBoxItemDrawer* self = new ( ELeave ) CMmListBoxItemDrawer(
+ aMmListBoxModel, aFont, aFormattedCellData, aWidgetType,
+ aTemplateLibrary );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
// -----------------------------------------------------------------------------
//
@@ -157,24 +158,24 @@
//
CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewL(
CMmListBoxModel* aMmListBoxModel,
- const CFont* aFont,
- CFormattedCellListBoxData* aFormattedCellData,
- TMmWidgetType aWidgetType,
- CMmTemplateLibrary* aTemplateLibrary )
- {
- CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC(
- aMmListBoxModel, aFont, aFormattedCellData, aWidgetType,
- aTemplateLibrary );
- CleanupStack::Pop( self );
- return self;
+ const CFont* aFont,
+ CFormattedCellListBoxData* aFormattedCellData,
+ TMmWidgetType aWidgetType,
+ CMmTemplateLibrary* aTemplateLibrary )
+ {
+ CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC(
+ aMmListBoxModel, aFont, aFormattedCellData, aWidgetType,
+ aTemplateLibrary );
+ CleanupStack::Pop( self );
+ return self;
- }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::SetView(CEikListBox * aView)
+void CMmListBoxItemDrawer::SetView( CEikListBox * aView )
{
iWidget = aView;
}
@@ -193,40 +194,40 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::ConstructL()
- {
- iAnimator = CMmDrawerAnimator::NewL( *this );
- iItemsDataCache = CMmItemsDataCache::NewL();
- iIsEditMode = EFalse;
- iHighlightShown = EFalse;
- iDrawMoveIndicators = ETrue;
- }
+ {
+ iAnimator = CMmDrawerAnimator::NewL( *this );
+ iItemsDataCache = CMmItemsDataCache::NewL();
+ iIsEditMode = EFalse;
+ iHighlightShown = EFalse;
+ iDrawMoveIndicators = ETrue;
+ }
-// ----xm-------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::DrawEmptyItem( TInt aItemIndex,
- TPoint aItemRectPos, TBool aViewIsDimmed ) const
+ TPoint aItemRectPos, TBool aViewIsDimmed ) const
{
TRect r( aItemRectPos, iItemCellSize );
CFormattedCellListBoxItemDrawer::DrawEmptyItem( aItemIndex, aItemRectPos,
aViewIsDimmed );
- const_cast<CMmListBoxItemDrawer*>(this)->DrawFloatingItems(r);
+ const_cast<CMmListBoxItemDrawer*> ( this )->DrawFloatingItems( r );
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-TInt CMmListBoxItemDrawer::GetFloatingItemIndex(TMmFloatingItemType aType) const
+TInt CMmListBoxItemDrawer::GetFloatingItemIndex( TMmFloatingItemType aType ) const
{
- TInt ret (KErrNotFound);
- TInt i(iFloatingItems.Count()-1);
- for(; i >= 0; i--)
+ TInt ret( KErrNotFound );
+ TInt i( iFloatingItems.Count() - 1 );
+ for( ; i >= 0; i-- )
{
- if (iFloatingItems[i].GetFloatingItemType() == aType)
+ if( iFloatingItems[i].GetFloatingItemType() == aType )
{
ret = i;
break;
@@ -242,9 +243,9 @@
//
TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemL(TMmFloatingItemType aType)
{
- TInt index = GetFloatingItemIndex(aType);
+ TInt index = GetFloatingItemIndex( aType );
User::LeaveIfError( index );
- return iFloatingItems[ index ];
+ return iFloatingItems[index];
}
// -----------------------------------------------------------------------------
@@ -275,6 +276,7 @@
{
iAnimator->AnimateItemZoomL( aItemIndex, ETrue );
iAnimator->Trigger();
+ static_cast<CMmWidgetContainer*> (Widget()->Parent() )->SetAllowMove( EFalse );
}
// -----------------------------------------------------------------------------
@@ -291,42 +293,42 @@
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::DrawFloatingItems(TRect currentlyDrawnRect)
+void CMmListBoxItemDrawer::DrawFloatingItems( TRect currentlyDrawnRect )
{
- TBool redrawItemBackground = IsRedrawItemBackgroundEnabled( );
+ TBool redrawItemBackground = IsRedrawItemBackgroundEnabled();
SetRedrawItemBackground( EFalse );
- for(TInt i(iFloatingItems.Count()-1); i >= 0 ; i--)
+ for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- )
{
TMmFloatingItemType type = iFloatingItems[i].GetFloatingItemType();
- if ( iFloatingItems[i].IsFloatingItemValid() )
+ if( iFloatingItems[i].IsFloatingItemValid() )
{
TInt drawnItemIndex = iFloatingItems[i].GetDrawnItemIndex();
TSize size = iWidget->View()->ItemSize( drawnItemIndex );
TRect rect( iFloatingItems[i].GetItemPosition(), iFloatingItems[i].GetItemPosition() + size);
- if (rect.Intersects(currentlyDrawnRect))
- {
- TInt tempZoomIconIndex = iZoomIconIndex;
- TInt tempZoomRatio = iIconAnimationZoomRatio;
+ if( rect.Intersects( currentlyDrawnRect ) )
+ {
+ TInt tempZoomIconIndex = iZoomIconIndex;
+ TInt tempZoomRatio = iIconAnimationZoomRatio;
- iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex();
- iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio();
+ iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex();
+ iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio();
- if ( ItemHasFloatingType( drawnItemIndex, EDrag) ||
- ItemHasFloatingType( drawnItemIndex, EDragTransition) )
- {
- ClearFlags( CListItemDrawer::EPressedDownState );
- }
+ if ( ItemHasFloatingType( drawnItemIndex, EDrag) ||
+ ItemHasFloatingType( drawnItemIndex, EDragTransition) )
+ {
+ ClearFlags( CListItemDrawer::EPressedDownState );
+ }
- DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse );
- iIconAnimationZoomRatio = tempZoomRatio;
- iZoomIconIndex = tempZoomIconIndex;
- }
+ DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse );
+ iIconAnimationZoomRatio = tempZoomRatio;
+ iZoomIconIndex = tempZoomIconIndex;
+ }
}
else
- {
- iFloatingItems.Remove(i);
- }
+ {
+ iFloatingItems.Remove( i );
+ }
}
SetRedrawItemBackground( redrawItemBackground );
}
@@ -337,11 +339,11 @@
//
TInt CMmListBoxItemDrawer::GetValidFloatingItemCount(TMmFloatingItemType aType)
{
- TInt count (0);
+ TInt count( 0 );
- for(TInt i(iFloatingItems.Count()-1); i >= 0; i--)
+ for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- )
{
- if (iFloatingItems[i].GetFloatingItemType() == aType
+ if( iFloatingItems[i].GetFloatingItemType() == aType
&& iFloatingItems[i].IsFloatingItemValid() )
count++;
}
@@ -351,19 +353,19 @@
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::DrawItem(TInt aItemIndex, TPoint aItemRectPos,
+void CMmListBoxItemDrawer::DrawItem( TInt aItemIndex, TPoint aItemRectPos,
TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized,
TBool aViewIsDimmed) const
+ {
+ if( !Widget()->View()->RedrawDisabled() )
{
- if ( !Widget()->View()->RedrawDisabled() )
- {
- TBool highlightVisible =
+ TBool highlightVisible =
!( Flags() & CListItemDrawer::ESingleClickDisabledHighlight );
- aItemIsCurrent = aItemIsCurrent && highlightVisible;
- DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected,
- aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed);
- }
+ aItemIsCurrent = aItemIsCurrent && highlightVisible;
+ DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected,
+ aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed );
}
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -372,25 +374,25 @@
TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized,
TBool aViewIsDimmed) const
{
- TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent ));
- TRect actualItemRect(aItemRectPos, itemCellSize);
+ TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent ) );
+ TRect actualItemRect( aItemRectPos, itemCellSize );
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
- if ( transApi )
- {
- transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
- transApi->StopDrawing();
- transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem,
- actualItemRect, aItemIndex );
- }
+ MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
+ if( transApi )
+ {
+ transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
+ transApi->StopDrawing();
+ transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem,
+ actualItemRect, aItemIndex );
+ }
#endif
const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse;
- for(TInt i(iFloatingItems.Count()-1); i >= 0; i--)
+ for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- )
{
- if ( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex
- && iFloatingItems[i].IsFloatingItemValid() )
+ if( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex
+ && iFloatingItems[i].IsFloatingItemValid() )
{
const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = ETrue;
break;
@@ -398,20 +400,20 @@
}
DrawActualItem(aItemIndex, actualItemRect, aItemIsCurrent, aViewIsEmphasized,
- aViewIsDimmed, aItemIsSelected);
+ aViewIsDimmed, aItemIsSelected);
const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse;
const_cast<CMmListBoxItemDrawer*>(this)->DrawFloatingItems(actualItemRect);
- if (!AknLayoutUtils::PenEnabled() && IsEditMode())
+ if( !AknLayoutUtils::PenEnabled() && IsEditMode() )
{
- const_cast<CMmListBoxItemDrawer*>(this)->DrawActualIndicatorItem(
- aItemIndex, actualItemRect );
+ const_cast<CMmListBoxItemDrawer*> ( this )->DrawActualIndicatorItem(
+ aItemIndex, actualItemRect );
}
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- if ( transApi )
- {
+ if( transApi )
+ {
transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItemIndex );
}
#endif
@@ -423,12 +425,12 @@
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::DrawItemText(TInt aItemIndex,
- const TRect &aItemTextRect, TBool aItemIsCurrent,
- TBool aViewIsEmphasized, TBool aItemIsSelected ) const
+void CMmListBoxItemDrawer::DrawItemText( TInt aItemIndex,
+ const TRect &aItemTextRect, TBool aItemIsCurrent,
+ TBool aViewIsEmphasized, TBool aItemIsSelected ) const
{
TRAP_IGNORE( DoDrawItemTextL( aItemIndex, aItemTextRect, aItemIsCurrent,
- aViewIsEmphasized, aItemIsSelected ) );
+ aViewIsEmphasized, aItemIsSelected ) );
}
// -----------------------------------------------------------------------------
@@ -436,16 +438,16 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::DoDrawItemTextL( TInt aItemIndex, const TRect
- &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized,
- TBool /* aItemIsSelected */) const
+ &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized,
+ TBool /* aItemIsSelected */) const
{
CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex );
cache->InvalidateIfCacheMayNotBeUsed(
aItemIsCurrent, iLastSubcellsSetupCode );
- if ( IsRedrawItemBackgroundEnabled() )
+ if( IsRedrawItemBackgroundEnabled() )
{
- DrawBackgroundAndSeparatorLines( aItemTextRect );
+ DrawBackground( aItemTextRect );
}
if ( !iUseCache || !cache->IsValid() )
@@ -456,54 +458,63 @@
FormattedCellData()->SetIconArray( cache->GetIconListL() );
- TBool isFloating = !iUseCache && IsFloating( aItemIndex );
- if ( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR
- {
- iLastDrawnItemWasFloating = isFloating;
- iColors = SetupColors( isFloating );
- }
+ TBool isFloating = !iUseCache && IsFloating( aItemIndex );
+ if( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR
+ {
+ iLastDrawnItemWasFloating = isFloating;
+ iColors = SetupColors( isFloating );
+ }
- CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData);
- data->EnableMarqueeL( EFalse );
+ CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData);
+ data->EnableMarqueeL( EFalse );
TBool highlightShown = ETrue;
- if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized)
- {
+ if( FormattedCellData()->RespectFocus() && !aViewIsEmphasized )
+ {
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
- if ( transApi )
- {
- transApi->Remove( MAknListBoxTfxInternal::EListHighlight );
- }
+ MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
+ if( transApi )
+ {
+ transApi->Remove( MAknListBoxTfxInternal::EListHighlight );
+ }
#endif
- highlightShown = EFalse;
- }
+ highlightShown = EFalse;
+ }
data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect,
- GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors );
+ GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors );
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
- if ( transApi )
- {
- transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
- }
+ MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
+ if( transApi )
+ {
+ transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
+ }
#endif
- if ( iMarqueeAdapter && aItemIsCurrent )
- {
- DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee"));
- iMarqueeAdapter->DrawMarqueeL( *iGc );
- }
+ if( iMarqueeAdapter && aItemIsCurrent )
+ {
+ DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee"));
+ iMarqueeAdapter->DrawMarqueeL( *iGc );
+ }
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- if ( transApi )
- {
- transApi->StopDrawing();
- }
+ if( transApi )
+ {
+ transApi->StopDrawing();
+ }
#endif
- ColumnData()->SetIconArray( NULL );
+ if( iDrawSeparatorLines )
+ {
+ CMmListBoxView* view = static_cast<CMmListBoxView*>( iWidget->View() );
+ if( aItemIndex != ( view->ModelItemsCount() - 1 ))
+ {
+ AknListUtils::DrawSeparator( *iGc, aItemTextRect, iColors.iBack );
+ }
+ }
+ ColumnData()->SetIconArray( NULL );
+
}
// -----------------------------------------------------------------------------
@@ -519,29 +530,42 @@
//
// -----------------------------------------------------------------------------
//
+void CMmListBoxItemDrawer::SetDrawSeparatorLines( TBool aDraw )
+ {
+ iDrawSeparatorLines = aDraw;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
TBool CMmListBoxItemDrawer::IsRedrawItemBackgroundEnabled() const
{
return iRedrawBackground;
}
-void CMmListBoxItemDrawer::DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMmListBoxItemDrawer::DrawBackground( const TRect& aItemTextRect ) const
{
MAknsSkinInstance *skin = AknsUtils::SkinInstance();
CCoeControl* control = FormattedCellData()->Control();
- if ( IsRedrawItemBackgroundEnabled() )
+ if( IsRedrawItemBackgroundEnabled() )
{
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
- if ( transApi )
+ MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
+ if( transApi )
{
transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
}
#endif
TBool bgDrawn( EFalse );
- if ( control )
+ if( control )
{
- if ( CAknEnv::Static()->TransparencyEnabled() )
+ if( CAknEnv::Static()->TransparencyEnabled() )
{
bgDrawn = AknsDrawUtils::Background(
skin, iBgContext, control, *iGc, aItemTextRect,
@@ -555,12 +579,12 @@
KAknsDrawParamBottomLevelRGBOnly );
}
}
- if ( !bgDrawn )
+ if( !bgDrawn )
{
iGc->Clear( aItemTextRect );
}
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- if ( transApi )
+ if( transApi )
{
transApi->StopDrawing();
}
@@ -596,7 +620,7 @@
ItemCellSize().iHeight * iIconAnimationZoomRatio);
aSubCellTemplate.iRectAccordingToParent.iTl = TPoint(0, 0);
- SetupSubCellL( aSubCellTemplate, aIndex , aItemIndex);
+ SetupSubCellL( aSubCellTemplate, aIndex, aItemIndex );
}
// -----------------------------------------------------------------------------
@@ -604,72 +628,72 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetupSubCellL( TTemplateChild aSubCellTemplate,
- TInt aIndex, TInt aItemIndex ) const
- {
+ TInt aIndex, TInt aItemIndex ) const
+ {
CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData);
TInt width = aSubCellTemplate.iRectAccordingToParent.iBr.iX - aSubCellTemplate.iRectAccordingToParent.iTl.iX;
TInt height = aSubCellTemplate.iRectAccordingToParent.iBr.iY - aSubCellTemplate.iRectAccordingToParent.iTl.iY;
- data->SetTransparentSubCellL(aIndex, ETrue);
- data->SetSubCellSizeL( aIndex, TSize(width,height));
- data->SetSubCellIconSize( aIndex, TSize(width,height) );
- data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl);
- data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage );
- data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign );
- const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId);
- data->SetSubCellFontL (aIndex, font);
- data->SetSubCellBaselinePosL( aIndex,
- CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline()
- + aSubCellTemplate.iRectAccordingToParent.iTl.iY );
+ data->SetTransparentSubCellL( aIndex, ETrue );
+ data->SetSubCellSizeL( aIndex, TSize( width, height ) );
+ data->SetSubCellIconSize( aIndex, TSize( width, height ) );
+ data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl);
+ data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage );
+ data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign );
+ const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId);
+ data->SetSubCellFontL (aIndex, font);
+ data->SetSubCellBaselinePosL( aIndex,
+ CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline()
+ + aSubCellTemplate.iRectAccordingToParent.iTl.iY );
-// If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData.
-// Setting the subcell size to zero prevents ListBoxData from drawing the text.
- if (!aSubCellTemplate.iIsImage
- && !iIsMarqueeBeingDrawn
- && ( aItemIndex == iWidget->View()->CurrentItemIndex() )
- && !IsEditMode()
- && iWidgetType == EListbox
- && iSubcellText
+ // If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData.
+ // Setting the subcell size to zero prevents ListBoxData from drawing the text.
+ if (!aSubCellTemplate.iIsImage
+ && !iIsMarqueeBeingDrawn
+ && ( aItemIndex == iWidget->View()->CurrentItemIndex() )
+ && !IsEditMode()
+ && iWidgetType == EListbox
+ && iSubcellText
&& iMarqueeAdapter->IsMarqueeEnabled() )
- {
- if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText )
- && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() )
- {
- data->SetSubCellSizeL( aIndex, TSize(0,0));
- const_cast<CMmListBoxItemDrawer*>(this)->AddSubcellMarqueeElementL(
- aSubCellTemplate, aIndex, aItemIndex);
- }
- else if (iMarqueeAdapter)
+ {
+ if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText )
+ && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() )
{
- iMarqueeAdapter->StopMarqueeDrawing(aIndex);
+ data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) );
+ const_cast<CMmListBoxItemDrawer*> ( this )->AddSubcellMarqueeElementL(
+ aSubCellTemplate, aIndex, aItemIndex );
}
- }
+ else if( iMarqueeAdapter )
+ {
+ iMarqueeAdapter->StopMarqueeDrawing( aIndex );
+ }
+ }
- if ( iMarqueeAdapter && iIsMarqueeBeingDrawn
- && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) )
- {
- if (aItemIndex != iWidget->View()->CurrentItemIndex() )
+ if( iMarqueeAdapter && iIsMarqueeBeingDrawn
+ && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) )
+ {
+ if( aItemIndex != iWidget->View()->CurrentItemIndex() )
{
- iMarqueeAdapter->StopMarqueeDrawing(aIndex);
+ iMarqueeAdapter->StopMarqueeDrawing( aIndex );
}
- else
- {
- data->SetSubCellSizeL(aIndex, TSize(0, 0));
- }
+ else
+ {
+ data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) );
+ }
}
- }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
CFormattedCellListBoxData::TColors CMmListBoxItemDrawer::SetupColors( TBool aDragged ) const
- {
- CFormattedCellListBoxData::TColors colors;
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+ {
+ CFormattedCellListBoxData::TColors colors;
+ MAknsSkinInstance* skin = AknsUtils::SkinInstance();
- if ( !aDragged )
- {
+ if( !aDragged )
+ {
AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors,
EAknsCIQsnTextColorsCG9 );
AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors,
@@ -678,9 +702,9 @@
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
AknsUtils::GetCachedColor( skin, colors.iHighlightedBack,
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
- }
- else
- {
+ }
+ else
+ {
AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors,
EAknsCIQsnTextColorsCG11 );
AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors,
@@ -689,10 +713,10 @@
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
AknsUtils::GetCachedColor( skin, colors.iHighlightedBack,
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
- }
+ }
- return colors;
- }
+ return colors;
+ }
// -----------------------------------------------------------------------------
//
@@ -700,8 +724,8 @@
//
TInt CMmListBoxItemDrawer::GetItemHeight( TInt aItemIndex, TBool aItemIsCurrent ) const
{
- TSize ret(TInt(0),TInt(0));
- ret = GetItemSize(aItemIndex, aItemIsCurrent);
+ TSize ret( TInt( 0 ), TInt( 0 ) );
+ ret = GetItemSize( aItemIndex, aItemIsCurrent );
return ret.iHeight;
}
@@ -711,14 +735,14 @@
//
TInt CMmListBoxItemDrawer::GetFloatingItemCount()
{
- for( TInt i=0; i< iFloatingItems.Count(); i++)
- {
- TMmFloatingItem& current = GetFloatingItemAtIndex(i);
- if (current.GetDrawnItemIndex() == KErrNotFound)
- {
- RemoveFloatingItem(i);
- }
- }
+ for( TInt i = 0; i < iFloatingItems.Count(); i++ )
+ {
+ TMmFloatingItem& current = GetFloatingItemAtIndex( i );
+ if( current.GetDrawnItemIndex() == KErrNotFound )
+ {
+ RemoveFloatingItem( i );
+ }
+ }
return iFloatingItems.Count();
}
@@ -729,7 +753,7 @@
//
TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemAtIndex( TInt aIndex )
{
- return iFloatingItems[ aIndex ];
+ return iFloatingItems[aIndex];
}
// -----------------------------------------------------------------------------
@@ -738,10 +762,10 @@
//
void CMmListBoxItemDrawer::RemoveFloatingItem( TInt aPosition )
{
- if (aPosition != KErrNotFound)
- {
- iFloatingItems.Remove( aPosition );
- }
+ if( aPosition != KErrNotFound )
+ {
+ iFloatingItems.Remove( aPosition );
+ }
}
// -----------------------------------------------------------------------------
@@ -761,7 +785,7 @@
TInt aPosition )
{
EnableCachedDataUse( EFalse );
- if (aPosition != KErrNotFound)
+ if( aPosition != KErrNotFound )
{
iFloatingItems.InsertL( aFloatingItem, aPosition );
}
@@ -777,40 +801,40 @@
//
TSize CMmListBoxItemDrawer::GetItemSize( TInt aItemIndex, TBool aItemIsCurrent ) const
{
- if ( aItemIndex < 0 )
+ if( aItemIndex < 0 )
{
return TSize( 1, 1 );
}
- TSize size;
+ TSize size;
- CMmCacheForItem* cache = NULL;
- TRAPD( cacheError, cache = iItemsDataCache->GetItemCacheL( aItemIndex ) );
- if ( cacheError != KErrNone )
- {
- cache = NULL;
- }
+ CMmCacheForItem* cache = NULL;
+ TRAPD( cacheError, cache = iItemsDataCache->GetItemCacheL( aItemIndex ) );
+ if( cacheError != KErrNone )
+ {
+ cache = NULL;
+ }
- if ( cache )
- {
- cache->InvalidateIfCacheMayNotBeUsed(
- aItemIsCurrent, iLastSubcellsSetupCode );
- }
+ if( cache )
+ {
+ cache->InvalidateIfCacheMayNotBeUsed(
+ aItemIsCurrent, iLastSubcellsSetupCode );
+ }
- if ( !iUseCache || !cache || !cache->IsValid() )
+ if( !iUseCache || !cache || !cache->IsValid() )
{
const TDesC8& mm_template = iMmModel->GetAttributeAsText (aItemIndex,
KMmTemplate8);
TRect viewRect = iWidget->View()->ViewRect();
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
- if ( iTemplateLibrary->GetSize( size, iWidgetType, mm_template,
+ if( iTemplateLibrary->GetSize( size, iWidgetType, mm_template,
landscapeOrientation, aItemIsCurrent, viewRect )
!= KErrNone )
{
size = TSize( 1, 1 );
}
- if ( cache )
+ if( cache )
{
cache->SetSize( size );
}
@@ -843,19 +867,19 @@
void CMmListBoxItemDrawer::SetDraggableL( TBool aDraggable )
{
- iDraggable = aDraggable;
+ iDraggable = aDraggable;
- if (!iDraggable)
+ if( !iDraggable )
{
- for(int i=0; i< iFloatingItems.Count(); i++)
+ for( int i = 0; i < iFloatingItems.Count(); i++ )
{
- if (iFloatingItems[i].GetFloatingItemType() == EZoomTransition
- && iFloatingItems[i].GetZoomingStatus() > 0)
+ if( iFloatingItems[i].GetFloatingItemType() == EZoomTransition
+ && iFloatingItems[i].GetZoomingStatus() > 0 )
{
AnimateItemZoomOutL( iFloatingItems[i].GetDrawnItemIndex() );
}
- else if (iFloatingItems[i].GetFloatingItemType() == EDrag
- || iFloatingItems[i].IsManualDelete())
+ else if( iFloatingItems[i].GetFloatingItemType() == EDrag
+ || iFloatingItems[i].IsManualDelete() )
{
iFloatingItems[i].InvalidateFloatingItem();
}
@@ -869,7 +893,7 @@
//
void CMmListBoxItemDrawer::SetEditModeL( TBool aEditMode )
{
- if ( aEditMode )
+ if( aEditMode )
{
EnableCachedDataUse( EFalse );
}
@@ -889,9 +913,9 @@
// -----------------------------------------------------------------------------
//
TBool CMmListBoxItemDrawer::IsEditMode() const
- {
- return iIsEditMode;
- }
+ {
+ return iIsEditMode;
+ }
// -----------------------------------------------------------------------------
//
@@ -917,58 +941,58 @@
floatingItem.SetManualDelete( ETrue );
TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(),
- item.GetItemPosition(), EPostDragRefreshItem,
- MmEffects::KNoAnimationFramesCount, iWidget->View() );
+ item.GetItemPosition(), EPostDragRefreshItem,
+ MmEffects::KNoAnimationFramesCount, iWidget->View() );
- iFloatingItems.Remove(dragFloatingItem);
+ iFloatingItems.Remove( dragFloatingItem );
- if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition())
- {
- iFloatingItems.Append( postDragRefresh );
- }
- iFloatingItems.Insert( floatingItem, 0 );
- }
- }
+ if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition())
+ {
+ iFloatingItems.Append( postDragRefresh );
+ }
+ iFloatingItems.Insert( floatingItem, 0 );
+ }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::SetDraggedIndexL(TInt aDraggedItemIndex,
- TPoint aPoint)
+void CMmListBoxItemDrawer::SetDraggedIndexL( TInt aDraggedItemIndex,
+ TPoint aPoint )
{
TInt dragFloatingItem = KErrNotFound;
do
- {
- dragFloatingItem = GetFloatingItemIndex(EDrag);
- if (dragFloatingItem != KErrNotFound)
- {
- TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem );
+ {
+ dragFloatingItem = GetFloatingItemIndex( EDrag );
+ if( dragFloatingItem != KErrNotFound )
+ {
+ TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem );
- TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(),
- item.GetItemPosition(), EPostDragRefreshItem,
- MmEffects::KNoAnimationFramesCount, iWidget->View() );
+ TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(),
+ item.GetItemPosition(), EPostDragRefreshItem,
+ MmEffects::KNoAnimationFramesCount, iWidget->View() );
- if (postDragRefresh.GetItemPosition() != aPoint)
- {
- iFloatingItems.Append( postDragRefresh );
- }
- }
+ if( postDragRefresh.GetItemPosition() != aPoint )
+ {
+ iFloatingItems.Append( postDragRefresh );
+ }
+ }
- RemoveFloatingItem( dragFloatingItem );
+ RemoveFloatingItem( dragFloatingItem );
- }
- while ( dragFloatingItem != KErrNotFound );
+ }
+ while( dragFloatingItem != KErrNotFound );
- if ( aDraggedItemIndex != KErrNotFound )
- {
- TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag,
- MmEffects::KNoAnimationFramesCount, iWidget->View() );
- floatingItem.SetManualDelete( ETrue );
- AddFloatingItemL(floatingItem, 0);
+ if( aDraggedItemIndex != KErrNotFound )
+ {
+ TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag,
+ MmEffects::KNoAnimationFramesCount, iWidget->View() );
+ floatingItem.SetManualDelete( ETrue );
+ AddFloatingItemL( floatingItem, 0 );
- ClearFlags( CListItemDrawer::EPressedDownState );
- }
+ ClearFlags( CListItemDrawer::EPressedDownState );
+ }
iAnimator->Trigger();
}
@@ -987,45 +1011,45 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetBgContext(
- CAknsBasicBackgroundControlContext * aBgContext )
- {
- iBgContext = aBgContext;
- }
+ CAknsBasicBackgroundControlContext * aBgContext )
+ {
+ iBgContext = aBgContext;
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetScrollbarVisibilityL( TBool aIsScrollbarVisible )
- {
- iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible );
- }
+ {
+ iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible );
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TRect CMmListBoxItemDrawer::AdjustItemRect( TInt aItemIndex ) const
- {
- TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () );
- TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ),
- iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size);
- if ( !AknLayoutUtils::PenEnabled () && iIsIndicatorItem)
- {
- TBool landscapeOrientation =
- Layout_Meta_Data::IsLandscapeOrientation ();
- const TDesC8& mm_template = iMmModel->GetAttributeAsText (
- 0, KMmTemplate8);
- TRect relativeToParentRect = TRect (TPoint (0, 0), TPoint (0, 0));
- relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect(
- iWidgetType, mm_template, landscapeOrientation,
- aItemIndex == iWidget->View()->CurrentItemIndex () );
- rect.Move (relativeToParentRect.iTl);
- rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width ();
- rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height ();
- }
- return rect;
- }
+ {
+ TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () );
+ TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ),
+ iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size);
+ if( !AknLayoutUtils::PenEnabled() && iIsIndicatorItem )
+ {
+ TBool landscapeOrientation =
+ Layout_Meta_Data::IsLandscapeOrientation();
+ const TDesC8& mm_template = iMmModel->GetAttributeAsText (
+ 0, KMmTemplate8);
+ TRect relativeToParentRect = TRect( TPoint( 0, 0 ), TPoint( 0, 0 ) );
+ relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect(
+ iWidgetType, mm_template, landscapeOrientation,
+ aItemIndex == iWidget->View()->CurrentItemIndex () );
+ rect.Move( relativeToParentRect.iTl );
+ rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width();
+ rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height();
+ }
+ return rect;
+ }
// -----------------------------------------------------------------------------
//
@@ -1040,50 +1064,50 @@
IsRedrawItemBackgroundEnabled( );
SetRedrawItemBackground( EFalse );
- DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse);
+ DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse);
- SetRedrawItemBackground( redrawItemBackground );
- iIsIndicatorItem = EFalse;
- }
- }
+ SetRedrawItemBackground( redrawItemBackground );
+ iIsIndicatorItem = EFalse;
+ }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::ReplaceSubCellText( const TDesC& aText )
- {
- delete iSubcellText;
- iSubcellText = NULL;
- if( aText.Compare( KNullDesC() ) )
- {
- iSubcellText = aText.Alloc();
- }
- }
+ {
+ delete iSubcellText;
+ iSubcellText = NULL;
+ if( aText.Compare( KNullDesC() ) )
+ {
+ iSubcellText = aText.Alloc();
+ }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::AddSubcellMarqueeElementL( TTemplateChild aSubCellTemplate, TInt aIndex, TInt aItemIndex )
- {
- TRgb textColor;
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
- AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 );
- iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText,
- aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex,
- aSubCellTemplate.iRectAccordingToParent.iTl.iY,
- aItemIndex);
- }
+ {
+ TRgb textColor;
+ MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+ AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 );
+ iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText,
+ aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex,
+ aSubCellTemplate.iRectAccordingToParent.iTl.iY,
+ aItemIndex);
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter )
- {
- iMarqueeAdapter = aAdapter;
- }
+ {
+ iMarqueeAdapter = aAdapter;
+ }
// -----------------------------------------------------------------------------
//
@@ -1107,17 +1131,17 @@
TInt maxClipWidth = aTemplateChild.iRectAccordingToParent.Width();
const CFont* font = AknLayoutUtils::FontFromId(aTemplateChild.iFontId);
return AknBidiTextUtils::ConvertToVisualAndClipL( clipbuf, *font,
- aTemplateChild.iRectAccordingToParent.Width(), maxClipWidth );
- }
+ aTemplateChild.iRectAccordingToParent.Width(), maxClipWidth );
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::SetNumberOfColsInView(TInt aNumberOfColumns)
- {
- iNumberOfColsInWidget = aNumberOfColumns;
- }
+void CMmListBoxItemDrawer::SetNumberOfColsInView( TInt aNumberOfColumns )
+ {
+ iNumberOfColsInWidget = aNumberOfColumns;
+ }
// -----------------------------------------------------------------------------
//
@@ -1135,80 +1159,86 @@
child.iIsImage = EFalse;
}
- if ( IsDraggable() && aItemIndex == iZoomIconIndex )
- {
- const TReal KNormalZoomRatio = 1.0;
- TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0;
- TSize size = child.iRectAccordingToParent.Size();
- TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta );
- child.iRectAccordingToParent.Grow( sizeDelta );
- }
-
- TSize targetSize = child.iRectAccordingToParent.Size();
+ if( IsEditMode() && IsDraggable() && aItemIndex == iZoomIconIndex )
+ {
+ const TReal KNormalZoomRatio = 1.0;
+ TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0;
+ TSize size = child.iRectAccordingToParent.Size();
+ TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta );
+ child.iRectAccordingToParent.Grow( sizeDelta );
+ TInt targetZoom( KZoomStateZoomRatio * 100 );
+ Math::Round( zoomDelta, ( zoomDelta * 1000 ), 0);
+ if( (TInt)zoomDelta == targetZoom )
+ {
+ static_cast<CMmWidgetContainer*> (Widget()->Parent())->SetAllowMove( ETrue );
+ }
+ }
- CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics(
- aItemIndex, child.iData, &targetSize );
- icon = iconHolder ? iconHolder->GetGulIcon() : NULL;
- if ( icon )
+ TSize targetSize = child.iRectAccordingToParent.Size();
+
+ CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics(
+ aItemIndex, child.iData, &targetSize );
+ icon = iconHolder ? iconHolder->GetGulIcon() : NULL;
+ if( icon )
+ {
+ CFbsBitmap* bitmap = icon->Bitmap();
+ ASSERT( bitmap );
+ //resize the item if it is a move indicator
+ if( iIsIndicatorItem )
{
- CFbsBitmap* bitmap = icon->Bitmap();
- ASSERT( bitmap );
- //resize the item if it is a move indicator
- if( iIsIndicatorItem )
- {
AknIconUtils::SetSize( bitmap, child.iRectAccordingToParent.Size(),
- EAspectRatioNotPreserved );
- }
- else
- {
+ EAspectRatioNotPreserved );
+ }
+ else
+ {
TSize bmpSize = bitmap->SizeInPixels();
TBool setSizeRequired = bitmap->DisplayMode() == ENone;
if ( targetSize.iWidth && targetSize.iHeight &&
( setSizeRequired || !BitmapFitsIntoTarget( bmpSize, targetSize ) ) )
{
- CFbsBitmap* mask = icon->Mask();
- if ( mask )
- {
+ CFbsBitmap* mask = icon->Mask();
+ if( mask )
+ {
__ASSERT_DEBUG( bmpSize == mask->SizeInPixels(), User::Invariant() );
AknIconUtils::SetSize( mask, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved );
}
AknIconUtils::SetSize( bitmap, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved );
- }
}
+ }
TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder );
- HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex );
- const TInt newLength = aItemText.Length() + number->Length();
+ HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex );
+ const TInt newLength = aItemText.Length() + number->Length();
+ if( aItemText.MaxLength() < newLength )
+ {
+ aItemText.ReAllocL( newLength );
+ }
+ CleanupStack::PopAndDestroy( number );
+ aItemText.AppendNum( iconIndex );
+
+ SetupSubCellL( child, aSubcellIncrement, aItemIndex );
+
+ if( aChildIndex < aTemplateChildArray.Count() - 1 )
+ {
+ const TInt newLength = aItemText.Length() + KTab().Length();
if( aItemText.MaxLength() < newLength )
{
aItemText.ReAllocL( newLength );
}
- CleanupStack::PopAndDestroy( number );
- aItemText.AppendNum( iconIndex );
-
- SetupSubCellL( child, aSubcellIncrement, aItemIndex );
+ aItemText.Append( KTab );
+ }
- if ( aChildIndex < aTemplateChildArray.Count() - 1 )
- {
- const TInt newLength = aItemText.Length() + KTab().Length();
- if( aItemText.MaxLength() < newLength )
- {
- aItemText.ReAllocL( newLength );
- }
- aItemText.Append( KTab );
- }
-
- aSubcellIncrement++;
- iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell );
- }
- else
- {
- // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode
- // works properly.
+ aSubcellIncrement++;
+ iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell );
+ }
+ else
+ {
+ // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode
+ // works properly.
iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ESkippedSubcell );
- }
- }
+ }
+ }
// -----------------------------------------------------------------------------
//
@@ -1230,61 +1260,61 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetupTextSubcellL(
- RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex,
- TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const
- {
- TTemplateChild child = aTemplateChildArray[aChildIndex];
- RBuf itemChildText;
- CleanupClosePushL( itemChildText );
- const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex,
- child.iData );
- itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) );
+ RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex,
+ TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const
+ {
+ TTemplateChild child = aTemplateChildArray[aChildIndex];
+ RBuf itemChildText;
+ CleanupClosePushL( itemChildText );
+ const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex,
+ child.iData );
+ itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) );
- AppendText( aItemText, itemChildText );
+ AppendText( aItemText, itemChildText );
- const_cast<CMmListBoxItemDrawer*>(this)->ReplaceSubCellText(
- itemChildText );
- CleanupStack::PopAndDestroy( &itemChildText );
+ const_cast<CMmListBoxItemDrawer*> ( this )->ReplaceSubCellText(
+ itemChildText );
+ CleanupStack::PopAndDestroy( &itemChildText );
- SetupSubCellL( child, aSubcellIncrement, aItemIndex );
+ SetupSubCellL( child, aSubcellIncrement, aItemIndex );
- if ( aChildIndex < aTemplateChildArray.Count() - 1 )
- {
- AppendText( aItemText, KTab );
- }
+ if( aChildIndex < aTemplateChildArray.Count() - 1 )
+ {
+ AppendText( aItemText, KTab );
+ }
- aSubcellIncrement++;
- iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell );
- }
+ aSubcellIncrement++;
+ iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell );
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::AppendText( RBuf& aBuffer, const TDesC& aTextToAppend ) const
- {
- TInt newLength = aBuffer.Length() + aTextToAppend.Length();
- TInt error = KErrNone;
+ {
+ TInt newLength = aBuffer.Length() + aTextToAppend.Length();
+ TInt error = KErrNone;
- if( aBuffer.MaxLength() < newLength )
- {
- error = aBuffer.ReAlloc( newLength );
- }
- if ( error == KErrNone )
- {
- aBuffer.Append( aTextToAppend );
- }
- }
+ if( aBuffer.MaxLength() < newLength )
+ {
+ error = aBuffer.ReAlloc( newLength );
+ }
+ if( error == KErrNone )
+ {
+ aBuffer.Append( aTextToAppend );
+ }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetupBackdropSubcellL(
- RArray<TTemplateChild>& aTemplateChildArray, TInt aItemIndex,
- RBuf& aItemText, TInt& aSubcellIncrement ) const
- {
+ RArray<TTemplateChild>& aTemplateChildArray, TInt aItemIndex,
+ RBuf& aItemText, TInt& aSubcellIncrement ) const
+ {
CGulIcon* icon = NULL;
- for ( TInt i = 0; i < aTemplateChildArray.Count() /*&&
- aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i )
+ for( TInt i = 0; i < aTemplateChildArray.Count() /*&&
+ aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i )
{
TTemplateChild child = aTemplateChildArray[i];
if( child.iImageVisualId == EImageVisualIdEditMode &&
@@ -1294,14 +1324,14 @@
aItemIndex == iWidget->View()->CurrentItemIndex() );
CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( aItemIndex, child.iData, &itemSize );
icon = iconHolder ? iconHolder->GetGulIcon() : NULL;
- if ( icon )
+ if( icon )
{
CFbsBitmap* bitmap = icon->Bitmap();
- child.iRectAccordingToParent = TRect( TPoint( 0, 0 ),
- TPoint( itemSize.iWidth, itemSize.iHeight ) );
- AknIconUtils::SetSize( bitmap, itemSize,
- EAspectRatioNotPreserved );
- TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder );
+ child.iRectAccordingToParent = TRect( TPoint( 0, 0 ),
+ TPoint( itemSize.iWidth, itemSize.iHeight ) );
+ AknIconUtils::SetSize( bitmap, itemSize,
+ EAspectRatioNotPreserved );
+ TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder );
HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex );
TInt newLength = aItemText.Length() + number->Length();
@@ -1324,7 +1354,7 @@
}
}
}
- }
+ }
// -----------------------------------------------------------------------------
//
@@ -1337,7 +1367,7 @@
cache->MarkAsInvalid();
const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 );
- if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) )
+ if( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) )
{
User::Leave( KErrNotFound );
}
@@ -1354,68 +1384,68 @@
RArray<TTemplateChild> templateChildArray;
CleanupClosePushL( templateChildArray );
- if ( !iIsIndicatorItem )
- {
- iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate,
- landscapeOrientation, aItemIsCurrent, IsEditMode() );
- }
+ if( !iIsIndicatorItem )
+ {
+ iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate,
+ landscapeOrientation, aItemIsCurrent, IsEditMode() );
+ }
else if ( !AknLayoutUtils::PenEnabled() )
- {
- iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray,
- mmTemplate, landscapeOrientation, aItemIsCurrent );
- }
+ {
+ iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray,
+ mmTemplate, landscapeOrientation, aItemIsCurrent );
+ }
iLastSubcellsSetupCode.Clear();
//Backdrop icon as first element to draw
TInt subcellIncrement( 0 );
- if ( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) )
+ if( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) )
{
SetupBackdropSubcellL( templateChildArray, aItemIndex, itemText, subcellIncrement );
iItemHasBackdrop = ETrue;
}
else
- {
- iItemHasBackdrop = EFalse;
- }
+ {
+ iItemHasBackdrop = EFalse;
+ }
- for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ )
- {
- TTemplateChild child = templateChildArray[i];
+ for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ )
+ {
+ TTemplateChild child = templateChildArray[i];
if ( child.iImageVisualId == EImageVisualIdEditMode && child.iIsImage )
{
continue;
}
else if( !child.iIsImage )
- {
- SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement );
- }
- else
- {
- SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement );
- }
- }
- TInt subcellsJustSet = subcellIncrement;
- iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet );
- __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount,
- User::Invariant() );
+ {
+ SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement );
+ }
+ else
+ {
+ SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement );
+ }
+ }
+ TInt subcellsJustSet = subcellIncrement;
+ iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet );
+ __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount,
+ User::Invariant() );
- for ( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ )
- {
- SetupSubNoCellL( i, aItemIndex );
- }
+ for( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ )
+ {
+ SetupSubNoCellL( i, aItemIndex );
+ }
- iLastSubcellsSetupCode.AddTemplateInfo(
- iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) );
- iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent );
+ iLastSubcellsSetupCode.AddTemplateInfo(
+ iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) );
+ iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent );
- CleanupStack::PopAndDestroy( &templateChildArray );
+ CleanupStack::PopAndDestroy( &templateChildArray );
- cache->SetSubcellsSetupCode( iLastSubcellsSetupCode );
- // the line below is here only to make the cached information complete
- GetItemSize( aItemIndex, aItemIsCurrent );
- cache->MarkAsValidL();
- }
+ cache->SetSubcellsSetupCode( iLastSubcellsSetupCode );
+ // the line below is here only to make the cached information complete
+ GetItemSize( aItemIndex, aItemIsCurrent );
+ cache->MarkAsValidL();
+ }
// -----------------------------------------------------------------------------
//
@@ -1431,10 +1461,10 @@
// -----------------------------------------------------------------------------
//
void CMmListBoxItemDrawer::SetHighlightShown( TBool aDrawn )
- {
- iHighlightShown = aDrawn;
- iDrawMoveIndicators = aDrawn;
- }
+ {
+ iHighlightShown = aDrawn;
+ iDrawMoveIndicators = aDrawn;
+ }
// -----------------------------------------------------------------------------
//
@@ -1445,16 +1475,16 @@
TBool isFloating( EFalse );
TInt index = GetFloatingItemIndex( EDrag );
- if (index == KErrNotFound)
- {
- index = GetFloatingItemIndex( EDragTransition );
- }
+ if( index == KErrNotFound )
+ {
+ index = GetFloatingItemIndex( EDragTransition );
+ }
- if ( KErrNotFound != index )
+ if( KErrNotFound != index )
{
TMmFloatingItem& current = const_cast<CMmListBoxItemDrawer*>(this)->GetFloatingItemAtIndex( index );
TInt drawnIndex = current.GetDrawnItemIndex();
- if ( drawnIndex == aItemIndex )
+ if( drawnIndex == aItemIndex )
{
isFloating = ETrue;
}
@@ -1466,53 +1496,53 @@
//
// -----------------------------------------------------------------------------
//
-void CMmListBoxItemDrawer::DrawActualItem(TInt aItemIndex,
- const TRect& aActualItemRect, TBool aItemIsCurrent,
- TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/,
- TBool aItemIsSelected) const
- {
- if (Properties(aItemIndex).IsSelectionHidden())
- {
- aItemIsSelected = EFalse;
- }
- DrawItemText(aItemIndex,aActualItemRect,aItemIsCurrent,
- aViewIsEmphasized,aItemIsSelected);
- }
+void CMmListBoxItemDrawer::DrawActualItem( TInt aItemIndex,
+ const TRect& aActualItemRect, TBool aItemIsCurrent,
+ TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/,
+ TBool aItemIsSelected ) const
+ {
+ if( Properties( aItemIndex ).IsSelectionHidden() )
+ {
+ aItemIsSelected = EFalse;
+ }
+ DrawItemText( aItemIndex, aActualItemRect, aItemIsCurrent,
+ aViewIsEmphasized, aItemIsSelected );
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TBool CMmListBoxItemDrawer::GetHighlightVisibility( TInt aItemIndex,
- TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const
- {
- TBool highlightVisibility(EFalse);
- if (!iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item
- {
- TBool currentlyDraggedItem =
- ItemHasFloatingType( aItemIndex, EDrag ) ||
- ItemHasFloatingType( aItemIndex, EDragTransition );
+ TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const
+ {
+ TBool highlightVisibility( EFalse );
+ if( !iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item
+ {
+ TBool currentlyDraggedItem =
+ ItemHasFloatingType( aItemIndex, EDrag ) ||
+ ItemHasFloatingType( aItemIndex, EDragTransition );
- if ( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible()
- && aItemIsCurrent && aAllowHighlightForNonDraggedItem )
- || currentlyDraggedItem )
- {
- highlightVisibility = ETrue;
- }
- }
- return highlightVisibility;
- }
+ if( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible()
+ && aItemIsCurrent && aAllowHighlightForNonDraggedItem )
+ || currentlyDraggedItem )
+ {
+ highlightVisibility = ETrue;
+ }
+ }
+ return highlightVisibility;
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TBool CMmListBoxItemDrawer::GetBackdropVisibility( TInt aItemIndex,
- TBool aItemIsCurrent ) const
- {
- TBool currentlyDraggedItem =
- ItemHasFloatingType( aItemIndex, EDrag ) ||
- ItemHasFloatingType( aItemIndex, EDragTransition );
+ TBool aItemIsCurrent ) const
+ {
+ TBool currentlyDraggedItem =
+ ItemHasFloatingType( aItemIndex, EDrag ) ||
+ ItemHasFloatingType( aItemIndex, EDragTransition );
return IsEditMode() /* draw the backdrop only in edit mode */
&& !currentlyDraggedItem /* backdrop is disabled for dragged items */
@@ -1520,26 +1550,26 @@
&& !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/
&& !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsHighlightVisible()
&& aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/
- }
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TBool CMmListBoxItemDrawer::ItemHasFloatingType( TInt aItemIndex,
- TMmFloatingItemType aFloatingType) const
- {
- TBool hasFloatingType( EFalse );
- for ( TInt i = iFloatingItems.Count() - 1 ; i >= 0; i-- )
+ TMmFloatingItemType aFloatingType ) const
+ {
+ TBool hasFloatingType( EFalse );
+ for( TInt i = iFloatingItems.Count() - 1; i >= 0; i-- )
{
- const TMmFloatingItem& item = iFloatingItems[i];
- if ( item.GetFloatingItemType() == aFloatingType
- && item.GetDrawnItemIndex() == aItemIndex )
+ const TMmFloatingItem& item = iFloatingItems[i];
+ if( item.GetFloatingItemType() == aFloatingType
+ && item.GetDrawnItemIndex() == aItemIndex )
{
hasFloatingType = ETrue;
break;
}
}
- return hasFloatingType;
- }
+ return hasFloatingType;
+ }
// End of file