ScrollView - Added APIs for minimum pan speed/distance before being considered a...
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl.h
index 1315a66..20215a4 100644 (file)
@@ -266,16 +266,28 @@ public:
   void SetWrapMode(bool enable);
 
   /**
+   * @deprecated
    * @copydoc Toolkit::ScrollView::GetRefreshInterval
    */
   int GetRefreshInterval() const;
 
   /**
+   * @deprecated
    * @copydoc Toolkit::ScrollView::SetRefreshInterval
    */
   void SetRefreshInterval(int milliseconds);
 
   /**
+   * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
+   */
+  int GetScrollUpdateDistance() const;
+
+  /**
+   * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
+   */
+  void SetScrollUpdateDistance(int distance);
+
+  /**
    * @copydoc Toolkit::ScrollView::GetAxisAutoLock
    */
   bool GetAxisAutoLock() const;
@@ -316,6 +328,26 @@ public:
   void SetFlickSpeedCoefficient(float speed);
 
   /**
+   * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
+   */
+  Vector2 GetMinimumDistanceForFlick() const;
+
+  /**
+   * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
+   */
+  void SetMinimumDistanceForFlick( const Vector2& distance );
+
+  /**
+   * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
+   */
+  float GetMinimumSpeedForFlick() const;
+
+  /**
+   * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
+   */
+  void SetMinimumSpeedForFlick( float speed );
+
+  /**
    * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
    */
   float GetMaxFlickSpeed() const;
@@ -495,6 +527,11 @@ public:
    */
   void RemoveOverlay(Actor actor);
 
+  /**
+   * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
+   */
+  void SetOvershootEffectColor( const Vector4& color );
+
 public: //Signals
 
   /**
@@ -649,6 +686,27 @@ private:
   void OnScrollAnimationFinished( Animation& source );
 
   /**
+   * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition
+   *
+   * @param[in] source the Animation instance that has completed.
+   */
+  void OnSnapInternalPositionFinished( Animation& source );
+
+  /**
+   * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
+   * position to our clamped position
+   * @param[in] position The x position to snap pre scroll property to
+   */
+  void SnapInternalXTo( float position );
+
+  /**
+   * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
+   * position to our clamped position
+   * @param[in] position The y position to snap pre scroll property to
+   */
+  void SnapInternalYTo( float position );
+
+  /**
    * This is called internally whenever the Scroll Rulers are
    * modified. This will update the properties: 'scroll-position-min'
    * and 'scroll-position-max' to reflect the changes.
@@ -836,20 +894,15 @@ private:
   void HandleSnapAnimationFinished();
 
   /**
-   * Helper to start the refresh timer.
+   * Checks if the property notifications are active and adds them if not
    */
-  void StartRefreshTimer();
-
-  /**
-   * Helper to cancel the refresh timer.
-   */
-  void CancelRefreshTimer();
+  void SetScrollUpdateNotification( bool enabled );
 
   /**
    * Refresh the ScrollView (used when animating to update application developer of changes)
    * @return True if the refresh timer should be kept running.
    */
-  bool OnRefreshTick();
+  void OnScrollUpdateNotification(Dali::PropertyNotification& source);
 
 private:
 
@@ -864,9 +917,6 @@ private:
   unsigned long mTouchDownTime;         ///< The touch down time
 
   int mGestureStackDepth;               ///< How many gestures are currently occuring.
-  Vector2 mGestureReferencePosition;    ///< Point where scaling should occur from.
-  Vector2 mPinchGestureLastPosition;
-  Vector2 mPinchGestureLastScale;
 
   Vector3 mPanDelta;                    ///< Amount currently panned.
   Vector3 mScaleDelta;                  ///< Amount currently scaled.
@@ -890,6 +940,10 @@ private:
   RulerPtr mRulerScaleY;
   RulerPtr mRulerRotation;
 
+  // Last property values set to ScrollView
+  Vector3 mMinScroll;
+  Vector3 mMaxScroll;
+
   unsigned int mMinTouchesForPanning;   ///< Minimum number of touches for panning to be used.
   unsigned int mMaxTouchesForPanning;   ///< Maximum number of touches for panning to be used.
 
@@ -902,9 +956,10 @@ private:
   LockAxis mLockAxis;
 
   Timer mTouchDownTimer;                ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
-  Timer mOvershootRefreshTimer;
-  Timer mRefreshTimer;                  ///< Refresh timer is used to provide the Application developer with updates as animations run.
-  int mRefreshIntervalMilliseconds;     ///< Refresh timer interval.
+
+  float mScrollUpdateDistance;          ///< Distance for scrolling to travel for the scroll update notifications
+  Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
+  Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
 
   Actor mInternalActor;                 ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
 
@@ -919,6 +974,8 @@ private:
   float mSnapDuration;                          ///< Time for the snap animation to take (in seconds).
   AlphaFunction mSnapAlphaFunction;             ///< AlphaFunction to be used for the Snap Animation.
 
+  Vector2 mMinFlickDistance;                      ///< Minimum pan distance required for a flick
+  float mFlickSpeedThreshold;                   ///< Minimum pan speed required for a flick in pixels/ms
   float mFlickDuration;                         ///< Time for the flick animation to take (in seconds).
   AlphaFunction mFlickAlphaFunction;            ///< AlphaFunction to be used for the Flick Animation.
 
@@ -957,7 +1014,8 @@ private:
   bool mAxisAutoLock:1;                   ///< Whether to automatically lock axis when panning.
   bool mAlterChild:1;                     ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
   bool mDefaultMaxOvershoot:1;            ///< Whether to use default max overshoot or application defined one
-  bool mUserSetPosition:1;                ///< SetScrollPosition has been called, return this position until internals get control of scroll position again
+  bool mCanScrollHorizontal:1;            ///< Local value of our property to check against
+  bool mCanScrollVertical:1;              ///< Local value of our property to check against
 };
 
 } // namespace Internal