From: Richard Huang Date: Wed, 1 Apr 2015 15:00:52 +0000 (+0100) Subject: Use new animatable registered properties in ScrollView X-Git-Tag: accepted/tizen/common/20150407.101646~2^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=25798861cc281b2c86011ec099671f73a801f2b8 Use new animatable registered properties in ScrollView Change-Id: I900da3b5b1f984f028156638d2835056179697dd --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 9b9cad1..662502c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -239,14 +239,11 @@ struct TestSumConstraint */ static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView) { - Property::Index overshootPropertyX = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index overshootPropertyY = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - int timeToReachOrigin = -1; for(int i = 0;i(overshootPropertyX); - float overshootYValue = scrollView.GetProperty(overshootPropertyY); + float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); + float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); if(overshootXValue == 0.0f && overshootYValue == 0.0f) { break; @@ -817,9 +814,8 @@ int UtcDaliScrollViewConstraints(void) a.SetPosition( TEST_ACTOR_POSITION ); Wait(application); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); Constraint constraint = Constraint::New( Actor::Property::POSITION, - Source(scrollView, scrollPositionProperty), + Source(scrollView, ScrollView::Property::SCROLL_POSITION), TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.SetRemoveAction(Constraint::Discard); scrollView.ApplyConstraintToChildren(constraint); @@ -865,10 +861,9 @@ int UtcDaliScrollViewBind(void) a.SetPosition( TEST_ACTOR_POSITION ); Wait(application); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); // apply this constraint to scrollview Constraint constraint = Constraint::New( Actor::Property::POSITION, - Source(scrollView, scrollPositionProperty), + Source(scrollView, ScrollView::Property::SCROLL_POSITION), TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.SetRemoveAction(Constraint::Discard); @@ -1034,12 +1029,9 @@ int UtcDaliScrollViewOvershoot(void) // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch) Vector2 currentPos = Vector2(100.0f, 100.0f); currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false); - Property::Index overshootXProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index overshootYProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); - float overshootXValue = scrollView.GetProperty(overshootXProperty); - float overshootYValue = scrollView.GetProperty(overshootYProperty); - Vector3 positionValue = scrollView.GetProperty(scrollPositionProperty); + float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); + float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + Vector3 positionValue = scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(positionValue, Vector3::ZERO, TEST_LOCATION); diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp index 3b188df..b01505b 100755 --- a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp @@ -393,32 +393,32 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic // target the container to observe for scrolling Actor target = mContainer.Self(); Constraint constraint = Constraint::New( Actor::Property::VISIBLE, - Source( target, vertical ? target.GetPropertyIndex(Scrollable::SCROLLABLE_CAN_SCROLL_VERTICAL) : target.GetPropertyIndex(Scrollable::SCROLLABLE_CAN_SCROLL_HORIZONTAL)), + Source( target, vertical ? Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL : Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL), ScrollBarInternalVisibilityConstraint ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::SIZE, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalSizeConstraint( vertical ) ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::ORIENTATION, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), ScrollBarInternalRotationConstraint( vertical ) ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::POSITION, Source( mSlider, Actor::Property::SIZE), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalPositionConstraint(vertical) ); @@ -426,10 +426,10 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic constraint = Constraint::New( Actor::Property::POSITION, Source( mSlider, Actor::Property::SIZE), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalPositionConstraint(vertical, true) ); mSliderWrap.ApplyConstraint( constraint ); @@ -447,7 +447,7 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic mContainer.AddOverlay( mHitArea ); constraint = Constraint::New( Actor::Property::SIZE, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalHitSizeConstraint(vertical, BAR_TAB_SIZE.width) ); mHitArea.ApplyConstraint( constraint ); 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 f9b3281..fbc3626 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 @@ -362,8 +362,6 @@ ItemView::ItemView(ItemFactory& factory) void ItemView::OnInitialize() { - RegisterCommonProperties(); - Actor self = Self(); // Disable size negotiation for item views @@ -379,10 +377,10 @@ void ItemView::OnInitialize() EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator); - Constraint constraint = Constraint::New(mPropertyRelativePosition, + Constraint constraint = Constraint::New(Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, LocalSource(mPropertyPosition), - LocalSource(mPropertyPositionMin), - LocalSource(mPropertyPositionMax), + LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN), + LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX), LocalSource(Actor::Property::SIZE), RelativePositionConstraint); self.ApplyConstraint(constraint); @@ -520,7 +518,7 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz Radian scrollDirection(mActiveLayout->GetScrollDirection()); float orientation = static_cast(mActiveLayout->GetOrientation()); - self.SetProperty(mPropertyScrollDirection, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_DIRECTION, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation)); self.SetProperty(mPropertyScrollSpeed, mScrollSpeed); @@ -1455,22 +1453,22 @@ void ItemView::CalculateDomainSize(const Vector3& layoutSize) if(IsHorizontal(mActiveLayout->GetOrientation())) { - self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.x, 0.0f)); - self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.x, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.x, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.x, 0.0f)); domainSize = fabs(firstItemPosition.x - lastItemPosition.x); } else { - self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.y, 0.0f)); - self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.y, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.y, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.y, 0.0f)); domainSize = fabs(firstItemPosition.y - lastItemPosition.y); } mScrollConnector.SetScrollDomain(minLayoutPosition, 0.0f, domainSize); bool isLayoutScrollable = IsLayoutScrollable(layoutSize); - self.SetProperty(mPropertyCanScrollVertical, isLayoutScrollable); - self.SetProperty(mPropertyCanScrollHorizontal, false); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, isLayoutScrollable); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, false); } } @@ -1478,8 +1476,8 @@ Vector3 ItemView::GetDomainSize() const { Actor self = Self(); - float minScrollPosition = self.GetProperty(mPropertyPositionMin); - float maxScrollPosition = self.GetProperty(mPropertyPositionMax); + float minScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN); + float maxScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX); return Vector3(0.0f, fabs(maxScrollPosition - minScrollPosition), 0.0f); } @@ -1566,7 +1564,7 @@ void ItemView::SetOvershootEnabled( bool enable ) self.Add(mOvershootOverlay); Constraint constraint = Constraint::New( Actor::Property::SIZE, - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), ParentSource( Actor::Property::SIZE ), OvershootOverlaySizeConstraint() ); @@ -1574,20 +1572,20 @@ void ItemView::SetOvershootEnabled( bool enable ) mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); constraint = Constraint::New( Actor::Property::ORIENTATION, - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayRotationConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); constraint = Constraint::New( Actor::Property::POSITION, ParentSource( Actor::Property::SIZE ), - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayPositionConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); constraint = Constraint::New( Actor::Property::VISIBLE, - ParentSource( mPropertyCanScrollVertical ), + ParentSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ), OvershootOverlayVisibilityConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp index 60cb127..44ceade 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp @@ -33,23 +33,9 @@ namespace Internal // ScrollBase /////////////////////////////////////////////////////////////////////////////////////////////////// -const char* const ScrollBase::SCROLL_DOMAIN_OFFSET_PROPERTY_NAME = "domain-offset"; - ScrollBase::ScrollBase() : Scrollable(), mParent(NULL), - mPropertyTime(Property::INVALID_INDEX), - mPropertyPrePosition(Property::INVALID_INDEX), - mPropertyPosition(Property::INVALID_INDEX), - mPropertyOvershootX(Property::INVALID_INDEX), - mPropertyOvershootY(Property::INVALID_INDEX), - mPropertyWrap(Property::INVALID_INDEX), - mPropertyPanning(Property::INVALID_INDEX), - mPropertyScrolling(Property::INVALID_INDEX), - mPropertyFinal(Property::INVALID_INDEX), - mPropertyDomainOffset(Property::INVALID_INDEX), - mPropertyPositionDelta(Property::INVALID_INDEX), - mPropertyScrollStartPagePosition(Property::INVALID_INDEX), mDelay(0.0f) { } @@ -59,28 +45,6 @@ void ScrollBase::SetParent(ScrollBase *parent) mParent = parent; } -void ScrollBase::RegisterProperties() -{ - Actor self = Self(); - - // Register common properties - RegisterCommonProperties(); - - // Register Scroll Properties. - mPropertyTime = self.RegisterProperty(Toolkit::ScrollView::SCROLL_TIME_PROPERTY_NAME, 0.0f); - mPropertyPrePosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyPosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyOvershootX = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME, 0.0f); - mPropertyOvershootY = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME, 0.0f); - mPropertyFinal = self.RegisterProperty(Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME, Vector3::ZERO); - mPropertyWrap = self.RegisterProperty(Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME, false); - mPropertyPanning = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME, false); - mPropertyScrolling = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME, false); - mPropertyDomainOffset = self.RegisterProperty(SCROLL_DOMAIN_OFFSET_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionDelta = self.RegisterProperty(Toolkit::ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME, Vector3::ZERO); - mPropertyScrollStartPagePosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME, Vector3::ZERO); -} - void ScrollBase::BindActor(Actor child) { FindAndUnbindActor(child); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h index 968e3ab..a4b955c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h @@ -191,26 +191,9 @@ protected: */ ScrollBase(); - /** - * 2nd-phase initialization. - */ - void RegisterProperties(); - protected: ScrollBase *mParent; ///< Pointer to ScrollBase parent, if exists. - Property::Index mPropertyTime; ///< Scroll Time (0 to animationDuration while animating, otherwise 0) - Property::Index mPropertyPrePosition; ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y] - Property::Index mPropertyPosition; ///< Scroll Position ("scroll-position") [function of scroll-pre-position] - Property::Index mPropertyOvershootX; ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position] - Property::Index mPropertyOvershootY; ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position] - Property::Index mPropertyWrap; ///< Scroll Wrap ("scroll-wrap") - Property::Index mPropertyPanning; ///< Whether we are panning - Property::Index mPropertyScrolling; ///< Whether we are scrolling - Property::Index mPropertyFinal; ///< Scroll Final Position ("scroll-final") [scroll-position + f(scroll-overshoot)] - Property::Index mPropertyDomainOffset; ///< Scroll Domain Offset ("scroll-domain-offset") keeps track of scroll position as it wraps domains - Property::Index mPropertyPositionDelta; ///< Scroll Position Delta ("scroll-position-delta") - Property::Index mPropertyScrollStartPagePosition; ///< Scroll Start Page Position ("scroll-start-page-position") private: diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp index b02d3fc..c3a900e 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp @@ -158,7 +158,7 @@ ScrollOvershootEffectRipple::ScrollOvershootEffectRipple( bool vertical, Scrolla void ScrollOvershootEffectRipple::Apply() { Actor self = mAttachedScrollView.Self(); - mOvershootProperty = self.GetPropertyIndex(IsVertical() ? Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME : Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); + mOvershootProperty = IsVertical() ? Toolkit::ScrollView::Property::OVERSHOOT_Y : Toolkit::ScrollView::Property::OVERSHOOT_X; // make sure height is set, since we only create a constraint for image width mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp index ea529ff..6eb200b 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp @@ -83,7 +83,7 @@ public: * @param[in] positionProperty The Actor's Position. * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @return The new visibility of this Actor. */ @@ -114,7 +114,7 @@ public: * @param[in] positionProperty The Actor's Position. * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect) * @return The new orientation of this Actor. @@ -164,7 +164,7 @@ public: * @param[in] current The current position of this Actor * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect) * @return The new position of this Actor. @@ -234,7 +234,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, LocalSource( Actor::Property::POSITION ), LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::VisibilityConstraint, info, _1, _2, _3, _4, _5, _6) ); @@ -245,7 +245,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, LocalSource( Actor::Property::POSITION ), LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); @@ -255,7 +255,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6) ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp index 938ba1c..dfc980d 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp @@ -64,11 +64,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -134,11 +134,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -208,11 +208,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -305,11 +305,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -317,11 +317,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -329,11 +329,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp index 8b6003f..0f21d0c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp @@ -93,11 +93,11 @@ struct ScrollDepthScaleConstraint /** * @param[in] current The current scale * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new scale of this Actor. */ Vector3 operator()(const Vector3& currentScale, @@ -218,11 +218,11 @@ struct ScrollDepthPositionConstraint /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 operator()(const Vector3& currentPosition, @@ -339,9 +339,9 @@ void ApplyScrollDepthConstraints(Toolkit::ScrollView scrollView, Constraint constraint = Constraint::New( Actor::Property::SCALE, LocalSource(Actor::Property::POSITION), ParentSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), ScrollDepthScaleConstraint( positionExtent, offsetExtent, positionScale, scaleExtent ) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -350,11 +350,11 @@ void ApplyScrollDepthConstraints(Toolkit::ScrollView scrollView, // Position Constraint (apply last as other constraints use Actor::POSITION as a function input) constraint = Constraint::New( Actor::Property::POSITION, ParentSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), ScrollDepthPositionConstraint( positionExtent, offsetExtent, positionScale ) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 5111cec..ee5163c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -29,6 +29,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -213,6 +214,18 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ScrollView, Toolkit::Scrollable, Create ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-position", VECTOR3, SCROLL_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-pre-position", VECTOR3, SCROLL_PRE_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "overshoot-x", FLOAT, OVERSHOOT_X) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "overshoot-y", FLOAT, OVERSHOOT_Y) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-final", VECTOR3, SCROLL_FINAL) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "wrap", BOOLEAN, WRAP) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "panning", BOOLEAN, PANNING) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scrolling", BOOLEAN, SCROLLING) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-domain-offset", VECTOR3, SCROLL_DOMAIN_OFFSET) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-position-delta", VECTOR3, SCROLL_POSITION_DELTA) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "start-page-position", VECTOR3, START_PAGE_POSITION) + DALI_SIGNAL_REGISTRATION( ScrollView, "value-changed", SIGNAL_SNAP_STARTED ) DALI_TYPE_REGISTRATION_END() @@ -420,7 +433,7 @@ struct InternalPositionConstraint /** * This constraint updates the X overshoot property using the difference - * mPropertyPrePosition.x and mPropertyPosition.x, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.x and SCROLL_POSITION.x, returning a relative value between 0.0f and 1.0f */ struct OvershootXConstraint { @@ -446,7 +459,7 @@ struct OvershootXConstraint /** * This constraint updates the Y overshoot property using the difference - * mPropertyPrePosition.y and mPropertyPosition.y, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.y and SCROLL_POSITION.y, returning a relative value between 0.0f and 1.0f */ struct OvershootYConstraint { @@ -596,9 +609,6 @@ void ScrollView::OnInitialize() mAlterChild = true; - // Register Scroll Properties. - RegisterProperties(); - mScrollPostPosition = mScrollPrePosition = Vector3::ZERO; mMouseWheelScrollDistanceStep = Stage::GetCurrent().GetSize() * DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION; @@ -617,6 +627,9 @@ void ScrollView::OnInitialize() EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, mCanScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, mCanScrollHorizontal); + Vector3 size = GetControlSize(); UpdatePropertyDomain(size); SetInternalConstraints(); @@ -871,24 +884,24 @@ void ScrollView::UpdatePropertyDomain(const Vector3& size) if( mCanScrollVertical != canScrollVertical ) { mCanScrollVertical = canScrollVertical; - self.SetProperty(mPropertyCanScrollVertical, canScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, canScrollVertical); } if( mCanScrollHorizontal != canScrollHorizontal ) { mCanScrollHorizontal = canScrollHorizontal; - self.SetProperty(mPropertyCanScrollHorizontal, canScrollHorizontal); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, canScrollHorizontal); } if( scrollPositionChanged ) { - DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } if( domainChanged ) { mMinScroll = min; mMaxScroll = max; - self.SetProperty(mPropertyPositionMin, mMinScroll ); - self.SetProperty(mPropertyPositionMax, mMaxScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, mMinScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, mMaxScroll ); } } @@ -961,7 +974,7 @@ bool ScrollView::GetWrapMode() const void ScrollView::SetWrapMode(bool enable) { mWrapMode = enable; - Self().SetProperty(mPropertyWrap, enable); + Self().SetProperty(Toolkit::ScrollView::Property::WRAP, enable); } int ScrollView::GetScrollUpdateDistance() const @@ -1119,7 +1132,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); Vector3 currentScrollPosition = GetCurrentScrollPosition(); - self.SetProperty( mPropertyScrollStartPagePosition, currentScrollPosition ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, currentScrollPosition ); if( mScrolling ) // are we interrupting a current scroll? { @@ -1134,7 +1147,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct DALI_LOG_SCROLL_STATE("[0x%X] Interrupting Pan, set to false", this ); mPanning = false; mGestureStackDepth = 0; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { @@ -1142,7 +1155,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct } } - self.SetProperty(mPropertyScrolling, true); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 1 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); @@ -1158,7 +1171,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct if(!animating) { // if not animating, then this pan has completed right now. - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); mScrolling = false; // If we have no duration, then in the next update frame, we will be at the position specified as we just set. @@ -1450,7 +1463,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) if(child) { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); // Get center-point of the Actor. Vector3 childPosition = GetPositionOfAnchor(child, AnchorPoint::CENTER); @@ -1639,15 +1652,15 @@ bool ScrollView::AnimateTo(const Vector3& position, const Vector3& positionDurat if( !(mScrollStateFlags & SCROLL_ANIMATION_FLAGS) ) { - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollTargetPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollTargetPosition); mScrollPrePosition = mScrollTargetPosition; mScrollPostPosition = mScrollTargetPosition; WrapPosition(mScrollPostPosition); } DALI_LOG_SCROLL_STATE("[0x%X] position-changed, mScrollTargetPosition[%.2f, %.2f], mScrollPrePosition[%.2f, %.2f], mScrollPostPosition[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y, mScrollPrePosition.x, mScrollPrePosition.y, mScrollPostPosition.x, mScrollPostPosition.y ); - DALI_LOG_SCROLL_STATE("[0x%X] mPropertyPrePosition[%.2f, %.2f], mPropertyPosition[%.2f, %.2f]", this, self.GetProperty( mPropertyPrePosition ).Get().x, self.GetProperty( mPropertyPrePosition ).Get().y, self.GetProperty( mPropertyPosition ).Get().x, self.GetProperty( mPropertyPosition ).Get().y ); + DALI_LOG_SCROLL_STATE("[0x%X] SCROLL_PRE_POSITION[%.2f, %.2f], SCROLL_POSITION[%.2f, %.2f]", this, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().y, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().y ); } SetScrollUpdateNotification(true); @@ -1728,14 +1741,14 @@ void ScrollView::FindAndUnbindActor(Actor child) Vector3 ScrollView::GetPropertyPrePosition() const { - Vector3 position = Self().GetProperty(mPropertyPrePosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION); WrapPosition(position); return position; } Vector3 ScrollView::GetPropertyPosition() const { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); WrapPosition(position); return position; @@ -1751,21 +1764,21 @@ void ScrollView::HandleSnapAnimationFinished() // Emit Signal that scrolling has completed. mScrolling = false; Actor self = Self(); - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); Vector3 deltaPosition(mScrollPrePosition); UpdateLocalScrollProperties(); WrapPosition(mScrollPrePosition); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); Vector3 currentScrollPosition = GetCurrentScrollPosition(); DALI_LOG_SCROLL_STATE("[0x%X] mScrollCompletedSignal 3 current[%.2f, %.2f], mScrollTargetPosition[%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y, -mScrollTargetPosition.x, -mScrollTargetPosition.y ); mScrollCompletedSignal.Emit( currentScrollPosition ); mDomainOffset += deltaPosition - mScrollPostPosition; - self.SetProperty(mPropertyDomainOffset, mDomainOffset); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); HandleStoppedAnimation(); } @@ -1782,7 +1795,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollXUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 0, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } if( mScrollYUpdateNotification ) @@ -1795,7 +1808,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollYUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 1, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } } @@ -1869,16 +1882,6 @@ void ScrollView::OnChildRemove(Actor& child) UnbindActor(child); } -void ScrollView::OnPropertySet( Property::Index index, Property::Value propertyValue ) -{ - Actor self = Self(); - if( index == mPropertyPrePosition ) - { - DALI_LOG_SCROLL_STATE("[0x%X]: mPropertyPrePosition[%.2f, %.2f]", this, propertyValue.Get().x, propertyValue.Get().y); - propertyValue.Get(mScrollPrePosition); - } -} - void ScrollView::StartTouchDownTimer() { if ( !mTouchDownTimer ) @@ -1917,7 +1920,7 @@ bool ScrollView::OnTouchDownTimeout() mScrollInterrupted = true; // reset domain offset as scrolling from original plane. mDomainOffset = Vector3::ZERO; - Self().SetProperty(mPropertyDomainOffset, Vector3::ZERO); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector3::ZERO); UpdateLocalScrollProperties(); Vector3 currentScrollPosition = GetCurrentScrollPosition(); @@ -2047,32 +2050,32 @@ bool ScrollView::OnMouseWheelEvent(const MouseWheelEvent& event) void ScrollView::ResetScrolling() { Actor self = Self(); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); mScrollPrePosition = mScrollPostPosition; - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPostPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPostPosition); } void ScrollView::UpdateLocalScrollProperties() { Actor self = Self(); - self.GetProperty(mPropertyPrePosition).Get(mScrollPrePosition); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get(mScrollPrePosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); } // private functions void ScrollView::PreAnimatedScrollSetup() { - // mPropertyPrePosition is our unclamped property with wrapping - // mPropertyPosition is our final scroll position after clamping + // SCROLL_PRE_POSITION is our unclamped property with wrapping + // SCROLL_POSITION is our final scroll position after clamping Actor self = Self(); Vector3 deltaPosition(mScrollPostPosition); WrapPosition(mScrollPostPosition); mDomainOffset += deltaPosition - mScrollPostPosition; - Self().SetProperty(mPropertyDomainOffset, mDomainOffset); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); if( mScrollStateFlags & SCROLL_X_STATE_MASK ) { @@ -2103,11 +2106,11 @@ void ScrollView::AnimateInternalXTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().x, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().x, position ); mInternalXAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalXAnimation[0x%X]", this, mInternalXAnimation.GetObjectPtr() ); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalXAnimation.AnimateTo( Property(self, mPropertyPrePosition, 0), position, alpha, duration); + mInternalXAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position, alpha, duration); mInternalXAnimation.Play(); // erase current state flags @@ -2124,11 +2127,11 @@ void ScrollView::AnimateInternalYTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().y, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().y, position ); mInternalYAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalYAnimation[0x%X]", this, mInternalYAnimation.GetObjectPtr() ); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalYAnimation.AnimateTo( Property(self, mPropertyPrePosition, 1), position, alpha, TimePeriod(duration)); + mInternalYAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position, alpha, TimePeriod(duration)); mInternalYAnimation.Play(); // erase current state flags @@ -2151,7 +2154,7 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) if( source == mInternalXAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(mPropertyPrePosition).Get().x, mScrollPostPosition.x ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(SCROLL_PRE_POSITION).Get().x, mScrollPostPosition.x ); if( !(mScrollStateFlags & AnimatingInternalY) ) { @@ -2163,15 +2166,15 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) { const RulerDomain rulerDomain = mRulerX->GetDomain(); mScrollPrePosition.x = -WrapInDomain(-mScrollPrePosition.x, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalXTo(mScrollPostPosition.x); } if( source == mInternalYAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(mPropertyPrePosition).Get().y, mScrollPostPosition.y ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(SCROLL_PRE_POSITION).Get().y, mScrollPostPosition.y ); if( !(mScrollStateFlags & AnimatingInternalX) ) { @@ -2183,8 +2186,8 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) // wrap pre scroll y position and set it const RulerDomain rulerDomain = mRulerY->GetDomain(); mScrollPrePosition.y = -WrapInDomain(-mScrollPrePosition.y, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalYTo(mScrollPostPosition.y); } @@ -2238,7 +2241,7 @@ void ScrollView::SnapInternalXTo(float position) mInternalXAnimation = Animation::New(duration); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalXAnimation.AnimateTo(Property(self, mPropertyPrePosition, 0), position); + mInternalXAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position); mInternalXAnimation.Play(); // add internal animation state flag @@ -2264,7 +2267,7 @@ void ScrollView::SnapInternalYTo(float position) mInternalYAnimation = Animation::New(duration); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalYAnimation.AnimateTo(Property(self, mPropertyPrePosition, 1), position); + mInternalYAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position); mInternalYAnimation.Play(); // add internal animation state flag @@ -2357,8 +2360,8 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); GestureStarted(); mPanning = true; - self.SetProperty( mPropertyPanning, true ); - self.SetProperty( mPropertyScrollStartPagePosition, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, true ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); UpdateMainInternalConstraint(); break; @@ -2389,7 +2392,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); mLastVelocity = gesture.velocity; mPanning = false; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { @@ -2428,7 +2431,7 @@ void ScrollView::OnGestureEx(Gesture::State state) if(state == Gesture::Started) { Vector3 currentScrollPosition = GetCurrentScrollPosition(); - Self().SetProperty(mPropertyScrolling, true); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 2 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); mScrollStartedSignal.Emit( currentScrollPosition ); @@ -2474,7 +2477,7 @@ void ScrollView::FinishTransform() // if not animating, then this pan has completed right now. SetScrollUpdateNotification(false); mScrolling = false; - Self().SetProperty(mPropertyScrolling, false); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); if( fabs(mScrollPrePosition.x - mScrollTargetPosition.x) > Math::MACHINE_EPSILON_10 ) { @@ -2611,7 +2614,7 @@ void ScrollView::UpdateMainInternalConstraint() if( mPanning ) { - constraint = Constraint::New( mPropertyPrePosition, + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, Source( detector, PanGestureDetector::Property::LOCAL_POSITION ), Source( self, Actor::Property::SIZE ), InternalPrePositionConstraint( mPanStartPosition, initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) ); @@ -2619,33 +2622,33 @@ void ScrollView::UpdateMainInternalConstraint() } // 2. Second calculate the clamped position (actual position) - constraint = Constraint::New( mPropertyPosition, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_POSITION, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source( self, Actor::Property::SIZE ), InternalPositionConstraint( mRulerX->GetDomain(), mRulerY->GetDomain(), mWrapMode ) ); mScrollMainInternalPositionConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyPositionDelta, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyDomainOffset ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_POSITION_DELTA, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET ), InternalPositionDeltaConstraint ); mScrollMainInternalDeltaConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyFinal, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyOvershootX ), - LocalSource( mPropertyOvershootY ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_FINAL, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_X ), + LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_Y ), InternalFinalConstraint( FinalDefaultAlphaFunction, FinalDefaultAlphaFunction ) ); mScrollMainInternalFinalConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyRelativePosition, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), + constraint = Constraint::New( Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), LocalSource( Actor::Property::SIZE ), InternalRelativePositionConstraint ); mScrollMainInternalRelativeConstraint = self.ApplyConstraint( constraint ); @@ -2667,24 +2670,24 @@ void ScrollView::SetOvershootConstraintsEnabled(bool enabled) } if( enabled ) { - Constraint constraint = Constraint::New( mPropertyOvershootX, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollHorizontal ), + Constraint constraint = Constraint::New( Toolkit::ScrollView::Property::OVERSHOOT_X, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ), OvershootXConstraint(mMaxOvershoot.x) ); mScrollMainInternalOvershootXConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyOvershootY, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollVertical ), + constraint = Constraint::New( Toolkit::ScrollView::Property::OVERSHOOT_Y, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ), OvershootYConstraint(mMaxOvershoot.y) ); mScrollMainInternalOvershootYConstraint = self.ApplyConstraint( constraint ); } else { - self.SetProperty(mPropertyOvershootX, 0.0f); - self.SetProperty(mPropertyOvershootY, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_X, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_Y, 0.0f); } } @@ -2703,7 +2706,7 @@ void ScrollView::SetInternalConstraints() // MoveActor (scrolling) constraint = Constraint::New( Actor::Property::POSITION, - Source( self, mPropertyPosition ), + Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ), MoveActorConstraint ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); @@ -2713,9 +2716,9 @@ void ScrollView::SetInternalConstraints() LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::ANCHOR_POINT ), LocalSource( Actor::Property::SIZE ), - Source( self, mPropertyPositionMin ), - Source( self, mPropertyPositionMax ), - Source( self, mPropertyWrap ), + Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( self, Toolkit::ScrollView::Property::WRAP ), WrapActorConstraint ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index 8f9abc7..da194f9 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -525,11 +525,6 @@ private: // private overriden functions from CustomActorImpl and Controls virtual void OnChildRemove(Actor& child); /** - * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue ) - */ - virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ); - - /** * From CustomActorImpl; called after a touch-signal is received by the owning actor. * * We don't listen to these events as content within the contain may consume events. @@ -591,7 +586,7 @@ private: /** * Called whenever a snap animation has completed * @param[in] source the Animation instance that has completed. - * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition + * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION */ void ResetScrolling(); @@ -636,7 +631,7 @@ private: void OnScrollAnimationFinished( Animation& source ); /** - * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition + * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION * * @param[in] source the Animation instance that has completed. */ diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp index fb4578e..704cdaf 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp @@ -68,11 +68,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -120,11 +120,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -192,11 +192,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCarouselEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -204,11 +204,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp index 27e43e1..c65d4f3 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp @@ -71,11 +71,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -125,11 +125,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -185,11 +185,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -261,11 +261,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -273,11 +273,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -285,11 +285,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp index b414458..27db48f 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp @@ -82,11 +82,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -163,11 +163,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -251,11 +251,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -351,11 +351,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -363,11 +363,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -375,11 +375,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp index e21ef87..c8c669b 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp @@ -231,10 +231,6 @@ void ScrollViewWobbleEffect::OnDetach(Toolkit::ScrollView& scrollView) void ScrollViewWobbleEffect::AttachActor(Actor actor) { - Property::Index propertyPosition = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME); - Property::Index propertyOvershootX = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index propertyOvershootY = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - // Create effect-overshoot property if not already created. Property::Index propertyEffectOvershoot = actor.GetPropertyIndex(Toolkit::ScrollViewWobbleEffect::EFFECT_OVERSHOOT); if(propertyEffectOvershoot == Property::INVALID_INDEX) @@ -246,9 +242,9 @@ void ScrollViewWobbleEffect::AttachActor(Actor actor) Constraint constraint = Constraint::New( propertyEffectOvershoot, Source(scrollView, mPropertyTime), - Source(actor, propertyPosition), - Source(actor, propertyOvershootX), - Source(actor, propertyOvershootY), + Source(actor, Toolkit::ScrollView::Property::SCROLL_POSITION), + Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_X), + Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_Y), ScrollViewWobbleEffectConstraint(*this) ); actor.ApplyConstraint(constraint); } diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index 0c73cd4..3db2f3e 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -49,6 +49,13 @@ DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Scrollable, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Scrollable, "overshoot-effect-color", VECTOR4, OVERSHOOT_EFFECT_COLOR ) DALI_PROPERTY_REGISTRATION( Scrollable, "overshoot-animation-speed", FLOAT, OVERSHOOT_ANIMATION_SPEED ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-relative-position", VECTOR3, SCROLL_RELATIVE_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-position-min", VECTOR3, SCROLL_POSITION_MIN) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-position-max", VECTOR3, SCROLL_POSITION_MAX) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-direction", VECTOR3, SCROLL_DIRECTION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "can-scroll-vertical", BOOLEAN, CAN_SCROLL_VERTICAL) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "can-scroll-horizontal", BOOLEAN, CAN_SCROLL_HORIZONTAL) + DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-started", SIGNAL_SCROLL_STARTED ) DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-completed", SIGNAL_SCROLL_COMPLETED ) DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-updated", SIGNAL_SCROLL_UPDATED ) @@ -60,9 +67,6 @@ const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second } -const char* const Scrollable::SCROLLABLE_CAN_SCROLL_VERTICAL = "scrollable-can-scroll-vertical"; -const char* const Scrollable::SCROLLABLE_CAN_SCROLL_HORIZONTAL = "scrollable-can-scroll-horizontal"; - /////////////////////////////////////////////////////////////////////////////////////////////////// // Scrollable /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -73,12 +77,6 @@ Scrollable::Scrollable() : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | NO_SIZE_NEGOTIATION ) ), mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ), mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ), - mPropertyRelativePosition(Property::INVALID_INDEX), - mPropertyPositionMin(Property::INVALID_INDEX), - mPropertyPositionMax(Property::INVALID_INDEX), - mPropertyScrollDirection(Property::INVALID_INDEX), - mPropertyCanScrollVertical(Property::INVALID_INDEX), - mPropertyCanScrollHorizontal(Property::INVALID_INDEX), mOvershootEnabled(false) { } @@ -89,19 +87,6 @@ Scrollable::~Scrollable() mComponents.clear(); } -void Scrollable::RegisterCommonProperties() -{ - Actor self = Self(); - - // Register properties. - mPropertyRelativePosition = self.RegisterProperty(Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionMin = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionMax = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME, Vector3::ZERO); - mPropertyScrollDirection = self.RegisterProperty(Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME, Vector3::ZERO); - mPropertyCanScrollVertical = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_VERTICAL, true); - mPropertyCanScrollHorizontal = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_HORIZONTAL, true); -} - bool Scrollable::IsScrollComponentEnabled(Toolkit::Scrollable::ScrollComponentType type) const { if(type == Toolkit::Scrollable::OvershootIndicator) diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h index 799ed62..eb9f377 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h @@ -44,16 +44,6 @@ typedef IntrusivePtr ScrollablePtr; class Scrollable : public Control { public: - static const char* const SCROLLABLE_CAN_SCROLL_VERTICAL; - static const char* const SCROLLABLE_CAN_SCROLL_HORIZONTAL; - - /** - * Create a new Scrollable. - * @return A public handle to the newly allocated Scrollable. - */ -// static Dali::Toolkit::Scrollable New(); - -public: /** * @copydoc Dali::Toolkit::Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType type) @@ -196,11 +186,6 @@ protected: */ virtual ~Scrollable(); - /** - * Register common properties - */ - void RegisterCommonProperties(); - private: /** @@ -231,13 +216,6 @@ protected: Vector4 mOvershootEffectColor; /// mComponent; ///< ScrollComponent (such as a scrollbar/page indicator/status) Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal; diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index 9e8a9c7..be7a991 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -283,18 +283,6 @@ unsigned int FixedRuler::GetTotalPages() const // ScrollView /////////////////////////////////////////////////////////////////////////////////////////////////// -const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" ); -const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" ); -const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" ); -const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" ); -const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" ); -const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" ); -const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" ); -const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" ); -const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" ); -const std::string ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME( "scroll-position-delta" ); -const std::string ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME( "scroll-start-page-position" ); - const float ScrollView::DEFAULT_SLOW_SNAP_ANIMATION_DURATION(0.5f); const float ScrollView::DEFAULT_FAST_SNAP_ANIMATION_DURATION(0.25f); const float ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h index 6cf6331..3ba77ed 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h @@ -409,20 +409,6 @@ class DALI_IMPORT_API ScrollView : public Scrollable { public: - // Custom properties - - static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type float - static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type Vector3 - static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type Vector3 - static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float - static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float - static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type Vector3 - static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type bool - static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type bool - static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type bool - static const std::string SCROLL_POSITION_DELTA_PROPERTY_NAME; ///< Property, name "scroll-position-delta" type Vector3 - static const std::string SCROLL_START_PAGE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-start-page-position" type Vector3 - // Default settings static const float DEFAULT_SLOW_SNAP_ANIMATION_DURATION; ///< Default Drag-Release animation time. @@ -457,6 +443,36 @@ public: float duration; ///< Duration of snap animation. }; + /** + * @brief The start and end property ranges for this control. + */ + enum PropertyRange + { + ANIMATABLE_PROPERTY_START_INDEX = Toolkit::Scrollable::ANIMATABLE_PROPERTY_END_INDEX + 1, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX + 1000 ///< Reserve animatable property indices + }; + + /** + * @brief An enumeration of properties belonging to the ScrollView class. + */ + struct Property + { + enum + { + SCROLL_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scroll-position", type Vector3 + SCROLL_PRE_POSITION, ///< Property, name "scroll-pre-position", type Vector3 + OVERSHOOT_X, ///< Property, name "overshoot-x", type float + OVERSHOOT_Y, ///< Property, name "overshoot-y", type float + SCROLL_FINAL, ///< Property, name "scroll-final", type Vector3 + WRAP, ///< Property, name "wrap", type bool + PANNING, ///< Property, name "panning", type bool + SCROLLING, ///< Property, name "scrolling", type bool + SCROLL_DOMAIN_OFFSET, ///< Property, name "scroll-domain-offset" type Vector3 + SCROLL_POSITION_DELTA, ///< Property, name "scroll-position-delta" type Vector3 + START_PAGE_POSITION ///< Property, name "start-page-position" type Vector3 + }; + }; + typedef Signal< void ( const SnapEvent& ) > SnapStartedSignalType; ///< SnapStarted signal type /** diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp index 1ce8314..ff955ff 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp @@ -26,11 +26,6 @@ namespace Dali namespace Toolkit { -const std::string Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME( "scroll-relative-position" ); -const std::string Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME( "scroll-position-min" ); -const std::string Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME( "scroll-position-max" ); -const std::string Scrollable::SCROLL_DIRECTION_PROPERTY_NAME( "scroll-direction" ); - Scrollable::Scrollable() { } diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.h b/dali-toolkit/public-api/controls/scrollable/scrollable.h index 0b315f3..62f6100 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.h +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.h @@ -59,20 +59,16 @@ public: OvershootIndicator, }; - // Custom properties - - static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type Vector3 - static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type Vector3 - static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type Vector3 - static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type Vector2 - /** * @brief The start and end property ranges for this control. */ enum PropertyRange { PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices + + ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices }; /** @@ -82,8 +78,17 @@ public: { enum { + // Event side properties OVERSHOOT_EFFECT_COLOR = PROPERTY_START_INDEX, ///< Property, name "overshoot-effect-color", @see SetOvershootEffectColor(), type Vector4 OVERSHOOT_ANIMATION_SPEED, ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type float + + // Animatable properties + SCROLL_RELATIVE_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scroll-relative-position", type Vector3 + SCROLL_POSITION_MIN, ///< Property, name "scroll-position-min", type Vector3 + SCROLL_POSITION_MAX, ///< Property, name "scroll-position-max", type Vector3 + SCROLL_DIRECTION, ///< Property, name "scroll-direction", type Vector2 + CAN_SCROLL_VERTICAL, ///< Property, name "can-scroll-vertical", type bool + CAN_SCROLL_HORIZONTAL ///< Property, name "can-scroll-horizontal", type bool }; };