X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fitem-view%2Fitem-view-impl.cpp;h=c4d28407d5494883d3df029ac1a6ce1cc6380b59;hp=bb13f590c471f14dbd3f8599e539022a62dde3d3;hb=50a22625931286411d1e35b555c80f135ed77396;hpb=b26250b0bc810ebeada606481882102b62cdb3e4 diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index bb13f59..c4d2840 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -53,6 +53,8 @@ DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "scroll-direction", DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout-orientation", INTEGER, LAYOUT_ORIENTATION) DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "scroll-content-size", FLOAT, SCROLL_CONTENT_SIZE) +DALI_SIGNAL_REGISTRATION( Toolkit, ItemView, "layout-activated", LAYOUT_ACTIVATED_SIGNAL ) + DALI_TYPE_REGISTRATION_END() const float DEFAULT_MINIMUM_SWIPE_SPEED = 1.0f; @@ -422,6 +424,11 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz mScrollAnimation.FinishedSignal().Connect(this, &ItemView::OnLayoutActivationScrollFinished); mScrollAnimation.Play(); } + else + { + // Emit the layout activated signal + mLayoutActivatedSignal.Emit(); + } AnimateScrollOvershoot(0.0f); mScrollOvershoot = 0.0f; @@ -450,11 +457,14 @@ void ItemView::DeactivateCurrentLayout() void ItemView::OnRefreshNotification(PropertyNotification& source) { - if(mRefreshEnabled || mScrollAnimation) + // Cancel scroll animation to prevent any fighting of setting the scroll position property by scroll bar during fast scroll. + if(!mRefreshEnabled && mScrollAnimation) { - // Only refresh the cache during normal scrolling - DoRefresh(GetCurrentLayoutPosition(0), true); + RemoveAnimation(mScrollAnimation); } + + // Only cache extra items when it is not a fast scroll + DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation); } void ItemView::Refresh() @@ -950,7 +960,6 @@ void ItemView::OnChildAdd(Actor& child) Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX_Y, Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE); - scrollBar.ScrollPositionIntervalReachedSignal().Connect( this, &ItemView::OnScrollPositionChanged ); } } } @@ -1298,6 +1307,9 @@ void ItemView::OnLayoutActivationScrollFinished(Animation& source) RemoveAnimation(mScrollAnimation); mRefreshEnabled = true; DoRefresh(GetCurrentLayoutPosition(0), true); + + // Emit the layout activated signal + mLayoutActivatedSignal.Emit(); } void ItemView::OnOvershootOnFinished(Animation& animation) @@ -1615,13 +1627,24 @@ void ItemView::GetItemsRange(ItemRange& range) } } -void ItemView::OnScrollPositionChanged( float position ) +bool ItemView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { - // Cancel scroll animation to prevent any fighting of setting the scroll position property. - RemoveAnimation(mScrollAnimation); + Dali::BaseHandle handle( object ); + + bool connected( true ); + Toolkit::ItemView itemView = Toolkit::ItemView::DownCast( handle ); + + if( 0 == strcmp( signalName.c_str(), LAYOUT_ACTIVATED_SIGNAL ) ) + { + itemView.LayoutActivatedSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } - // Refresh the cache immediately when the scroll position is changed. - DoRefresh(position, false); // No need to cache extra items. + return connected; } } // namespace Internal