Provide alternative implementation of IsOverScrollThreshold()
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl.cpp
index 6d37417..c953947 100644 (file)
@@ -84,7 +84,13 @@ enum
    * @brief True if scroll-bar should be automatically show/hidden during/after panning.
    * @details name "transientScrollBar", type bool.
    */
-  TRANSIENT_SCROLL_BAR = Toolkit::ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP + 1
+  TRANSIENT_SCROLL_BAR = Toolkit::ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP + 1,
+
+  /**
+   * @brief True if ScrollView is panning or scrolling
+   * @details name "panningOrScrolling", type bool.
+   */
+  PANNING_OR_SCROLLING
 };
 
 
@@ -264,6 +270,9 @@ DALI_PROPERTY_REGISTRATION( Toolkit, ScrollView, "wheelScrollDistanceStep",    V
 Dali::PropertyRegistration manualProperty1( typeRegistration, "transientScrollBar", TRANSIENT_SCROLL_BAR,
     Property::BOOLEAN, Dali::Toolkit::Internal::ScrollView::SetProperty, Dali::Toolkit::Internal::ScrollView::GetProperty );
 
+Dali::PropertyRegistration manualProperty2( typeRegistration, "panningOrScrolling", PANNING_OR_SCROLLING,
+    Property::BOOLEAN, Dali::Toolkit::Internal::ScrollView::SetProperty, Dali::Toolkit::Internal::ScrollView::GetProperty );
+
 DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scrollPosition",  VECTOR2, SCROLL_POSITION)
 DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scrollPrePosition",   VECTOR2, SCROLL_PRE_POSITION)
 DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, ScrollView, "scrollPrePositionX",    SCROLL_PRE_POSITION_X, SCROLL_PRE_POSITION, 0)
@@ -2908,6 +2917,29 @@ void ScrollView::SetInternalConstraints()
   ApplyConstraintToBoundActors(constraint);
 }
 
+bool ScrollView::IsPanningOrScrolling() const
+{
+  bool panningOrScrolling( mPanning );
+
+  if( mInternalXAnimation )
+  {
+    if( Animation::PLAYING == mInternalXAnimation.GetState() )
+    {
+      panningOrScrolling = true;
+    }
+  }
+
+  if( mInternalYAnimation )
+  {
+    if( Animation::PLAYING == mInternalYAnimation.GetState() )
+    {
+      panningOrScrolling = true;
+    }
+  }
+
+  return panningOrScrolling;
+}
+
 void ScrollView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 {
   Toolkit::ScrollView scrollView = Toolkit::ScrollView::DownCast( Dali::BaseHandle( object ) );
@@ -2942,6 +2974,11 @@ void ScrollView::SetProperty( BaseObject* object, Property::Index index, const P
         scrollViewImpl.SetTransientScrollBar( value.Get<bool>() );
         break;
       }
+      case PANNING_OR_SCROLLING:
+      {
+        // NOOP
+        break;
+      }
     }
   }
 }
@@ -2982,6 +3019,11 @@ Property::Value ScrollView::GetProperty( BaseObject* object, Property::Index ind
         value = scrollViewImpl.mTransientScrollBar;
         break;
       }
+      case PANNING_OR_SCROLLING:
+      {
+        value = scrollViewImpl.IsPanningOrScrolling();
+        break;
+      }
     }
   }