Improve fast scrolling performance in ItemView
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scroll-bar / scroll-bar-impl.h
index 1da0474..909e4fe 100755 (executable)
@@ -18,7 +18,7 @@
 //
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
 #include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
 
@@ -39,7 +39,7 @@ typedef IntrusivePtr<ScrollBar> ScrollBarPtr;
  * ScrollBar is a UI component that can be added to the scrollable controls
  * indicating the current scroll position of the scrollable content.
  */
-class ScrollBar : public ControlImpl
+class ScrollBar : public ScrollComponentImpl
 {
 
 public:
@@ -64,9 +64,9 @@ public:
   static Toolkit::ScrollBar New();
 
   /**
-   * @copydoc Toolkit::ScrollBar::SetScrollConnector()
+   * @copydoc Toolkit::ScrollComponentImpl::OnScrollConnectorSet()
    */
-  void SetScrollConnector( Toolkit::ScrollConnector connector );
+  void OnScrollConnectorSet( Toolkit::ScrollConnector connector );
 
   /**
    * @copydoc Toolkit::ScrollBar::SetBackgroundImage()
@@ -141,18 +141,28 @@ private:
    */
   void OnScrollPositionNotified(PropertyNotification& source);
 
+  /**
+   * Process the pan gesture per predefined timeout until the gesture is finished.
+   * @return True if the timer should be kept running.
+   */
+  bool OnPanGestureProcessTick();
+
 private:
 
-  Toolkit::ScrollConnector mScrollConnector;              ///< Connects scroll bar with the scrollable container.
   Constrainable mScrollPositionObject;                    ///< From mScrollConnector
 
   ImageActor mBackground;                                 ///< Background image of scroll bar.
   ImageActor mIndicator;                                  ///< Image of scroll indicator.
   Animation mAnimation;                                   ///< Scroll indicator Show/Hide Animation.
 
-  float mScrollStart;                                     ///< Scroll Start position (start of drag)
+  float mScrollStart;                                    ///< Scroll Start position (start of drag)
   Vector3 mGestureDisplacement;                           ///< Gesture Displacement.
 
+  bool mIsPanning;                                       ///< Whether the scroll bar is being panned.
+  float mCurrentScrollPosition;                          ///< The current scroll position updated by the pan gesture
+
+  Timer mTimer;                                           ///< The timer to process the pan gesture after the gesture is started.
+
   Property::Index mPropertyIndicatorPosition;             ///< Indicatore Position ("indicator-position")
 
   PropertyNotification mPositionNotification;             ///< Stores the property notification used for scroll position changes