Use Control's own PanGestureDetector in ScrollBar 18/43818/2
authorRichard Huang <r.huang@samsung.com>
Tue, 14 Jul 2015 09:39:33 +0000 (10:39 +0100)
committerRichard Huang <r.huang@samsung.com>
Tue, 14 Jul 2015 09:40:37 +0000 (10:40 +0100)
Change-Id: I65c5fa40a64004358af8850cc1c4148cad91237b

dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h

index a1bdedf..350ace5 100755 (executable)
@@ -220,14 +220,11 @@ void ScrollBar::SetScrollIndicator( Actor indicator )
     mIndicator = indicator;
     Self().Add(mIndicator);
 
     mIndicator = indicator;
     Self().Add(mIndicator);
 
-    if( !mPanGestureDetector )
-    {
-      mPanGestureDetector = PanGestureDetector::New();
-      mPanGestureDetector.DetectedSignal().Connect(this, &ScrollBar::OnPan);
-    }
+    EnableGestureDetection(Gesture::Type(Gesture::Pan));
 
 
-    mPanGestureDetector.DetachAll();
-    mPanGestureDetector.Attach( mIndicator );
+    PanGestureDetector detector( GetPanGestureDetector() );
+    detector.DetachAll();
+    detector.Attach( mIndicator );
 
     unsigned int childCount = mIndicator.GetChildCount();
     for ( unsigned int index = 0; index < childCount; index++ )
 
     unsigned int childCount = mIndicator.GetChildCount();
     for ( unsigned int index = 0; index < childCount; index++ )
@@ -235,7 +232,7 @@ void ScrollBar::SetScrollIndicator( Actor indicator )
       Actor child = mIndicator.GetChildAt( index );
       if ( child )
       {
       Actor child = mIndicator.GetChildAt( index );
       if ( child )
       {
-        mPanGestureDetector.Attach( child );
+        detector.Attach( child );
       }
     }
   }
       }
     }
   }
@@ -370,7 +367,7 @@ bool ScrollBar::OnPanGestureProcessTick()
   return true;
 }
 
   return true;
 }
 
-void ScrollBar::OnPan( Actor source, const PanGesture& gesture )
+void ScrollBar::OnPan( const PanGesture& gesture )
 {
   if(mScrollableObject)
   {
 {
   if(mScrollableObject)
   {
index f5321a4..8a8177d 100755 (executable)
@@ -201,6 +201,11 @@ private: // from Control
   virtual void OnInitialize();
 
   /**
   virtual void OnInitialize();
 
   /**
+   * @copydoc Toolkit::Control::OnPan
+   */
+  virtual void OnPan( const PanGesture& gesture );
+
+  /**
    * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
    */
   virtual void OnSizeSet( const Vector3& size );
    * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
    */
   virtual void OnSizeSet( const Vector3& size );
@@ -243,14 +248,6 @@ private:
    */
   void OnIndicatorHeightPolicyPropertySet(Property::Value propertyValue);
 
    */
   void OnIndicatorHeightPolicyPropertySet(Property::Value propertyValue);
 
-  /**
-   * Pan gesture callback
-   *
-   * @param[in] actor The actor the event is raised for
-   * @param[in] gesture The pan event info
-   */
-  void OnPan(Actor source, const PanGesture& gesture);
-
 private:
 
   /**
 private:
 
   /**
@@ -290,8 +287,6 @@ private:
   Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy;  ///< The height policy of scroll indicator (variable or fixed)
   float mIndicatorFixedHeight;                                      ///< The fixed height of scroll indicator
 
   Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy;  ///< The height policy of scroll indicator (variable or fixed)
   float mIndicatorFixedHeight;                                      ///< The fixed height of scroll indicator
 
-  PanGestureDetector mPanGestureDetector;                            ///< The pan gesture detector for scroll indicator
-
   Timer mContractDelayTimer;                                         ///< Timer guarantee contract delay time.
   Timer mPanProcessTimer;                                            ///< The timer to process the pan gesture after the gesture is started.
 
   Timer mContractDelayTimer;                                         ///< Timer guarantee contract delay time.
   Timer mPanProcessTimer;                                            ///< The timer to process the pan gesture after the gesture is started.