X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscroll-view%2Fscroll-view-impl.cpp;h=4f751906656e2e8b3fe1ab6d39a2b0ea24158b6f;hp=3e4039e3d9bf273d3aa6b31f075dc13acef9668e;hb=40c53b53859fb3dcdf265728b3f1af673453bbd0;hpb=ef15505c94dffeb0639c91d9d3cd374918c21c4f 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 3e4039e..4f75190 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 @@ -28,6 +28,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -100,7 +101,7 @@ const std::string INTERNAL_MAX_POSITION_PROPERTY_NAME( "internalMaxPosition" ); */ float VectorInDomain(float a, float b, float start, float end, Dali::Toolkit::DirectionBias bias) { - if(bias == Dali::Toolkit::DirectionBiasNone) + if(bias == Dali::Toolkit::DIRECTION_BIAS_NONE) { return ShortestDistanceInDomain( a, b, start, end ); } @@ -111,7 +112,7 @@ float VectorInDomain(float a, float b, float start, float end, Dali::Toolkit::Di if(vect > 0) { // +ve vector - if(bias == Dali::Toolkit::DirectionBiasRight) // going right, take the vector. + if(bias == Dali::Toolkit::DIRECTION_BIAS_RIGHT) // going right, take the vector. { return vect; } @@ -124,7 +125,7 @@ float VectorInDomain(float a, float b, float start, float end, Dali::Toolkit::Di else { // -ve vector - if(bias == Dali::Toolkit::DirectionBiasLeft) // going left, take the vector. + if(bias == Dali::Toolkit::DIRECTION_BIAS_LEFT) // going left, take the vector. { return vect; } @@ -343,8 +344,8 @@ struct InternalPrePositionConstraint mDomainMax = Vector2( -rulerDomainX.max, -rulerDomainY.max ); mClampX = rulerDomainX.enabled; mClampY = rulerDomainY.enabled; - mFixedRulerX = rulerX->GetType() == Ruler::Fixed; - mFixedRulerY = rulerY->GetType() == Ruler::Fixed; + mFixedRulerX = rulerX->GetType() == Ruler::FIXED; + mFixedRulerY = rulerY->GetType() == Ruler::FIXED; } void operator()( Vector2& scrollPostPosition, const PropertyInputContainer& inputs ) @@ -688,7 +689,7 @@ void ScrollView::OnInitialize() mGestureStackDepth = 0; - self.TouchSignal().Connect( this, &ScrollView::OnTouch ); + self.TouchedSignal().Connect( this, &ScrollView::OnTouch ); EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); // By default we'll allow the user to freely drag the scroll view, @@ -1002,7 +1003,7 @@ void ScrollView::SetScrollSensitive(bool sensitive) // while the scroll view is panning, the state needs to be reset. if ( mPanning ) { - PanGesture cancelGesture( Gesture::Cancelled ); + PanGesture cancelGesture = DevelPanGesture::New( Gesture::Cancelled ); OnPan( cancelGesture ); } @@ -1238,7 +1239,7 @@ void ScrollView::TransformTo(const Vector2& position, float duration, AlphaFunct true, horizontalBias, verticalBias, - Snap); + SNAP); if(!animating) { @@ -1267,12 +1268,12 @@ void ScrollView::ScrollTo(const Vector2& position) void ScrollView::ScrollTo(const Vector2& position, float duration) { - ScrollTo(position, duration, DirectionBiasNone, DirectionBiasNone); + ScrollTo(position, duration, DIRECTION_BIAS_NONE, DIRECTION_BIAS_NONE); } void ScrollView::ScrollTo(const Vector2& position, float duration, AlphaFunction alpha) { - ScrollTo(position, duration, alpha, DirectionBiasNone, DirectionBiasNone); + ScrollTo(position, duration, alpha, DIRECTION_BIAS_NONE, DIRECTION_BIAS_NONE); } void ScrollView::ScrollTo(const Vector2& position, float duration, @@ -1559,7 +1560,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) Vector2 clampDelta(Vector2::ZERO); ClampPosition(positionSnap); - if( (mRulerX->GetType() == Ruler::Free || mRulerY->GetType() == Ruler::Free) + if( (mRulerX->GetType() == Ruler::FREE || mRulerY->GetType() == Ruler::FREE) && isFreeFlick && !mActorAutoSnapEnabled) { // Calculate target position based on velocity of flick. @@ -1582,12 +1583,12 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) float t = speed / a; - if(mRulerX->IsEnabled() && mRulerX->GetType() == Ruler::Free) + if(mRulerX->IsEnabled() && mRulerX->GetType() == Ruler::FREE) { positionSnap.x += t*u.x*0.5f; } - if(mRulerY->IsEnabled() && mRulerY->GetType() == Ruler::Free) + if(mRulerY->IsEnabled() && mRulerY->GetType() == Ruler::FREE) { positionSnap.y += t*u.y*0.5f; } @@ -1607,7 +1608,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) // If Axis is Free and has velocity, then calculate time taken // to reach target based on velocity in axis. - if(mRulerX->IsEnabled() && mRulerX->GetType() == Ruler::Free) + if(mRulerX->IsEnabled() && mRulerX->GetType() == Ruler::FREE) { float deltaX = fabsf(startPosition.x - positionSnap.x); @@ -1621,7 +1622,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) } } - if(mRulerY->IsEnabled() && mRulerY->GetType() == Ruler::Free) + if(mRulerY->IsEnabled() && mRulerY->GetType() == Ruler::FREE) { float deltaY = fabsf(startPosition.y - positionSnap.y); @@ -1644,8 +1645,8 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) bool animating = AnimateTo(positionSnap, positionDuration, alphaFunction, false, - DirectionBiasNone, DirectionBiasNone, - isFlick || isFreeFlick ? Flick : Snap); + DIRECTION_BIAS_NONE, DIRECTION_BIAS_NONE, + isFlick || isFreeFlick ? FLICK : SNAP); return animating; } @@ -1971,7 +1972,7 @@ void ScrollView::OnChildAdd(Actor& child) scrollBar.SetProperty( Dali::Actor::Property::NAME,"ScrollBar"); mInternalActor.Add( scrollBar ); - if( scrollBar.GetScrollDirection() == Toolkit::ScrollBar::Horizontal ) + if( scrollBar.GetScrollDirection() == Toolkit::ScrollBar::HORIZONTAL ) { scrollBar.SetScrollPropertySource( Self(), Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_X, @@ -2096,7 +2097,7 @@ bool ScrollView::OnTouch( Actor actor, const TouchEvent& touch ) else if( ( pointState == PointState::UP ) || ( ( pointState == PointState::INTERRUPTED ) && ( touch.GetHitActor( 0 )== Self() ) ) ) { - DALI_LOG_SCROLL_STATE("[0x%X] %s", this, ( ( pointState == TouchPoint::Up ) ? "Up" : "Interrupted" ) ); + DALI_LOG_SCROLL_STATE("[0x%X] %s", this, ( ( pointState == PointState::UP ) ? "Up" : "Interrupted" ) ); StopTouchDownTimer(); @@ -2141,33 +2142,33 @@ bool ScrollView::OnWheelEvent(const WheelEvent& event) if(mRulerX->IsEnabled() && !mRulerY->IsEnabled()) { // If only the ruler in the X axis is enabled, scroll in the X axis. - if(mRulerX->GetType() == Ruler::Free) + if(mRulerX->GetType() == Ruler::FREE) { // Free panning mode - targetScrollPosition.x += event.z * mWheelScrollDistanceStep.x; + targetScrollPosition.x += event.GetDelta() * mWheelScrollDistanceStep.x; ClampPosition(targetScrollPosition); ScrollTo(-targetScrollPosition); } else if(!mScrolling) { // Snap mode, only respond to the event when the previous snap animation is finished. - ScrollTo(GetCurrentPage() - event.z); + ScrollTo(GetCurrentPage() - event.GetDelta()); } } else { // If the ruler in the Y axis is enabled, scroll in the Y axis. - if(mRulerY->GetType() == Ruler::Free) + if(mRulerY->GetType() == Ruler::FREE) { // Free panning mode - targetScrollPosition.y += event.z * mWheelScrollDistanceStep.y; + targetScrollPosition.y += event.GetDelta() * mWheelScrollDistanceStep.y; ClampPosition(targetScrollPosition); ScrollTo(-targetScrollPosition); } else if(!mScrolling) { // Snap mode, only respond to the event when the previous snap animation is finished. - ScrollTo(GetCurrentPage() - event.z * mRulerX->GetTotalPages()); + ScrollTo(GetCurrentPage() - event.GetDelta() * mRulerX->GetTotalPages()); } } @@ -2478,17 +2479,18 @@ void ScrollView::OnPan( const PanGesture& gesture ) } // translate Gesture input to get useful data... - switch(gesture.state) + switch(gesture.GetState()) { case Gesture::Started: { DALI_LOG_SCROLL_STATE("[0x%X] Pan Started", this); - mPanStartPosition = gesture.position - gesture.displacement; + const Vector2& position = gesture.GetPosition(); + mPanStartPosition = position - gesture.GetDisplacement(); UpdateLocalScrollProperties(); GestureStarted(); mPanning = true; self.SetProperty( Toolkit::ScrollView::Property::PANNING, true ); - self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(position.x, position.y, 0.0f) ); UpdateMainInternalConstraint(); Toolkit::ScrollBar scrollBar = mScrollBar.GetHandle(); @@ -2511,7 +2513,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) if ( mPanning ) { DALI_LOG_SCROLL_STATE("[0x%X] Pan Continuing", this); - GestureContinuing(gesture.screenDisplacement); + GestureContinuing(gesture.GetScreenDisplacement()); } else { @@ -2526,10 +2528,10 @@ void ScrollView::OnPan( const PanGesture& gesture ) { if ( mPanning ) { - DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.state == Gesture::Finished ) ? "Finished" : "Cancelled" ) ); + DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.GetState() == Gesture::Finished ) ? "Finished" : "Cancelled" ) ); UpdateLocalScrollProperties(); - mLastVelocity = gesture.velocity; + mLastVelocity = gesture.GetVelocity(); mPanning = false; self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); @@ -2561,7 +2563,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) } // end switch(gesture.state) - OnGestureEx(gesture.state); + OnGestureEx(gesture.GetState()); } void ScrollView::OnGestureEx(Gesture::State state) @@ -2864,7 +2866,7 @@ void ScrollView::SetInternalConstraints() // MoveActor (scrolling) constraint = Constraint::New( self, Actor::Property::POSITION, MoveActorConstraint ); constraint.AddSource( Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ) ); - constraint.SetRemoveAction(Constraint::Discard); + constraint.SetRemoveAction(Constraint::DISCARD); ApplyConstraintToBoundActors(constraint); // WrapActor (wrap functionality) @@ -2875,7 +2877,7 @@ void ScrollView::SetInternalConstraints() constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) ); constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) ); constraint.AddSource( Source( self, Toolkit::ScrollView::Property::WRAP ) ); - constraint.SetRemoveAction(Constraint::Discard); + constraint.SetRemoveAction(Constraint::DISCARD); ApplyConstraintToBoundActors(constraint); }