Revert "Revert "Remove ScrollViewCustomEffect""
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl.h
index 3f8562f..8706c1c 100644 (file)
@@ -19,7 +19,9 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/dali.h>
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/object/property-notification.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -27,9 +29,6 @@
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
 
-// predefined effect includes
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
-
 namespace Dali
 {
 
@@ -147,12 +146,6 @@ public:
   void ApplyEffect(Toolkit::ScrollViewEffect effect);
 
   /**
-   * @brief ApplyEffect Applies a predefined effect
-   * @param effect
-   */
-  Toolkit::ScrollViewEffect ApplyEffect(Toolkit::ScrollView::PageEffect effect);
-
-  /**
    * @copydoc Toolkit::ScrollView::RemoveEffect
    */
   void RemoveEffect(Toolkit::ScrollViewEffect effect);
@@ -193,22 +186,6 @@ public:
   void SetRulerY(RulerPtr ruler);
 
   /**
-   * @copydoc Toolkit::ScrollView::SetRulerScaleX
-   */
-  void SetRulerScaleX(RulerPtr ruler);
-
-  /**
-   * @copydoc Toolkit::ScrollView::SetRulerScaleY
-   */
-  void SetRulerScaleY(RulerPtr ruler);
-
-  /**
-   * Set Rotation axis ruler (defines how rotating is snapped in radians)
-   * @param[in] ruler The ruler to be used for the Rotation axis
-   */
-  void SetRulerRotation(RulerPtr ruler);
-
-  /**
    * @copydoc Toolkit::ScrollView::SetScrollSensitive
    */
   void SetScrollSensitive(bool sensitive);
@@ -266,18 +243,6 @@ 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;
@@ -328,6 +293,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;
@@ -363,25 +348,20 @@ public:
   void SetScrollPosition(const Vector3& position);
 
   /**
-   * @copydoc Toolkit::ScrollView::GetCurrentScrollScale
-   */
-  Vector3 GetCurrentScrollScale() const;
-
-  /**
    * @copydoc Toolkit::Scrollable::GetDomainSize
    */
   Vector3 GetDomainSize() const;
 
   /**
-   * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation)
+   * @copydoc ScrollTo(const Vector3&)
    */
-  void TransformTo(const Vector3& position, const Vector3& scale, float rotation,
+  void TransformTo(const Vector3& position,
                    DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
 
   /**
-   * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration)
+   * @copydoc ScrollTo(const Vector3&, float, AlhpaFunction, DirectionBias, DirectionBias)
    */
-  void TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration,
+  void TransformTo(const Vector3& position, float duration, AlphaFunction alpha,
                    DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
 
   /**
@@ -395,12 +375,23 @@ public:
   void ScrollTo(const Vector3& position, float duration);
 
   /**
+   * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha)
+   */
+  void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha);
+
+  /**
    * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
    */
   void ScrollTo(const Vector3& position, float duration,
                 DirectionBias horizontalBias, DirectionBias verticalBias);
 
   /**
+   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
+   */
+  void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha,
+                DirectionBias horizontalBias, DirectionBias verticalBias);
+
+  /**
    * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
    */
   void ScrollTo(unsigned int page);
@@ -454,16 +445,6 @@ public:
   bool ScrollToSnapPoint();
 
   /**
-   * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale)
-   */
-  void ScaleTo(const Vector3& scale);
-
-  /**
-   * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale, float duration)
-   */
-  void ScaleTo(const Vector3& scale, float duration);
-
-  /**
    * Stops animation
    */
   void StopAnimation(void);
@@ -476,14 +457,10 @@ public:
   void StopAnimation(Animation& animation);
 
   /**
-   * Animates to position/scale/rotation transform.
+   * Animates to position transform.
    *
    * @param[in] position The position to animate to
    * @param[in] positionDuration The number of seconds this animation should run for in each axis.
-   * @param[in] scale The scale to animate to
-   * @param[in] scaleDuration The number of seconds this animation should run for in each axis.
-   * @param[in] rotation The angle to animate to
-   * @param[in] rotationDuration The number of seconds this animation should run for in each axis.
    * @param[in] alpha The easing alpha function to use.
    * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
    * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
@@ -491,8 +468,6 @@ public:
    * @return True if animation necessary and taking place to reach desired transform.
    */
   bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
-                             const Vector3& scale, const Vector3& scaleDuration,
-                             float rotation, float rotationDuration,
                              AlphaFunction alpha, bool findShortcuts = true,
                              DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
                              SnapType snapType = Snap);
@@ -507,6 +482,11 @@ public:
    */
   void RemoveOverlay(Actor actor);
 
+  /**
+   * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
+   */
+  void SetOvershootEffectColor( const Vector4& color );
+
 public: //Signals
 
   /**
@@ -699,17 +679,15 @@ private:
    * Amalgamated Gesture Continuing event
    *
    * @param[in] panDelta average panning delta from base position (0)
-   * @param[in] scaleDelta average scale delta from base scale (1)
-   * @param[in] rotationDelta average rotation delta from base angle (0)
    */
-  void GestureContinuing(const Vector2& panDelta, const Vector2& scaleDelta, float rotationDelta);
+  void GestureContinuing(const Vector2& panDelta);
 
   /**
    * Called upon pan gesture event.
    *
    * @param[in] gesture The gesture event.
    */
-  void OnPan(PanGesture pan);
+  void OnPan( const PanGesture& pan);
 
   /**
    * Extension of the above gestures.
@@ -727,12 +705,6 @@ private:
   bool SnapWithVelocity(Vector2 velocity);
 
   /**
-   * Updates Container Transform based on Pan, Scale, and Rotation props.
-   * (occurs when continuing gesture i.e. dragging/pinching.)
-   */
-  void UpdateTransform();
-
-  /**
    * Finishes Container Transform
    * (occurs upon finishing gesture i.e. releasing)
    */
@@ -778,21 +750,6 @@ private:
   void WrapPosition(Vector3& position) const;
 
   /**
-   * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
-   *
-   * @param[in,out] scale The scale you wish to clamp
-   */
-  void ClampScale(Vector3& scale) const;
-
-  /**
-   * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
-   *
-   * @param[in,out] scale The scale you wish to clamp
-   * @param[out] clamped The results of the clamping.
-   */
-  void ClampScale(Vector3& scale, ClampState3 &clamped) const;
-
-  /**
    * Updates the main internal scroll constraints with new ruler and domain
    * values
    */
@@ -849,22 +806,15 @@ private:
   Vector3 GetPropertyPosition() const;
 
   /**
-   * Gets scale property.
-   *
-   * @return The current scale
-   */
-  Vector3 GetPropertyScale() const;
-
-  /**
-   * Handles a Stopped animation. Its position/scale/rotation properties need to be
-   * saved, and the animation flag switched off.
+   * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
+   * switched off.
    */
   void HandleStoppedAnimation();
 
   /**
    * Handles a Stopped animation (whether the animation completed, or was
-   * manually stopped). Its position/scale/rotation properties need to be
-   * saved, and the animation flag switched off.
+   * manually stopped). Its position properties need to be saved, and the
+   * animation flag switched off.
    */
   void HandleSnapAnimationFinished();
 
@@ -892,31 +842,19 @@ 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;
-
+  Vector2 mPanStartPosition;            ///< Where the pan gesture's touch down occured
   Vector3 mPanDelta;                    ///< Amount currently panned.
-  Vector3 mScaleDelta;                  ///< Amount currently scaled.
-  float mRotationDelta;                 ///< Amount currently rotated.
 
   unsigned int mScrollStateFlags;       ///< flags indicating current state of scrolling
-  // Scroll delegate pre and post position/scale/rotation properties...
+  // Scroll delegate pre and post position properties...
   Vector3 mScrollPrePosition;           ///< Wrapped scroll position, but not clamped
   Vector3 mScrollPostPosition;          ///< Wrapped and clamped, this is the final scroll position used
   Vector3 mScrollTargetPosition;        ///< Final target position for an animated scroll
-  Vector3 mScrollPreScale;              ///< Scroll delegate pre-scale
-  Vector3 mScrollPostScale;             ///< Scroll delegate post-scale (affected by current touch)
-  float mScrollPreRotation;             ///< Scroll delegate pre-rotation
-  float mScrollPostRotation;            ///< Scroll delegate post-rotation (affected by current touch)
   Vector3 mDomainOffset;                ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
 
   // Rulers for each axes...
   RulerPtr mRulerX;
   RulerPtr mRulerY;
-  RulerPtr mRulerScaleX;
-  RulerPtr mRulerScaleY;
-  RulerPtr mRulerRotation;
 
   // Last property values set to ScrollView
   Vector3 mMinScroll;
@@ -925,7 +863,6 @@ private:
   unsigned int mMinTouchesForPanning;   ///< Minimum number of touches for panning to be used.
   unsigned int mMaxTouchesForPanning;   ///< Maximum number of touches for panning to be used.
 
-  Animation mSnapAnimation;             ///< Used to animate rotation and scaling of scroll properties
   Animation mInternalXAnimation;        ///< Animates mPropertyX to a snap position or application requested scroll position
   Animation mInternalYAnimation;        ///< Animates mPropertyY to a snap position or application requested scroll position
 
@@ -952,6 +889,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.
 
@@ -965,8 +904,6 @@ private:
   //ScrollInternalConstraintsPtr mScrollInternalConstraints;
   ActiveConstraint mScrollMainInternalPrePositionConstraint;
   ActiveConstraint mScrollMainInternalPositionConstraint;
-  ActiveConstraint mScrollMainInternalXConstraint;
-  ActiveConstraint mScrollMainInternalYConstraint;
   ActiveConstraint mScrollMainInternalOvershootXConstraint;
   ActiveConstraint mScrollMainInternalOvershootYConstraint;
   ActiveConstraint mScrollMainInternalDeltaConstraint;
@@ -990,9 +927,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
+  bool mCanScrollHorizontal:1;            ///< Local value of our property to check against
+  bool mCanScrollVertical:1;              ///< Local value of our property to check against
 };
 
 } // namespace Internal