Renaming of enum values for coding standards compliance.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-overshoot-indicator-impl.cpp
index bfc49c0..c02c7ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -133,10 +133,10 @@ ScrollOvershootEffectRipple::ScrollOvershootEffectRipple( bool vertical, Scrolla
     mAnimationStateFlags(0)
 {
   mOvershootOverlay = CreateBouncingEffectActor(mEffectOvershootProperty);
-  mOvershootOverlay.SetColor(mAttachedScrollView.GetOvershootEffectColor());
-  mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
-  mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-  mOvershootOverlay.SetVisible(false);
+  mOvershootOverlay.SetProperty( Actor::Property::COLOR,mAttachedScrollView.GetOvershootEffectColor());
+  mOvershootOverlay.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT );
+  mOvershootOverlay.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+  mOvershootOverlay.SetProperty( Actor::Property::VISIBLE,false);
 
 }
 
@@ -146,7 +146,8 @@ void ScrollOvershootEffectRipple::Apply()
   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( mOvershootSize );
+  mOvershootSize = mAttachedScrollView.GetOvershootSize();
+  mOvershootOverlay.SetProperty( Actor::Property::SIZE, mOvershootSize );
 
   mAttachedScrollView.AddOverlay(mOvershootOverlay);
 
@@ -173,7 +174,7 @@ void ScrollOvershootEffectRipple::Remove( Scrollable& scrollable )
 
 void ScrollOvershootEffectRipple::Reset()
 {
-  mOvershootOverlay.SetVisible(false);
+  mOvershootOverlay.SetProperty( Actor::Property::VISIBLE,false);
   mOvershootOverlay.SetProperty( mEffectOvershootProperty, 0.f);
 }
 
@@ -196,7 +197,7 @@ void ScrollOvershootEffectRipple::UpdatePropertyNotifications()
       increaseStep = MAX_OVERSHOOT_NOTIFY_AMOUNT;
     }
     mOvershootIncreaseNotification = self.AddPropertyNotification( mOvershootProperty, OutsideCondition(-increaseStep, increaseStep) );
-    mOvershootIncreaseNotification.SetNotifyMode(PropertyNotification::NotifyOnTrue);
+    mOvershootIncreaseNotification.SetNotifyMode(PropertyNotification::NOTIFY_ON_TRUE);
     mOvershootIncreaseNotification.NotifySignal().Connect(this, &ScrollOvershootEffectRipple::OnOvershootNotification);
   }
 
@@ -214,7 +215,7 @@ void ScrollOvershootEffectRipple::UpdatePropertyNotifications()
       reduceStep = MIN_OVERSHOOT_NOTIFY_AMOUNT;
     }
     mOvershootDecreaseNotification = self.AddPropertyNotification( mOvershootProperty, InsideCondition(-reduceStep, reduceStep) );
-    mOvershootDecreaseNotification.SetNotifyMode(PropertyNotification::NotifyOnTrue);
+    mOvershootDecreaseNotification.SetNotifyMode(PropertyNotification::NOTIFY_ON_TRUE);
     mOvershootDecreaseNotification.NotifySignal().Connect(this, &ScrollOvershootEffectRipple::OnOvershootNotification);
   }
 }
