--- a/uifw/EikStd/coctlsrc/EIKLBV.CPP Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/EikStd/coctlsrc/EIKLBV.CPP Tue Aug 31 15:28:30 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2009 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"
@@ -657,33 +657,15 @@
EXPORT_C TInt CListBoxView::NumberOfItemsThatFitInRect(const TRect& aRect) const
{
- TInt itemNumber = 0;
if (iItemHeight == 0)
{
_AKNTRACE( "Number of items is 0" );
- return itemNumber;
+ return 0;
}
- TInt items = aRect.Height() / iItemHeight;
- TInt extraHeight = aRect.Height() % iItemHeight;
- // if there is offset or extra height, then there is at least one partical
- // displayed item
- if ( iVerticalOffset != 0 || extraHeight > 0 )
- {
- items++;
- }
- // if extra height is not totally taken by top partically displayed item,
- // then there is still place to display a partcial item in bottom. consider
- // a example which view height is 35 and item height is 10, then it's possible
- // to display 5 items with the height like 3,10,10,10,2
- if ( iVerticalOffset != 0 &&
- extraHeight != 0 &&
- ( iItemHeight + iVerticalOffset ) < extraHeight )
- {
- items++;
- }
- itemNumber = items;
- _AKNTRACE( "Number of items is %d", itemNumber );
- return itemNumber;
+ TInt items = aRect.Height() / iItemHeight;
+ if ( ( iVerticalOffset != 0 ) || ( (aRect.Height() - iVerticalOffset) % iItemHeight > 0 ) ) items++;
+ _AKNTRACE( "Number of items is %d", items );
+ return items;
}
EXPORT_C void CListBoxView::DeselectRangeL(TInt aItemIndex1, TInt aItemIndex2)
@@ -833,11 +815,6 @@
}
else // items will get redrawn anyway
{
- // As the iVerticalOffset is changed in CalcNewTopItemIndexSoItemIsVisible(),
- // and ScrollToMakeItemVisible() will call the CalcNewTopItemIndexSoItemIsVisible() again,
- // which will use iVerticalOffset to do some judgementes,
- // we must set iVerticalOffset back to original value.
- iVerticalOffset = oldVerticalOffset;
ScrollToMakeItemVisible(iCurrentItemIndex);
}
UpdateSelectionL(aSelectionMode);
@@ -974,28 +951,33 @@
return;
}
+ TBool transparencyEnabled( CAknEnv::Static()->TransparencyEnabled() );
+
if ((ITEM_EXISTS_ONCE(aItemIndex)) && ItemIsVisible(aItemIndex))
{
TBool drawingInitiated = ETrue;
- if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
- {
+ if ( transparencyEnabled )
+ {
+ if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
+ {
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal* transApi =
- CAknListLoader::TfxApiInternal( iGc );
- drawingInitiated = transApi && !transApi->EffectsDisabled();
+ MAknListBoxTfxInternal* transApi =
+ CAknListLoader::TfxApiInternal( iGc );
+ drawingInitiated = transApi && !transApi->EffectsDisabled();
#else
- drawingInitiated = EFalse;
+ drawingInitiated = EFalse;
#endif
- }
+ }
- if ( !drawingInitiated )
- {
- TRect rect( ItemPos(aItemIndex), iItemDrawer->ItemCellSize() );
- rect.Intersection( iViewRect );
- iWin->Invalidate( rect );
- iWin->BeginRedraw( rect );
- }
+ if ( !drawingInitiated )
+ {
+ TRect rect( ItemPos(aItemIndex), ItemSize(aItemIndex) );
+ rect.Intersection( iViewRect );
+ iWin->Invalidate( rect );
+ iWin->BeginRedraw( rect );
+ }
+ }
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc );
@@ -1007,16 +989,8 @@
transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
}
#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
- TBool backgroundDrawingSuppressed = ( iItemDrawer
- && ( iItemDrawer->Flags()
- & ( CListItemDrawer::EDrawWholeBackground
- | CListItemDrawer::EBackgroundDrawn ) ) );
- if ( !backgroundDrawingSuppressed )
- {
- iGc->SetClippingRect( iViewRect );
- }
+ iGc->SetClippingRect( iViewRect );
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
if ( transApi )
@@ -1037,10 +1011,7 @@
}
#endif // RD_UI_TRANSITION_EFFECTS_LIST
- if ( !backgroundDrawingSuppressed )
- {
- iGc->CancelClippingRect();
- }
+ iGc->CancelClippingRect();
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
if ( transApi )
@@ -1056,7 +1027,7 @@
}
#endif // RD_UI_TRANSITION_EFFECTS_LIST
- if ( !drawingInitiated )
+ if ( transparencyEnabled && !drawingInitiated )
{
iWin->EndRedraw();
}
@@ -1211,18 +1182,11 @@
RDebug::Print( _L( "CListBoxView::CalcNewTopItemIndexSoItemIsVisible" ) );
#endif // _DEBUG
TInt newTopItemIndex=iTopItemIndex;
- const TInt numItemsThatFitInRect=NumberOfItemsThatFitInRect( iViewRect );
- if ( aItemIndex < iTopItemIndex || numItemsThatFitInRect == 0 )
- {
+ const TInt numItemsThatFitInRect=NumberOfItemsThatFitInRect(iViewRect);
+ if (aItemIndex < iTopItemIndex || numItemsThatFitInRect == 0)
newTopItemIndex = aItemIndex;
- }
- else
- {
- if (aItemIndex > iBottomItemIndex)
- {
- newTopItemIndex = aItemIndex - numItemsThatFitInRect + 1;
- }
- }
+ else if (aItemIndex > iBottomItemIndex)
+ newTopItemIndex = aItemIndex - numItemsThatFitInRect + 1;
if (!ITEM_EXISTS_ONCE(newTopItemIndex) && newTopItemIndex != 0 )
{ // if application fails to call HandleItemAdditionL(), we might go here.
@@ -1248,13 +1212,6 @@
{
me->SetItemOffsetInPixels( 0 );
}
- //after reset vertical offset,
- //the number of items which fit in the view maybe change
- TInt newNumItemsThatFitInRect = NumberOfItemsThatFitInRect( iViewRect );
- if ( newNumItemsThatFitInRect != numItemsThatFitInRect )
- {
- newTopItemIndex = aItemIndex - newNumItemsThatFitInRect + 1;
- }
}
_AKNTRACE_FUNC_EXIT;
@@ -1451,96 +1408,6 @@
}
-// ---------------------------------------------------------------------------
-// Resets the selection state so that there is nothing selected.
-// ---------------------------------------------------------------------------
-//
-void CListBoxView::ClearSelection( TBool aDrawItems )
- {
- _AKNTRACE_FUNC_ENTER;
-
- __ASSERT_DEBUG( iSelectionIndexes,
- Panic( EEikPanicListBoxNoSelIndexArray ) );
-
- TInt numSelectedItems = iSelectionIndexes->Count();
- TKeyArrayFix key( 0, ECmpTInt );
- TInt selectedItemIndex;
- TInt pos;
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
- for ( TInt i = 0; i < numSelectedItems; i++ )
- {
- selectedItemIndex = ( *( iSelectionIndexes ) )[0];
-
- if ( !( iSelectionIndexes->Find( selectedItemIndex, key, pos ) ) )
- {
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- if ( transApi )
- {
- transApi->Invalidate( MAknListBoxTfxInternal::EListItem,
- selectedItemIndex );
- }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
- iSelectionIndexes->Delete( pos );
-
- if ( aDrawItems )
- {
- DrawItem( selectedItemIndex );
- }
- }
- }
-
- ClearSelectionAnchorAndActiveIndex();
-
- _AKNTRACE_FUNC_EXIT;
- }
-
-
-// ---------------------------------------------------------------------------
-// Sets all items selected.
-// ---------------------------------------------------------------------------
-//
-void CListBoxView::SelectAllL( TBool aDrawItems )
- {
- _AKNTRACE_FUNC_ENTER;
-
- __ASSERT_DEBUG( iSelectionIndexes,
- Panic( EEikPanicListBoxNoSelIndexArray ) );
- __ASSERT_DEBUG( iModel, Panic( EEikPanicListBoxNoModel ) );
-
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
- ClearSelection();
- TInt numItems = iModel->NumberOfItems();
-
- for ( TInt i = 0; i < numItems; i++ )
- {
- if ( !iItemDrawer->Properties( i ).IsSelectionHidden() )
- {
-#ifdef RD_UI_TRANSITION_EFFECTS_LIST
- if ( transApi )
- {
- transApi->Invalidate( MAknListBoxTfxInternal::EListItem, i );
- }
-#endif // RD_UI_TRANSITION_EFFECTS_LIST
-
- iSelectionIndexes->AppendL( i );
-
- if ( aDrawItems )
- {
- DrawItem( i );
- }
- }
- }
- _AKNTRACE_FUNC_EXIT;
- }
-
// class CSnakingListBoxView