Replace some Dali::Actor public APIs with new properties
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scroll-bar / scroll-bar-impl.cpp
index 6b842fe..8a2d5be 100755 (executable)
@@ -28,6 +28,7 @@
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/integration-api/debug.h>
 #include <dali/devel-api/object/property-helper-devel.h>
+#include <dali/devel-api/actors/actor-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
@@ -214,7 +215,7 @@ ScrollBar::~ScrollBar()
 void ScrollBar::OnInitialize()
 {
   CreateDefaultIndicatorActor();
-  Self().SetDrawMode(DrawMode::OVERLAY_2D);
+  Self().SetProperty( Actor::Property::DRAW_MODE,DrawMode::OVERLAY_2D);
 }
 
 void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize )
@@ -243,10 +244,10 @@ void ScrollBar::CreateDefaultIndicatorActor()
 {
   const std::string imageDirPath = AssetManager::GetDaliImagePath();
   Toolkit::ImageView indicator = Toolkit::ImageView::New( imageDirPath + DEFAULT_INDICATOR_IMAGE_FILE_NAME );
-  indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
-  indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  indicator.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+  indicator.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
   indicator.SetStyleName( "ScrollBarIndicator" );
-  indicator.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+  indicator.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
   SetScrollIndicator(indicator);
 }
 
@@ -306,7 +307,7 @@ void ScrollBar::ApplyConstraints()
     // Set indicator height according to the indicator's height policy
     if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
     {
-      mIndicator.SetSize(Self().GetCurrentSize().width, mIndicatorFixedHeight);
+      mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) );
     }
     else
     {
@@ -378,7 +379,7 @@ void ScrollBar::ShowIndicator()
   if( mIndicatorFirstShow )
   {
     // Preserve the alpha value from the stylesheet
-    mIndicatorShowAlpha = Self().GetCurrentColor().a;
+    mIndicatorShowAlpha = Self().GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a;
     mIndicatorFirstShow = false;
   }
 
@@ -390,7 +391,7 @@ void ScrollBar::ShowIndicator()
   }
   else
   {
-    mIndicator.SetOpacity(mIndicatorShowAlpha);
+    mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha);
   }
 }
 
@@ -411,7 +412,7 @@ void ScrollBar::HideIndicator()
   }
   else
   {
-    mIndicator.SetOpacity(0.0f);
+    mIndicator.SetProperty( Actor::Property::OPACITY,0.0f);
   }
 }
 
@@ -432,7 +433,7 @@ void ScrollBar::ShowTransientIndicator()
   }
   else
   {
-    mIndicator.SetOpacity(mIndicatorShowAlpha);
+    mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha);
   }
   mAnimation.AnimateTo( Property( mIndicator, Actor::Property::COLOR_ALPHA ),
                         0.0f, AlphaFunction::EASE_IN, TimePeriod((mIndicatorShowDuration + mTransientIndicatorDuration), mIndicatorHideDuration) );
@@ -488,7 +489,7 @@ void ScrollBar::OnPan( const PanGesture& gesture )
 
         // The domain size is the internal range
         float domainSize = maxScrollPosition - minScrollPosition;
-        float logicalSize = Self().GetCurrentSize().y - ( mIndicator.GetCurrentSize().y + mIndicatorStartPadding + mIndicatorEndPadding );
+        float logicalSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y - ( mIndicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y + mIndicatorStartPadding + mIndicatorEndPadding );
 
         mCurrentScrollPosition = mScrollStart - ( ( mGestureDisplacement.y * domainSize ) / logicalSize );
         mCurrentScrollPosition = -std::min( maxScrollPosition, std::max( -mCurrentScrollPosition, minScrollPosition ) );
@@ -531,7 +532,7 @@ void ScrollBar::OnSizeSet( const Vector3& size )
 {
   if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
   {
-    mIndicator.SetSize(size.width, mIndicatorFixedHeight);
+    mIndicator.SetProperty( Actor::Property::SIZE, Vector2( size.width, mIndicatorFixedHeight ) );
   }
 
   Control::OnSizeSet( size );
@@ -567,7 +568,7 @@ void ScrollBar::SetIndicatorFixedHeight( float height )
 
   if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
   {
-    mIndicator.SetSize(Self().GetCurrentSize().width, mIndicatorFixedHeight);
+    mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) );
   }
 }