71 iTemplateLibrary = aTemplateLibrary; |
71 iTemplateLibrary = aTemplateLibrary; |
72 iMmModel = aMmListBoxModel; |
72 iMmModel = aMmListBoxModel; |
73 iRedrawBackground = ETrue; |
73 iRedrawBackground = ETrue; |
74 iZoomIconIndex = -1; |
74 iZoomIconIndex = -1; |
75 iIconAnimationZoomRatio = 1; |
75 iIconAnimationZoomRatio = 1; |
|
76 // this is needed to get iColors initialized on first use: |
|
77 iLastDrawnItemWasFloating = ETrue; |
76 SetFlags( CListItemDrawer::EDisableHighlight ); |
78 SetFlags( CListItemDrawer::EDisableHighlight ); |
77 } |
79 } |
78 |
80 |
79 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
80 // |
82 // |
84 { |
86 { |
85 iFloatingItems.Close(); |
87 iFloatingItems.Close(); |
86 delete iItemsDataCache; |
88 delete iItemsDataCache; |
87 delete iAnimator; |
89 delete iAnimator; |
88 delete iSubcellText; |
90 delete iSubcellText; |
89 delete ColumnData()->IconArray(); |
|
90 ColumnData()->SetIconArray( NULL ); |
|
91 } |
91 } |
92 |
92 |
93 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
94 // |
94 // |
95 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
96 // |
96 // |
97 void CMmListBoxItemDrawer::EnableCachedDataUse( TBool aEnable ) |
97 void CMmListBoxItemDrawer::EnableCachedDataUse( TBool aEnable ) |
98 { |
98 { |
99 __ASSERT_DEBUG( !( aEnable && IsEditMode() ), User::Invariant() ); |
|
100 iUseCache = aEnable; |
99 iUseCache = aEnable; |
|
100 if ( aEnable ) |
|
101 { |
|
102 RemoveFloatingItems(); |
|
103 } |
101 } |
104 } |
102 |
105 |
103 // ----------------------------------------------------------------------------- |
106 // ----------------------------------------------------------------------------- |
104 // |
107 // |
105 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
349 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
352 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
350 TBool aViewIsDimmed) const |
353 TBool aViewIsDimmed) const |
351 { |
354 { |
352 if ( !Widget()->View()->RedrawDisabled() ) |
355 if ( !Widget()->View()->RedrawDisabled() ) |
353 { |
356 { |
|
357 TBool highlightVisible = |
|
358 !( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ); |
|
359 aItemIsCurrent = aItemIsCurrent && highlightVisible; |
354 DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, |
360 DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, |
355 aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed); |
361 aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed); |
356 } |
362 } |
357 } |
363 } |
358 // ----------------------------------------------------------------------------- |
364 // ----------------------------------------------------------------------------- |
442 if ( !iUseCache || !cache->IsValid() ) |
448 if ( !iUseCache || !cache->IsValid() ) |
443 { |
449 { |
444 SetupSubCellsL( aItemIsCurrent, aItemIndex ); |
450 SetupSubCellsL( aItemIsCurrent, aItemIndex ); |
445 } |
451 } |
446 __ASSERT_DEBUG( cache->IsValid(), User::Invariant() ); |
452 __ASSERT_DEBUG( cache->IsValid(), User::Invariant() ); |
447 CArrayPtr<CGulIcon>* oldIconList = FormattedCellData()->IconArray(); |
453 |
448 FormattedCellData()->SetIconArray( cache->GetIconListL() ); |
454 FormattedCellData()->SetIconArray( cache->GetIconListL() ); |
449 delete oldIconList; |
455 |
450 oldIconList = NULL; |
456 TBool isFloating = !iUseCache && IsFloating( aItemIndex ); |
451 |
457 if ( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR |
452 |
458 { |
453 TBool highlightShown = ETrue; |
459 iLastDrawnItemWasFloating = isFloating; |
454 CFormattedCellListBoxData::TColors colors; |
460 iColors = SetupColors( isFloating ); |
455 |
461 } |
456 colors = SetupColors( IsFloating( aItemIndex ) ); |
|
457 |
462 |
458 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
463 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
459 data->EnableMarqueeL( EFalse ); |
464 data->EnableMarqueeL( EFalse ); |
|
465 |
|
466 TBool highlightShown = ETrue; |
460 if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized) |
467 if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized) |
461 { |
468 { |
462 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
469 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
463 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
470 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
464 if ( transApi ) |
471 if ( transApi ) |
466 transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); |
473 transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); |
467 } |
474 } |
468 #endif |
475 #endif |
469 highlightShown = EFalse; |
476 highlightShown = EFalse; |
470 } |
477 } |
471 |
478 |
472 data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect, |
479 data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect, |
473 GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), colors ); |
480 GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors ); |
474 |
481 |
475 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
482 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
476 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
483 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
477 if ( transApi ) |
484 if ( transApi ) |
478 { |
485 { |
622 && iSubcellText |
628 && iSubcellText |
623 && iMarqueeAdapter->IsMarqueeEnabled() ) |
629 && iMarqueeAdapter->IsMarqueeEnabled() ) |
624 |
630 |
625 { |
631 { |
626 if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) |
632 if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) |
627 && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsTimerActive() ) |
633 && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() ) |
628 { |
634 { |
629 data->SetSubCellSizeL( aIndex, TSize(0,0)); |
635 data->SetSubCellSizeL( aIndex, TSize(0,0)); |
630 const_cast<CMmListBoxItemDrawer*>(this)->AddSubcellMarqueeElementL( |
636 const_cast<CMmListBoxItemDrawer*>(this)->AddSubcellMarqueeElementL( |
631 aSubCellTemplate, aIndex, aItemIndex); |
637 aSubCellTemplate, aIndex, aItemIndex); |
632 } |
638 } |
749 // ----------------------------------------------------------------------------- |
755 // ----------------------------------------------------------------------------- |
750 // |
756 // |
751 void CMmListBoxItemDrawer::AddFloatingItemL( TMmFloatingItem& aFloatingItem, |
757 void CMmListBoxItemDrawer::AddFloatingItemL( TMmFloatingItem& aFloatingItem, |
752 TInt aPosition ) |
758 TInt aPosition ) |
753 { |
759 { |
|
760 EnableCachedDataUse( EFalse ); |
754 if (aPosition != KErrNotFound) |
761 if (aPosition != KErrNotFound) |
755 { |
762 { |
756 iFloatingItems.InsertL( aFloatingItem, aPosition ); |
763 iFloatingItems.InsertL( aFloatingItem, aPosition ); |
757 } |
764 } |
758 else |
765 else |
1200 aSubcellIncrement++; |
1207 aSubcellIncrement++; |
1201 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); |
1208 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); |
1202 } |
1209 } |
1203 else |
1210 else |
1204 { |
1211 { |
1205 // Even when there is no graphics in the model, it is |
1212 // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode |
1206 // necessary to set up an empty subcell in place of |
1213 // works properly. |
1207 // what would normally be an icon (graphics) subcell. |
1214 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ESkippedSubcell ); |
1208 // This ensures that TMmSubcellsSetupCode will work |
|
1209 // properly. |
|
1210 SetupSubNoCellL( aSubcellIncrement, aItemIndex ); |
|
1211 aSubcellIncrement++; |
|
1212 } |
1215 } |
1213 } |
1216 } |
1214 |
1217 |
1215 // ----------------------------------------------------------------------------- |
1218 // ----------------------------------------------------------------------------- |
1216 // |
1219 // |
1334 // |
1337 // |
1335 void CMmListBoxItemDrawer::SetupSubCellsL( TBool aItemIsCurrent, |
1338 void CMmListBoxItemDrawer::SetupSubCellsL( TBool aItemIsCurrent, |
1336 TInt aItemIndex ) const |
1339 TInt aItemIndex ) const |
1337 { |
1340 { |
1338 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
1341 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
1339 cache->SetValid( EFalse ); |
1342 cache->SetValidL( EFalse ); |
1340 |
1343 |
1341 const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 ); |
1344 const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 ); |
1342 if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) |
1345 if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) |
1343 { |
1346 { |
1344 User::Leave( KErrNotFound ); |
1347 User::Leave( KErrNotFound ); |
1395 else |
1398 else |
1396 { |
1399 { |
1397 SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1400 SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1398 } |
1401 } |
1399 } |
1402 } |
1400 |
1403 TInt subcellsJustSet = subcellIncrement; |
1401 for ( TInt i = subcellIncrement; i < MmTemplateContants::KSubCellsCount; i++ ) |
1404 iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet ); |
|
1405 __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount, |
|
1406 User::Invariant() ); |
|
1407 |
|
1408 for ( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ ) |
1402 { |
1409 { |
1403 SetupSubNoCellL( i, aItemIndex ); |
1410 SetupSubNoCellL( i, aItemIndex ); |
1404 } |
1411 } |
1405 |
1412 |
1406 iLastSubcellsSetupCode.AddTemplateInfo( |
1413 iLastSubcellsSetupCode.AddTemplateInfo( |
1410 CleanupStack::PopAndDestroy( &templateChildArray ); |
1417 CleanupStack::PopAndDestroy( &templateChildArray ); |
1411 |
1418 |
1412 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1419 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1413 // the line below is here only to make the cached information complete |
1420 // the line below is here only to make the cached information complete |
1414 GetItemSize( aItemIndex, aItemIsCurrent ); |
1421 GetItemSize( aItemIndex, aItemIsCurrent ); |
1415 cache->SetValid( ETrue ); |
1422 cache->SetValidL( ETrue ); |
1416 } |
1423 } |
1417 |
1424 |
1418 // ----------------------------------------------------------------------------- |
1425 // ----------------------------------------------------------------------------- |
1419 // |
1426 // |
1420 // ----------------------------------------------------------------------------- |
1427 // ----------------------------------------------------------------------------- |
1489 { |
1496 { |
1490 TBool currentlyDraggedItem = |
1497 TBool currentlyDraggedItem = |
1491 ItemHasFloatingType( aItemIndex, EDrag ) || |
1498 ItemHasFloatingType( aItemIndex, EDrag ) || |
1492 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1499 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1493 |
1500 |
1494 if ( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsTimerActive() |
1501 if ( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() |
1495 && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) |
1502 && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) |
1496 || currentlyDraggedItem ) |
1503 || currentlyDraggedItem ) |
1497 { |
1504 { |
1498 highlightVisibility = ETrue; |
1505 highlightVisibility = ETrue; |
1499 } |
1506 } |
1514 |
1521 |
1515 return IsEditMode() /* draw the backdrop only in edit mode */ |
1522 return IsEditMode() /* draw the backdrop only in edit mode */ |
1516 && !currentlyDraggedItem /* backdrop is disabled for dragged items */ |
1523 && !currentlyDraggedItem /* backdrop is disabled for dragged items */ |
1517 && !iIsIndicatorItem /* in non-touch backdrop is not drawn, just "move indicators" */ |
1524 && !iIsIndicatorItem /* in non-touch backdrop is not drawn, just "move indicators" */ |
1518 && !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/ |
1525 && !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/ |
1519 && !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsTimerActive() |
1526 && !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsHighlightVisible() |
1520 && aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/ |
1527 && aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/ |
1521 } |
1528 } |
1522 |
1529 |
1523 // ----------------------------------------------------------------------------- |
1530 // ----------------------------------------------------------------------------- |
1524 // |
1531 // |