@@ -223,13 +224,13 @@ void ScrollOvershootEffectRipple::SetOvershootEffectColor( const Vector4& color
 {
   if(mOvershootOverlay)
   {
-    mOvershootOverlay.SetColor(color);
+    mOvershootOverlay.SetProperty( Actor::Property::COLOR,color);
   }
 }
 
 void ScrollOvershootEffectRipple::UpdateVisibility( bool visible )
 {
-  mOvershootOverlay.SetVisible(visible);
+  mOvershootOverlay.SetProperty( Actor::Property::VISIBLE,visible);
   // make sure overshoot image is correctly placed
   if( visible )
   {
@@ -237,41 +238,41 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible )
     if(mOvershoot > 0.0f)
     {
       // positive overshoot
-      const Vector3 size = mOvershootOverlay.GetCurrentSize();
+      const Vector3 size = mOvershootOverlay.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
       Vector3 relativeOffset;
-      const Vector3 parentSize = self.GetCurrentSize();
+      const Vector3 parentSize = self.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
       if(IsVertical())
       {
-        mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.0f ), Vector3::ZAXIS ) );
-        mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth);
+        mOvershootOverlay.SetProperty( Actor::Property::ORIENTATION, Quaternion( Quaternion( Radian( 0.0f ), Vector3::ZAXIS ) ) );
+        mOvershootOverlay.SetProperty( Actor::Property::SIZE, Vector3( parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth ) );
       }
       else
       {
-        mOvershootOverlay.SetOrientation( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) );
-        mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth);
+        mOvershootOverlay.SetProperty( Actor::Property::ORIENTATION, Quaternion( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) ) );
+        mOvershootOverlay.SetProperty( Actor::Property::SIZE, Vector3( parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth ) );
         relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
       }
-      mOvershootOverlay.SetPosition(relativeOffset * parentSize);
+      mOvershootOverlay.SetProperty( Actor::Property::POSITION, relativeOffset * parentSize );
     }
     else
     {
       // negative overshoot
-      const Vector3 size = mOvershootOverlay.GetCurrentSize();
+      const Vector3 size = mOvershootOverlay.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
       Vector3 relativeOffset;
-      const Vector3 parentSize = self.GetCurrentSize();
+      const Vector3 parentSize = self.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
       if(IsVertical())
       {
-        mOvershootOverlay.SetOrientation( Quaternion( Radian( Math::PI ), Vector3::ZAXIS ) );
-        mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth);
+        mOvershootOverlay.SetProperty( Actor::Property::ORIENTATION, Quaternion( Quaternion( Radian( Math::PI ), Vector3::ZAXIS ) ) );
+        mOvershootOverlay.SetProperty( Actor::Property::SIZE, Vector3( parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth ) );
         relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
       }
       else
       {
-        mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS ) );
-        mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth);
+        mOvershootOverlay.SetProperty( Actor::Property::ORIENTATION, Quaternion( Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS ) ) );
+        mOvershootOverlay.SetProperty( Actor::Property::SIZE, Vector3( parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth ) );
         relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
       }
-      mOvershootOverlay.SetPosition(relativeOffset * parentSize);
+      mOvershootOverlay.SetProperty( Actor::Property::POSITION, relativeOffset * parentSize );
     }
   }
 }
@@ -279,7 +280,7 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible )
 void ScrollOvershootEffectRipple::OnOvershootNotification(PropertyNotification& source)
 {
   Actor self = mAttachedScrollView.Self();
-  mOvershoot = self.GetProperty<float>(mOvershootProperty);
+  mOvershoot = self.GetCurrentProperty< float >( mOvershootProperty );
   SetOvershoot(mOvershoot, false);
   UpdatePropertyNotifications();
 }
@@ -319,7 +320,7 @@ void ScrollOvershootEffectRipple::SetOvershoot(float amount, bool animate)
   if( animate && overshootAnimationSpeed > Math::MACHINE_EPSILON_0 )
   {
     float currentOvershoot = fabsf( mOvershootOverlay.GetProperty( mEffectOvershootProperty ).Get<float>() );
-    float duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - currentOvershoot) : currentOvershoot) / overshootAnimationSpeed;
+    float duration = mOvershootOverlay.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height * (animatingOn ? (1.0f - currentOvershoot) : currentOvershoot) / overshootAnimationSpeed;
 
     if( duration > Math::MACHINE_EPSILON_0 )
     {
@@ -348,7 +349,7 @@ void ScrollOvershootEffectRipple::OnOvershootAnimFinished(Animation& animation)
   if( mAnimationStateFlags & AnimatingOut )
   {
     // should now be offscreen
-    mOvershootOverlay.SetVisible(false);
+    mOvershootOverlay.SetProperty( Actor::Property::VISIBLE,false);
   }
   if( (mAnimationStateFlags & AnimateBack) )
   {