Reducing control size from 256 bytes to 224 by reordering data members and bitfieldin...
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl.h
index 1591fb6..f60d3de 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;
@@ -602,13 +614,6 @@ private:
   bool OnTouchDownTimeout();
 
   /**
-   * Called whenever a snap animation has completed
-   * @param[in] source the Animation instance that has completed.
-   * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition
-   */
-  void ResetScrolling();
-
-  /**
    * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
    */
   void UpdateLocalScrollProperties();
@@ -693,18 +698,25 @@ private:
   void GestureContinuing(const Vector2& panDelta, const Vector2& scaleDelta, float rotationDelta);
 
   /**
-   * Called upon pan gesture event.
+   * Called when either pan starts or animated scroll starts
    *
-   * @param[in] gesture The gesture event.
+   * @param[in] scroll position where scrolling started in positive scroll coordinates (scroll properties are negative)
    */
-  void OnPan(PanGesture pan);
+  void ScrollingStarted( const Vector3& position );
 
   /**
-   * Extension of the above gestures.
+   * Called when scrolling stops, either due to interruption from pan or when scroll animation finishes
+   *
+   * @param[in] scroll position where scrolling stopped in positive scroll coordinates (scroll properties are negative)
+   */
+  void ScrollingStopped( const Vector3& position );
+
+  /**
+   * Called upon pan gesture event.
    *
    * @param[in] gesture The gesture event.
    */
-  void OnGestureEx(Gesture::State state);
+  void OnPan(PanGesture pan);
 
   /**
    * Performs snapping while taking into account Velocity of gesture
@@ -857,20 +869,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:
 
@@ -911,6 +918,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.
 
@@ -918,14 +929,14 @@ private:
   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
 
-
   Vector2 mLastVelocity;                ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
   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)
 
@@ -965,7 +976,8 @@ private:
 
   Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
 
-  bool mInAccessibilityPan : 1;           ///< With AccessibilityPan its easier to move between snap positions
+  bool mPropertiesUpdated:1;              ///< Flag telling us when we can return local values to application or if we have to return the property
+  bool mInAccessibilityPan:1;             ///< With AccessibilityPan its easier to move between snap positions
   bool mInitialized:1;
   bool mScrolling:1;                      ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
   bool mScrollInterrupted:1;              ///< Flag set for when a down event interrupts a scroll
@@ -979,6 +991,8 @@ private:
   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