46 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
47 // |
47 // |
48 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
49 // |
49 // |
50 CMmListBox::CMmListBox() : AKNDOUBLELISTBOXNAME(R_LIST_PANE_LINES_AB_COLUMN) |
50 CMmListBox::CMmListBox() : AKNDOUBLELISTBOXNAME(R_LIST_PANE_LINES_AB_COLUMN) |
51 { |
51 { |
52 // No implementation required |
52 // No implementation required |
53 } |
53 } |
54 |
54 |
55 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
56 // |
56 // |
57 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
58 // |
58 // |
59 CMmListBox::~CMmListBox() |
59 CMmListBox::~CMmListBox() |
60 { |
60 { |
61 delete iRedrawTimer; |
61 delete iRedrawTimer; |
62 } |
62 } |
63 |
63 |
64 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
65 // |
65 // |
66 // ----------------------------------------------------------------------------- |
66 // ----------------------------------------------------------------------------- |
67 // |
67 // |
68 CMmListBox* CMmListBox::NewLC( const CCoeControl* aParent, TInt aFlags, |
68 CMmListBox* CMmListBox::NewLC( const CCoeControl* aParent, TInt aFlags, |
69 CMmTemplateLibrary* aTemplateLibrary ) |
69 CMmTemplateLibrary* aTemplateLibrary ) |
70 { |
70 { |
71 CMmListBox* self = new (ELeave)CMmListBox(); |
71 CMmListBox* self = new (ELeave)CMmListBox(); |
72 CleanupStack::PushL(self); |
72 CleanupStack::PushL(self); |
73 self->ConstructL( aParent, aFlags, aTemplateLibrary ); |
73 self->ConstructL( aParent, aFlags, aTemplateLibrary ); |
74 return self; |
74 return self; |
75 } |
75 } |
76 |
76 |
77 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
78 // |
78 // |
79 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
80 // |
80 // |
81 void CMmListBox::SetListFlag( TInt aFlag ) |
81 void CMmListBox::SetListFlag( TInt aFlag ) |
82 { |
82 { |
83 iListBoxFlags = iListBoxFlags | aFlag; |
83 iListBoxFlags = iListBoxFlags | aFlag; |
84 } |
84 } |
85 |
85 |
86 // ----------------------------------------------------------------------------- |
86 // ----------------------------------------------------------------------------- |
87 // |
87 // |
88 // ----------------------------------------------------------------------------- |
88 // ----------------------------------------------------------------------------- |
89 // |
89 // |
90 void CMmListBox::ClearListFlag( TInt aFlag ) |
90 void CMmListBox::ClearListFlag( TInt aFlag ) |
91 { |
91 { |
92 iListBoxFlags = iListBoxFlags & !aFlag; |
92 iListBoxFlags = iListBoxFlags & !aFlag; |
93 } |
93 } |
94 |
94 |
95 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
96 // |
96 // |
97 // ----------------------------------------------------------------------------- |
97 // ----------------------------------------------------------------------------- |
98 // |
98 // |
99 CMmListBox* CMmListBox::NewL( const CCoeControl* aParent, TInt aFlags, |
99 CMmListBox* CMmListBox::NewL( const CCoeControl* aParent, TInt aFlags, |
100 CMmTemplateLibrary* aTemplateLibrary ) |
100 CMmTemplateLibrary* aTemplateLibrary ) |
101 { |
101 { |
102 CMmListBox* self = CMmListBox::NewLC( aParent, aFlags, aTemplateLibrary ); |
102 CMmListBox* self = CMmListBox::NewLC( aParent, aFlags, aTemplateLibrary ); |
103 CleanupStack::Pop( self ); |
103 CleanupStack::Pop( self ); |
104 return self; |
104 return self; |
105 } |
105 } |
106 |
106 |
107 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
108 // |
108 // |
109 // ----------------------------------------------------------------------------- |
109 // ----------------------------------------------------------------------------- |
110 // |
110 // |
111 void CMmListBox::ConstructL( const CCoeControl* aParent, TInt aFlags, |
111 void CMmListBox::ConstructL( const CCoeControl* aParent, TInt aFlags, |
112 CMmTemplateLibrary* aTemplateLibrary ) |
112 CMmTemplateLibrary* aTemplateLibrary ) |
113 { |
113 { |
114 iDisableChildComponentDrawing = EFalse; |
114 iDisableChildComponentDrawing = EFalse; |
115 iModel = iMmModel = CMmListBoxModel::NewL(); |
115 iModel = iMmModel = CMmListBoxModel::NewL(); |
116 CreateItemDrawerL( aTemplateLibrary ); |
116 CreateItemDrawerL( aTemplateLibrary ); |
117 |
117 |
118 EnableExtendedDrawingL(); |
118 EnableExtendedDrawingL(); |
119 |
119 |
120 iItemDrawer->SetDrawMark(EFalse); |
120 iItemDrawer->SetDrawMark(EFalse); |
121 CEikListBox::ConstructL(aParent,aFlags); |
121 CEikListBox::ConstructL(aParent,aFlags); |
122 iMmDrawer->SetView( this ); |
122 iMmDrawer->SetView( this ); |
123 iRedrawTimer = CPeriodic::NewL( EPriorityRealTime ); |
123 iRedrawTimer = CPeriodic::NewL( EPriorityRealTime ); |
124 } |
124 } |
125 |
125 |
126 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
127 // Clearing ELeftDownInViewRect flag before invoking the base class |
127 // Clearing ELeftDownInViewRect flag before invoking the base class |
128 // HandlePointerEventL method effectively prevents that method from doing most |
128 // HandlePointerEventL method effectively prevents that method from doing most |
129 // of the things it would normally do in response to EButton1Down event. |
129 // of the things it would normally do in response to EButton1Down event. |
146 if ( Abs( dragDelta.iY ) > KDragTreshold || parent->LongTapInProgress() ) |
146 if ( Abs( dragDelta.iY ) > KDragTreshold || parent->LongTapInProgress() ) |
147 { |
147 { |
148 iListBoxFlags &= ~ELeftDownInViewRect; |
148 iListBoxFlags &= ~ELeftDownInViewRect; |
149 } |
149 } |
150 } |
150 } |
151 |
151 |
152 TInt itemUnderPointerIndex = KErrNotFound; |
152 TInt itemUnderPointerIndex = KErrNotFound; |
153 if ( aPointerEvent.iType == TPointerEvent::EButton1Up || |
153 if ( aPointerEvent.iType == TPointerEvent::EButton1Up || |
154 aPointerEvent.iType == TPointerEvent::EButton1Down ) |
154 aPointerEvent.iType == TPointerEvent::EButton1Down ) |
155 { |
155 { |
156 TBool highlightWasVisible = parent->IsHighlightVisible(); |
156 TBool highlightWasVisible = parent->IsHighlightVisible(); |
157 CEikFormattedCellListBoxTypedef::HandlePointerEventL( aPointerEvent ); |
157 CEikFormattedCellListBoxTypedef::HandlePointerEventL( aPointerEvent ); |
158 // Tricky: Do not allow the base class implementation of HandlePointerEventL |
158 // Tricky: Do not allow the base class implementation of HandlePointerEventL |
159 // to remove the highlight on EButton1Up event when context menu |
159 // to remove the highlight on EButton1Up event when context menu |
160 // is displayed for an item |
160 // is displayed for an item |
161 if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
161 if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
162 highlightWasVisible && parent->LongTapInProgress() |
162 highlightWasVisible && parent->LongTapInProgress() |
163 && !parent->IsHighlightVisible() ) |
163 && !parent->IsHighlightVisible() ) |
235 // ----------------------------------------------------------------------------- |
235 // ----------------------------------------------------------------------------- |
236 // |
236 // |
237 TInt CMmListBox::ScrollIfNeeded( const TPointerEvent& aPointerEvent ) |
237 TInt CMmListBox::ScrollIfNeeded( const TPointerEvent& aPointerEvent ) |
238 { |
238 { |
239 TInt nextScrollDelay = 0; |
239 TInt nextScrollDelay = 0; |
240 |
240 |
241 TBool readyForScrolling = |
241 TBool readyForScrolling = |
242 iMmDrawer->GetAnimator()->IsReadyForNewAnimation() |
242 iMmDrawer->GetAnimator()->IsReadyForNewAnimation() |
243 && iMmDrawer->GetFloatingItemCount() != 0; |
243 && iMmDrawer->GetFloatingItemCount() != 0; |
244 |
244 |
245 if ( IsPointerInTopScrollingThreshold( aPointerEvent ) ) |
245 if ( IsPointerInTopScrollingThreshold( aPointerEvent ) ) |
246 { |
246 { |
247 // scroll up by one row |
247 // scroll up by one row |
248 TInt newCurrentItemIndex = CurrentItemIndex() - 1; |
248 TInt newCurrentItemIndex = CurrentItemIndex() - 1; |
249 |
249 |
250 if ( newCurrentItemIndex >= 0 ) |
250 if ( newCurrentItemIndex >= 0 ) |
251 { |
251 { |
252 nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * |
252 nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * |
253 Max( 1, aPointerEvent.iPosition.iY - Rect().iTl.iY ); |
253 Max( 1, aPointerEvent.iPosition.iY - Rect().iTl.iY ); |
254 if (readyForScrolling) |
254 if (readyForScrolling) |
255 { |
255 { |
256 View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( |
256 View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( |
257 newCurrentItemIndex ) ); |
257 newCurrentItemIndex ) ); |
258 View()->SetCurrentItemIndex( newCurrentItemIndex ); |
258 View()->SetCurrentItemIndex( newCurrentItemIndex ); |
259 UpdateScrollBarThumbs(); |
259 UpdateScrollBarThumbs(); |
260 } |
260 } |
261 } |
261 } |
262 } |
262 } |
263 else if ( IsPointerInBottomScrollingThreshold( aPointerEvent) ) |
263 else if ( IsPointerInBottomScrollingThreshold( aPointerEvent) ) |
264 { |
264 { |
265 // scroll down by one row |
265 // scroll down by one row |
266 TInt lastItemIndex = iModel->NumberOfItems() - 1; |
266 TInt lastItemIndex = iModel->NumberOfItems() - 1; |
267 TInt newCurrentItemIndex = CurrentItemIndex() + 1; |
267 TInt newCurrentItemIndex = CurrentItemIndex() + 1; |
268 |
268 |
269 |
269 |
270 if ( newCurrentItemIndex <= lastItemIndex ) |
270 if ( newCurrentItemIndex <= lastItemIndex ) |
271 { |
271 { |
272 nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * |
272 nextScrollDelay = MmEffects::KEditModeScrollingDelayFactor * |
273 Max( 1, Rect().iBr.iY - aPointerEvent.iPosition.iY ); |
273 Max( 1, Rect().iBr.iY - aPointerEvent.iPosition.iY ); |
274 |
274 |
275 if (readyForScrolling) |
275 if (readyForScrolling) |
276 { |
276 { |
277 View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( |
277 View()->VScrollTo( View()->CalcNewTopItemIndexSoItemIsVisible( |
278 newCurrentItemIndex ) ); |
278 newCurrentItemIndex ) ); |
279 View()->SetCurrentItemIndex( newCurrentItemIndex ); |
279 View()->SetCurrentItemIndex( newCurrentItemIndex ); |
280 UpdateScrollBarThumbs(); |
280 UpdateScrollBarThumbs(); |
281 } |
281 } |
282 } |
282 } |
283 } |
283 } |
284 |
284 |
285 return nextScrollDelay; |
285 return nextScrollDelay; |
286 } |
286 } |
287 |
287 |
288 // ----------------------------------------------------------------------------- |
288 // ----------------------------------------------------------------------------- |
432 |
427 |
433 TInt itemY = View()->ItemPos( currentItemIndex ).iY |
428 TInt itemY = View()->ItemPos( currentItemIndex ).iY |
434 + View()->ItemSize( currentItemIndex ).iHeight; |
429 + View()->ItemSize( currentItemIndex ).iHeight; |
435 |
430 |
436 if ( currentItemIndex == BottomItemIndex() |
431 if ( currentItemIndex == BottomItemIndex() |
437 && currentItemIndex != previousItemIndex |
432 && currentItemIndex != previousItemIndex |
438 && itemY > View()->ViewRect().iBr.iY ) |
433 && itemY > View()->ViewRect().iBr.iY ) |
439 { |
434 { |
440 if( aType == EEventKey ) |
435 if( aType == EEventKey ) |
441 { |
436 { |
442 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
437 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
443 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( |
438 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( |
444 View()->ItemDrawer()->Gc() ); |
439 View()->ItemDrawer()->Gc() ); |
445 TBool effects = transApi && !transApi->EffectsDisabled(); |
440 TBool effects = transApi && !transApi->EffectsDisabled(); |
446 if ( effects ) |
441 if ( effects ) |
447 { |
442 { |
448 transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); |
443 transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown ); |
449 } |
444 } |
450 #endif |
445 #endif |
451 iView->VScrollTo( |
446 iView->VScrollTo( |
452 iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ) ); |
447 iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ) ); |
453 |
448 |
454 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
449 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
455 if ( effects ) |
450 if ( effects ) |
456 { |
451 { |
457 transApi->Draw( Rect() ); |
452 transApi->Draw( Rect() ); |
458 } |
453 } |
459 #endif |
454 #endif |
460 } |
455 } |
461 SetCurrentItemIndex( currentItemIndex ); |
456 SetCurrentItemIndex( currentItemIndex ); |
462 } |
457 } |
463 |
458 |
464 RedrawIfNecessary( itemIndex, CurrentItemIndex()); |
459 RedrawIfNecessary( itemIndex, CurrentItemIndex()); |
465 return ret; |
460 return ret; |
466 } |
461 } |
467 |
462 |
608 // ----------------------------------------------------------------------------- |
603 // ----------------------------------------------------------------------------- |
609 // |
604 // |
610 // ----------------------------------------------------------------------------- |
605 // ----------------------------------------------------------------------------- |
611 // |
606 // |
612 void CMmListBox::SetItemDrawerAndViewBgContext (CAknsBasicBackgroundControlContext * aBgContext) |
607 void CMmListBox::SetItemDrawerAndViewBgContext (CAknsBasicBackgroundControlContext * aBgContext) |
613 { |
608 { |
614 iMmDrawer->SetBgContext (aBgContext); |
609 iMmDrawer->SetBgContext (aBgContext); |
615 } |
610 } |
616 |
611 |
617 // ----------------------------------------------------------------------------- |
612 // ----------------------------------------------------------------------------- |
618 // |
613 // |
619 // ----------------------------------------------------------------------------- |
614 // ----------------------------------------------------------------------------- |
620 // |
615 // |
621 TBool CMmListBox::HandleScrollbarVisibilityChangeL() |
616 TBool CMmListBox::HandleScrollbarVisibilityChangeL() |
622 { |
617 { |
623 TBool ret = EFalse; |
618 TBool ret = EFalse; |
624 if ( AllItemsFitInViewRect() ) |
619 if ( AllItemsFitInViewRect() ) |
625 { |
620 { |
626 if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() |
621 if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() |
627 || iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) |
622 || iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) |
628 { |
623 { |
629 ScrollBarFrame()->VerticalScrollBar()->MakeVisible( EFalse ); |
624 ScrollBarFrame()->VerticalScrollBar()->MakeVisible( EFalse ); |
630 iMmDrawer->SetScrollbarVisibilityL( EFalse ); |
625 iMmDrawer->SetScrollbarVisibilityL( EFalse ); |
631 |
626 |
632 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
627 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
633 MAknListBoxTfxInternal *trans = CAknListLoader::TfxApiInternal( ItemDrawer()->Gc() ); |
628 MAknListBoxTfxInternal *trans = CAknListLoader::TfxApiInternal( ItemDrawer()->Gc() ); |
634 if ( trans ) |
629 if ( trans ) |
635 { |
630 { |
636 trans->Remove( MAknListBoxTfxInternal::EListEverything ); |
631 trans->Remove( MAknListBoxTfxInternal::EListEverything ); |
637 } |
632 } |
638 #endif |
633 #endif |
639 |
634 |
640 ret = ETrue; //redraw is needed |
635 ret = ETrue; //redraw is needed |
641 } |
636 } |
642 } |
637 } |
643 else if ( !ScrollBarFrame()->VerticalScrollBar()->IsVisible() |
638 else if ( !ScrollBarFrame()->VerticalScrollBar()->IsVisible() |
644 || !iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) |
639 || !iMmDrawer->TemplateLibrary()->GetScrollbarVisibility() ) |
645 { |
640 { |
646 ScrollBarFrame()->VerticalScrollBar()->MakeVisible( ETrue ); |
641 ScrollBarFrame()->VerticalScrollBar()->MakeVisible( ETrue ); |
647 iMmDrawer->SetScrollbarVisibilityL( ETrue ); |
642 iMmDrawer->SetScrollbarVisibilityL( ETrue ); |
648 ret = ETrue; //redraw is needed |
643 ret = ETrue; //redraw is needed |
649 } |
644 } |
650 return ret; |
645 return ret; |
651 } |
646 } |
652 |
647 |
653 |
648 |
654 // ----------------------------------------------------------------------------- |
649 // ----------------------------------------------------------------------------- |
655 // |
650 // |
656 // ----------------------------------------------------------------------------- |
651 // ----------------------------------------------------------------------------- |
657 // |
652 // |
658 TBool CMmListBox::AllItemsFitInViewRect() |
653 TBool CMmListBox::AllItemsFitInViewRect() |
659 { |
654 { |
660 CMmListBoxView* view = static_cast< CMmListBoxView* >(iView); |
655 CMmListBoxView* view = static_cast< CMmListBoxView* >(iView); |
661 TInt totalHeight = view->GetTotalHeight( view->TopItemIndex(), view->BottomItemIndex()); |
656 TInt totalHeight = view->GetTotalHeight( view->TopItemIndex(), view->BottomItemIndex()); |
662 if ( view->TopItemIndex() == 0 && iMmModel->NumberOfItems() <= view->BottomItemIndex() + 1 |
657 if ( view->TopItemIndex() == 0 && iMmModel->NumberOfItems() <= view->BottomItemIndex() + 1 |
663 && totalHeight <= iView->ViewRect().Height() ) |
658 && totalHeight <= iView->ViewRect().Height() ) |
664 { |
659 { |
665 return ETrue; |
660 return ETrue; |
666 } |
661 } |
667 else |
662 else |
668 { |
663 { |
669 return EFalse; |
664 return EFalse; |
670 } |
665 } |
671 } |
666 } |
672 |
667 |
673 /** |
668 /** |
674 * Helper class whose only purpose is to ensure that |
669 * Helper class whose only purpose is to ensure that |
675 * ScrollToItem method will be always re-enabled. |
670 * ScrollToItem method will be always re-enabled. |
676 */ |
671 */ |
677 struct TScrollToItemEnabler |
672 struct TScrollToItemEnabler |
678 { |
673 { |
679 CMmListBoxView* iV; |
674 CMmListBoxView* iV; |
680 void Close() { iV->DisableScrollToItem( EFalse ); } |
675 void Close() { iV->DisableScrollToItem( EFalse ); } |
683 // ----------------------------------------------------------------------------- |
678 // ----------------------------------------------------------------------------- |
684 // |
679 // |
685 // ----------------------------------------------------------------------------- |
680 // ----------------------------------------------------------------------------- |
686 // |
681 // |
687 void CMmListBox::UpdateScrollBarsL() |
682 void CMmListBox::UpdateScrollBarsL() |
688 { |
683 { |
689 TBool redrawNeeded = HandleScrollbarVisibilityChangeL(); |
684 TBool redrawNeeded = HandleScrollbarVisibilityChangeL(); |
690 if (ScrollBarFrame()->VerticalScrollBar()->IsVisible()) |
685 if (ScrollBarFrame()->VerticalScrollBar()->IsVisible()) |
691 { |
686 { |
692 CMmListBoxView* view = static_cast<CMmListBoxView*>( View() ); |
687 CMmListBoxView* view = static_cast<CMmListBoxView*>( View() ); |
693 view->DisableScrollToItem( ETrue ); |
688 view->DisableScrollToItem( ETrue ); |
694 TScrollToItemEnabler reverter = { view }; |
689 TScrollToItemEnabler reverter = { view }; |
695 CleanupClosePushL( reverter ); |
690 CleanupClosePushL( reverter ); |
696 CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); |
691 CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); |
697 CleanupStack::PopAndDestroy( &reverter ); |
692 CleanupStack::PopAndDestroy( &reverter ); |
698 } |
693 } |
699 iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( |
694 iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( |
700 ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); |
695 ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); |
701 FixViewForMirroredLayout(); |
696 FixViewForMirroredLayout(); |
702 if ( redrawNeeded ) |
697 if ( redrawNeeded ) |
703 { |
698 { |
704 DrawNow(); |
699 DrawNow(); |
705 } |
700 } |
706 } |
701 } |
707 |
702 |
708 // ----------------------------------------------------------------------------- |
703 // ----------------------------------------------------------------------------- |
709 // |
704 // |
710 // ----------------------------------------------------------------------------- |
705 // ----------------------------------------------------------------------------- |
711 // |
706 // |
712 void CMmListBox::UpdateScrollBarsNoRedrawL() |
707 void CMmListBox::UpdateScrollBarsNoRedrawL() |
713 { |
708 { |
714 HandleScrollbarVisibilityChangeL(); |
709 HandleScrollbarVisibilityChangeL(); |
715 if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) |
710 if ( ScrollBarFrame()->VerticalScrollBar()->IsVisible() ) |
716 { |
711 { |
717 CMmListBoxView* view = static_cast<CMmListBoxView*>( View() ); |
712 CMmListBoxView* view = static_cast<CMmListBoxView*>( View() ); |
718 view->DisableScrollToItem( ETrue ); |
713 view->DisableScrollToItem( ETrue ); |
719 TScrollToItemEnabler reverter = { view }; |
714 TScrollToItemEnabler reverter = { view }; |
720 CleanupClosePushL( reverter ); |
715 CleanupClosePushL( reverter ); |
721 CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); |
716 CEikFormattedCellListBoxTypedef::UpdateScrollBarsL(); |
722 CleanupStack::PopAndDestroy( &reverter ); |
717 CleanupStack::PopAndDestroy( &reverter ); |
723 iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( |
718 iMmDrawer->TemplateLibrary()->SetScrollbarWidthL( |
724 ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); |
719 ScrollBarFrame()->VerticalScrollBar()->Rect().Width() ); |
725 } |
720 } |
726 } |
721 } |
727 |
722 |
728 // ----------------------------------------------------------------------------- |
723 // ----------------------------------------------------------------------------- |
729 // |
724 // |
730 // ----------------------------------------------------------------------------- |
725 // ----------------------------------------------------------------------------- |
731 // |
726 // |
732 void CMmListBox::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) |
727 void CMmListBox::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) |
733 { |
728 { |
734 iMarqueeAdapter = aAdapter; |
729 iMarqueeAdapter = aAdapter; |
735 iMarqueeAdapter->SetControl( const_cast< CMmListBox *>(this) ); |
730 iMarqueeAdapter->SetControl( const_cast< CMmListBox *>(this) ); |
736 } |
731 } |
737 |
732 |
738 // ----------------------------------------------------------------------------- |
733 // ----------------------------------------------------------------------------- |
739 // |
734 // |
740 // ----------------------------------------------------------------------------- |
735 // ----------------------------------------------------------------------------- |
741 // |
736 // |
742 void CMmListBox::SetMarqueeDrawing( TBool aIsMarqueeBeingDrawn ) |
737 void CMmListBox::SetMarqueeDrawing( TBool aIsMarqueeBeingDrawn ) |
743 { |
738 { |
744 iMmDrawer->SetMarqueeDrawing( aIsMarqueeBeingDrawn ); |
739 iMmDrawer->SetMarqueeDrawing( aIsMarqueeBeingDrawn ); |
745 } |
740 } |
746 |
741 |
747 // ----------------------------------------------------------------------------- |
742 // ----------------------------------------------------------------------------- |
748 // |
743 // |
749 // ----------------------------------------------------------------------------- |
744 // ----------------------------------------------------------------------------- |
750 // |
745 // |
751 void CMmListBox::HandleItemRemovalL() |
746 void CMmListBox::HandleItemRemovalL() |
752 { |
747 { |
753 CEikFormattedCellListBoxTypedef::HandleItemRemovalL(); |
748 CEikFormattedCellListBoxTypedef::HandleItemRemovalL(); |
754 DrawNow(); |
749 DrawNow(); |
755 //avkon does not redraw the items for listbox when item is |
750 //avkon does not redraw the items for listbox when item is |
756 //removed. This needs to be forced here. |
751 //removed. This needs to be forced here. |
757 UpdateScrollBarsL(); |
752 UpdateScrollBarsL(); |
758 } |
753 } |
759 |
754 |
760 // ----------------------------------------------------------------------------- |
755 // ----------------------------------------------------------------------------- |
761 // If a parent to the supplied control has its Gc set, this function will find |
756 // If a parent to the supplied control has its Gc set, this function will find |
762 // it and return it. (Copied from EIKLBX.CPP, needed by CMmListBox::Draw) |
757 // it and return it. (Copied from EIKLBX.CPP, needed by CMmListBox::Draw) |
763 // ----------------------------------------------------------------------------- |
758 // ----------------------------------------------------------------------------- |
894 // ----------------------------------------------------------------------------- |
889 // ----------------------------------------------------------------------------- |
895 // |
890 // |
896 // ----------------------------------------------------------------------------- |
891 // ----------------------------------------------------------------------------- |
897 // |
892 // |
898 void CMmListBox::SetVerticalItemOffset( TInt aOffset ) |
893 void CMmListBox::SetVerticalItemOffset( TInt aOffset ) |
899 { |
894 { |
900 static_cast<CMmListBoxView*>( View() )->SetItemOffsetInPixels( aOffset ); |
895 static_cast<CMmListBoxView*>( View() )->SetItemOffsetInPixels( aOffset ); |
901 UpdateScrollBarThumbs(); |
896 UpdateScrollBarThumbs(); |
902 } |
897 } |
903 |
898 |
904 // ----------------------------------------------------------------------------- |
899 // ----------------------------------------------------------------------------- |
905 // |
900 // |
906 // ----------------------------------------------------------------------------- |
901 // ----------------------------------------------------------------------------- |
907 // |
902 // |
908 TInt CMmListBox::VerticalItemOffset() const |
903 TInt CMmListBox::VerticalItemOffset() const |
909 { |
904 { |
910 return static_cast<CMmListBoxView*>( View() )->VerticalItemOffset(); |
905 return static_cast<CMmListBoxView*>( View() )->VerticalItemOffset(); |
911 } |
906 } |
912 |
907 |
913 // ----------------------------------------------------------------------------- |
908 // ----------------------------------------------------------------------------- |
914 // |
909 // |
915 // ----------------------------------------------------------------------------- |
910 // ----------------------------------------------------------------------------- |
916 // |
911 // |
917 void CMmListBox::SetItemHeight( TInt aItemHeight ) |
912 void CMmListBox::SetItemHeight( TInt aItemHeight ) |
918 { |
913 { |
919 if ( aItemHeight != iItemHeight ) |
914 if ( aItemHeight != iItemHeight ) |
920 { |
915 { |
921 iItemHeight = aItemHeight; |
916 iItemHeight = aItemHeight; |
922 TRAP_IGNORE( UpdateScrollBarsNoRedrawL() ); |
917 TRAP_IGNORE( UpdateScrollBarsNoRedrawL() ); |
923 } |
918 } |
924 } |
919 } |
925 |
920 |
926 // ----------------------------------------------------------------------------- |
921 // ----------------------------------------------------------------------------- |
927 // |
922 // |
928 // ----------------------------------------------------------------------------- |
923 // ----------------------------------------------------------------------------- |
929 // |
924 // |
930 void CMmListBox::UpdateScrollBarThumbs() |
925 void CMmListBox::UpdateScrollBarThumbs() |
931 { |
926 { |
932 CEikFormattedCellListBox::UpdateScrollBarThumbs(); |
927 CEikFormattedCellListBox::UpdateScrollBarThumbs(); |
933 } |
928 } |
934 |
929 |
935 // ----------------------------------------------------------------------------- |
930 // ----------------------------------------------------------------------------- |
936 // |
931 // |
937 // ----------------------------------------------------------------------------- |
932 // ----------------------------------------------------------------------------- |
938 // |
933 // |
939 TInt CMmListBox::CountComponentControls() const |
934 TInt CMmListBox::CountComponentControls() const |
940 { |
935 { |
941 TInt componentControls(0); |
936 TInt componentControls(0); |
942 if ( !iDisableChildComponentDrawing ) |
937 if ( !iDisableChildComponentDrawing ) |
943 { |
938 { |
944 componentControls = CEikFormattedCellListBoxTypedef::CountComponentControls(); |
939 componentControls = CEikFormattedCellListBoxTypedef::CountComponentControls(); |
945 } |
940 } |
946 return componentControls; |
941 return componentControls; |
947 } |
942 } |
948 // ----------------------------------------------------------------------------- |
943 // ----------------------------------------------------------------------------- |
949 // |
944 // |
950 // ----------------------------------------------------------------------------- |
945 // ----------------------------------------------------------------------------- |