X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscroll-bar%2Fscroll-bar-impl.cpp;h=f00276417dc1f3da72fc216c86d722e18b00cc9a;hp=683cfd6ec9ba6b3bdf11c1137b527fc995818c8e;hb=a57d543cd372560a9065a31b32184a6a02d49e77;hpb=ad110f27c01af7e617df158891eef5cf60bf22e6 diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp old mode 100755 new mode 100644 index 683cfd6..f002764 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ #include // for strcmp #include #include -#include #include #include #include @@ -178,8 +177,8 @@ DALI_ACTION_REGISTRATION( Toolkit, ScrollBar, "ShowTransientIndicator", DALI_TYPE_REGISTRATION_END() -const char* SCROLL_DIRECTION_NAME[] = {"Vertical", "Horizontal"}; -const char* INDICATOR_HEIGHT_POLICY_NAME[] = {"Variable", "Fixed"}; +const char* SCROLL_DIRECTION_NAME[] = {"VERTICAL", "HORIZONTAL"}; +const char* INDICATOR_HEIGHT_POLICY_NAME[] = {"VARIABLE", "FIXED"}; } @@ -187,7 +186,7 @@ ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction) : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIndicatorShowAlpha(1.0f), mDirection(direction), - mScrollableObject(WeakHandleBase()), + mScrollableObject(WeakHandle()), mPropertyScrollPosition(Property::INVALID_INDEX), mPropertyMinScrollPosition(Property::INVALID_INDEX), mPropertyMaxScrollPosition(Property::INVALID_INDEX), @@ -196,9 +195,9 @@ ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction) mIndicatorHideDuration(DEFAULT_INDICATOR_HIDE_DURATION), mTransientIndicatorDuration(DEFAULT_INDICATOR_TRANSIENT_DURATION), mScrollStart(0.0f), - mGestureDisplacement( Vector3::ZERO ), + mGestureDisplacement( Vector2::ZERO ), mCurrentScrollPosition(0.0f), - mIndicatorHeightPolicy(Toolkit::ScrollBar::Variable), + mIndicatorHeightPolicy(Toolkit::ScrollBar::VARIABLE), mIndicatorFixedHeight(DEFAULT_INDICATOR_FIXED_HEIGHT), mIndicatorMinimumHeight(DEFAULT_INDICATOR_MINIMUM_HEIGHT), mIndicatorStartPadding(DEFAULT_INDICATOR_START_PADDING), @@ -226,7 +225,7 @@ void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index property && propertyMaxScrollPosition != Property::INVALID_INDEX && propertyScrollContentSize != Property::INVALID_INDEX ) { - mScrollableObject = WeakHandleBase(handle); + mScrollableObject = WeakHandle(handle); mPropertyScrollPosition = propertyScrollPosition; mPropertyMinScrollPosition = propertyMinScrollPosition; mPropertyMaxScrollPosition = propertyMaxScrollPosition; @@ -266,7 +265,7 @@ void ScrollBar::SetScrollIndicator( Actor indicator ) mIndicatorFirstShow = true; Self().Add( mIndicator ); - EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); + EnableGestureDetection( GestureType::Value( GestureType::PAN ) ); PanGestureDetector detector( GetPanGestureDetector() ); detector.DetachAll(); @@ -295,7 +294,7 @@ Actor ScrollBar::GetScrollIndicator() void ScrollBar::ApplyConstraints() { - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { @@ -305,7 +304,7 @@ void ScrollBar::ApplyConstraints() } // Set indicator height according to the indicator's height policy - if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed) + if(mIndicatorHeightPolicy == Toolkit::ScrollBar::FIXED) { mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) ); } @@ -338,7 +337,7 @@ void ScrollBar::SetScrollPositionIntervals( const Dali::Vector& positions { mScrollPositionIntervals = positions; - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { @@ -360,7 +359,7 @@ Dali::Vector ScrollBar::GetScrollPositionIntervals() const void ScrollBar::OnScrollPositionIntervalReached(PropertyNotification& source) { // Emit the signal to notify the scroll position crossing - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if(scrollableHandle) { mScrollPositionIntervalReachedSignal.Emit( scrollableHandle.GetCurrentProperty< float >( mPropertyScrollPosition ) ); @@ -391,7 +390,7 @@ void ScrollBar::ShowIndicator() } else { - mIndicator.SetProperty( DevelActor::Property::OPACITY,mIndicatorShowAlpha); + mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha); } } @@ -412,7 +411,7 @@ void ScrollBar::HideIndicator() } else { - mIndicator.SetProperty( DevelActor::Property::OPACITY,0.0f); + mIndicator.SetProperty( Actor::Property::OPACITY,0.0f); } } @@ -433,7 +432,7 @@ void ScrollBar::ShowTransientIndicator() } else { - mIndicator.SetProperty( DevelActor::Property::OPACITY,mIndicatorShowAlpha); + mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha); } mAnimation.AnimateTo( Property( mIndicator, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::EASE_IN, TimePeriod((mIndicatorShowDuration + mTransientIndicatorDuration), mIndicatorHideDuration) ); @@ -443,7 +442,7 @@ void ScrollBar::ShowTransientIndicator() bool ScrollBar::OnPanGestureProcessTick() { // Update the scroll position property. - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { scrollableHandle.SetProperty(mPropertyScrollPosition, mCurrentScrollPosition); @@ -454,15 +453,15 @@ bool ScrollBar::OnPanGestureProcessTick() void ScrollBar::OnPan( const PanGesture& gesture ) { - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if(scrollableHandle) { Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast(scrollableHandle); - switch(gesture.state) + switch(gesture.GetState()) { - case Gesture::Started: + case Dali::GestureState::STARTED: { if( !mPanProcessTimer ) { @@ -474,15 +473,14 @@ void ScrollBar::OnPan( const PanGesture& gesture ) ShowIndicator(); mScrollStart = scrollableHandle.GetCurrentProperty< float >( mPropertyScrollPosition ); - mGestureDisplacement = Vector3::ZERO; + mGestureDisplacement = Vector2::ZERO; mIsPanning = true; break; } - case Gesture::Continuing: + case Dali::GestureState::CONTINUING: { - mGestureDisplacement.x += gesture.displacement.x; - mGestureDisplacement.y += gesture.displacement.y; + mGestureDisplacement += gesture.GetDisplacement(); float minScrollPosition = scrollableHandle.GetCurrentProperty( mPropertyMinScrollPosition ); float maxScrollPosition = scrollableHandle.GetCurrentProperty( mPropertyMaxScrollPosition ); @@ -530,7 +528,7 @@ void ScrollBar::OnPan( const PanGesture& gesture ) void ScrollBar::OnSizeSet( const Vector3& size ) { - if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed) + if(mIndicatorHeightPolicy == Toolkit::ScrollBar::FIXED) { mIndicator.SetProperty( Actor::Property::SIZE, Vector2( size.width, mIndicatorFixedHeight ) ); } @@ -566,7 +564,7 @@ void ScrollBar::SetIndicatorFixedHeight( float height ) { mIndicatorFixedHeight = height; - if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed) + if(mIndicatorHeightPolicy == Toolkit::ScrollBar::FIXED) { mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) ); } @@ -600,13 +598,13 @@ float ScrollBar::GetIndicatorHideDuration() const void ScrollBar::OnScrollDirectionPropertySet( Property::Value propertyValue ) { std::string directionName( propertyValue.Get() ); - if(directionName == "Vertical") + if(directionName == "VERTICAL") { - SetScrollDirection(Toolkit::ScrollBar::Vertical); + SetScrollDirection(Toolkit::ScrollBar::VERTICAL); } - else if(directionName == "Horizontal") + else if(directionName == "HORIZONTAL") { - SetScrollDirection(Toolkit::ScrollBar::Horizontal); + SetScrollDirection(Toolkit::ScrollBar::HORIZONTAL); } else { @@ -617,13 +615,13 @@ void ScrollBar::OnScrollDirectionPropertySet( Property::Value propertyValue ) void ScrollBar::OnIndicatorHeightPolicyPropertySet( Property::Value propertyValue ) { std::string policyName( propertyValue.Get() ); - if(policyName == "Variable") + if(policyName == "VARIABLE") { - SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable); + SetIndicatorHeightPolicy(Toolkit::ScrollBar::VARIABLE); } - else if(policyName == "Fixed") + else if(policyName == "FIXED") { - SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed); + SetIndicatorHeightPolicy(Toolkit::ScrollBar::FIXED); } else {