(Touch) Using new Touch API in all controls 90/78190/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jul 2016 12:01:13 +0000 (13:01 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jul 2016 12:06:48 +0000 (13:06 +0100)
Change-Id: I62f9007a40949401de48a325dbce9e0228271944

20 files changed:
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.h
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h
dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/text/decorator/text-decorator.cpp

index 5126408..ef7f8b7 100644 (file)
@@ -75,7 +75,7 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea,
                               Image shapeImage,
                               unsigned int maximumNumberOfBubble,
                               const Vector2& bubbleSizeRange )
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
   mShapeImage( shapeImage ),
   mMovementArea( movementArea ),
   mBubbleSizeRange( bubbleSizeRange ),
index 3af81bb..30e84a9 100644 (file)
@@ -20,7 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <cstring> // for strcmp
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
@@ -108,7 +108,7 @@ const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f );
 } // unnamed namespace
 
 Button::Button()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mAutoRepeatingTimer(),
   mUnselectedColor( Color::WHITE ), // The natural colors of the specified images will be used by default.
   mSelectedColor( Color::WHITE ),
@@ -942,15 +942,62 @@ bool Button::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tr
   return connected;
 }
 
-bool Button::OnTouchEvent(const TouchEvent& event)
+void Button::OnInitialize()
+{
+  Actor self = Self();
+
+  mTapDetector = TapGestureDetector::New();
+  mTapDetector.Attach( self );
+  mTapDetector.DetectedSignal().Connect(this, &Button::OnTap);
+
+  self.SetKeyboardFocusable( true );
+
+  self.TouchSignal().Connect( this, &Button::OnTouch );
+}
+
+bool Button::OnAccessibilityActivated()
+{
+  return OnKeyboardEnter();
+}
+
+bool Button::OnKeyboardEnter()
+{
+  // When the enter key is pressed, or button is activated, the click action is performed.
+  Property::Map attributes;
+  bool ret = DoClickAction( attributes );
+
+  return ret;
+}
+
+void Button::OnStageDisconnection()
+{
+  if( ButtonDown == mState )
+  {
+    if( !mTogglableButton )
+    {
+      Released();
+
+      if( mAutoRepeating )
+      {
+        mAutoRepeatingTimer.Reset();
+      }
+    }
+  }
+
+  mState = ButtonUp;
+
+  Control::OnStageDisconnection();
+}
+
+bool Button::OnTouch( Actor actor, const TouchData& touch )
 {
   // Only events are processed when the button is not disabled and the touch event has only
   // one touch point.
-  if( ( !mDisabled ) && ( 1 == event.GetPointCount() ) )
+  if( ( !mDisabled ) && ( 1 == touch.GetPointCount() ) )
   {
-    switch( event.GetPoint(0).state )
+    switch( touch.GetState( 0 ) )
     {
-      case TouchPoint::Down:
+      case PointState::DOWN:
       {
         OnButtonDown(); // Notification for derived classes.
 
@@ -958,7 +1005,7 @@ bool Button::OnTouchEvent(const TouchEvent& event)
         mState = ButtonDown;
         break;
       }
-      case TouchPoint::Up:
+      case PointState::UP:
       {
         OnButtonUp(); // Notification for derived classes.
 
@@ -966,7 +1013,7 @@ bool Button::OnTouchEvent(const TouchEvent& event)
         mState = ButtonUp;
         break;
       }
-      case TouchPoint::Interrupted:
+      case PointState::INTERRUPTED:
       {
         OnTouchPointInterrupted(); // Notification for derived classes.
 
@@ -974,7 +1021,7 @@ bool Button::OnTouchEvent(const TouchEvent& event)
         mState = ButtonUp;
         break;
       }
-      case TouchPoint::Leave:
+      case PointState::LEAVE:
       {
         OnTouchPointLeave(); // Notification for derived classes.
 
@@ -982,20 +1029,15 @@ bool Button::OnTouchEvent(const TouchEvent& event)
         mState = ButtonUp;
         break;
       }
-      case TouchPoint::Motion:
-      case TouchPoint::Stationary: // FALLTHROUGH
+      case PointState::MOTION:
+      case PointState::STATIONARY: // FALLTHROUGH
       {
         // Nothing to do
         break;
       }
-      default:
-      {
-        DALI_ASSERT_ALWAYS( !"Point status unhandled." );
-        break;
-      }
     }
   }
-  else if( 1 < event.GetPointCount() )
+  else if( 1 < touch.GetPointCount() )
   {
     OnTouchPointLeave(); // Notification for derived classes.
 
@@ -1006,51 +1048,6 @@ bool Button::OnTouchEvent(const TouchEvent& event)
   return false;
 }
 
-void Button::OnInitialize()
-{
-  Actor self = Self();
-
-  mTapDetector = TapGestureDetector::New();
-  mTapDetector.Attach( self );
-  mTapDetector.DetectedSignal().Connect(this, &Button::OnTap);
-
-  self.SetKeyboardFocusable( true );
-}
-
-bool Button::OnAccessibilityActivated()
-{
-  return OnKeyboardEnter();
-}
-
-bool Button::OnKeyboardEnter()
-{
-  // When the enter key is pressed, or button is activated, the click action is performed.
-  Property::Map attributes;
-  bool ret = DoClickAction( attributes );
-
-  return ret;
-}
-
-void Button::OnStageDisconnection()
-{
-  if( ButtonDown == mState )
-  {
-    if( !mTogglableButton )
-    {
-      Released();
-
-      if( mAutoRepeating )
-      {
-        mAutoRepeatingTimer.Reset();
-      }
-    }
-  }
-
-  mState = ButtonUp;
-
-  Control::OnStageDisconnection();
-}
-
 void Button::OnTap(Actor actor, const TapGesture& tap)
 {
   // Do nothing.
index 6f1e313..71a42fe 100644 (file)
@@ -376,26 +376,25 @@ private:
   virtual void OnDisabledBackgroundImageSet() {}
 
   /**
-   * This method is called from the OnTouchEvent method when the button is down.
+   * This method is called the button is down.
    * Could be reimplemented in subclasses to provide specific behaviour.
    */
   virtual void OnButtonDown();
 
   /**
-   * This method is called from the OnTouchEvent method when the button is up.
+   * This method is called when the button is up.
    * Could be reimplemented in subclasses to provide specific behaviour.
    */
   virtual void OnButtonUp();
 
   /**
-   * This method is called from the OnTouchEvent method when the touch point leaves the boundary of the button or
-   * more than one touch points are received.
+   * This method is called when touch leaves the boundary of the button or several touch points are received.
    * Could be reimplemented in subclasses to provide specific behaviour.
    */
   virtual void OnTouchPointLeave();
 
   /**
-   * This method is called from the OnTouchEvent method when the touch point is interrupted.
+   * This method is called when the touch is interrupted.
    * Could be reimplemented in subclasses to provide specific behaviour.
    */
   virtual void OnTouchPointInterrupted();
@@ -474,11 +473,6 @@ public:
 protected: // From Control
 
   /**
-   * @copydoc Dali::Control::OnTouchEvent( const TouchEvent& event )
-   */
-  virtual bool OnTouchEvent( const TouchEvent& event );
-
-  /**
    * @copydoc Toolkit::Control::OnInitialize()
    * @note If overridden by deriving button classes, then an up-call to Button::OnInitialize MUST be made at the start.
    */
@@ -503,6 +497,14 @@ protected: // From Control
 private:
 
   /**
+   * @brief Handler for touch data
+   * @param[in]  actor  The touched actor.
+   * @param[in]  touch  The touch info.
+   * @return true, if consumed, false otherwise.
+   */
+  bool OnTouch( Actor actor, const TouchData& touch );
+
+  /**
    * Handler for tap events.
    * We do not actually do anything when we receive a tap as the button handles tap event through
    * the touch event system itself as it requires more than just tap handling (e.g. leave events).
index af2fe10..5baf152 100644 (file)
@@ -139,7 +139,7 @@ Dali::Toolkit::Magnifier Magnifier::New()
 }
 
 Magnifier::Magnifier()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
   mDefaultCameraDistance(1000.f),
   mActorSize(Vector3::ZERO),
   mMagnificationFactor(1.0f)
index f066e4d..20c57c0 100644 (file)
@@ -349,7 +349,7 @@ void PageTurnView::Page::SetCurrentCenter( const Vector2& value )
 }
 
 PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize )
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
   mPageFactory( &pageFactory ),
   mPageSize( pageSize ),
   mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
index 935ac86..08fbe4e 100755 (executable)
@@ -27,7 +27,7 @@
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/scripting/scripting.h>
@@ -220,7 +220,7 @@ Dali::Toolkit::Popup Popup::New()
 }
 
 Popup::Popup()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mTouchedOutsideSignal(),
   mShowingSignal(),
   mShownSignal(),
@@ -318,7 +318,7 @@ void Popup::OnInitialize()
   mPopupLayout.SetFitHeight( 0 ); // Set row to fit.
   mPopupLayout.SetFitHeight( 1 ); // Set row to fit.
 
-  mPopupLayout.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
+  mPopupLayout.TouchSignal().Connect( this, &Popup::OnDialogTouched );
 
   mPopupContainer.Add( mPopupLayout );
 
@@ -578,7 +578,7 @@ void Popup::SetPopupBackgroundImage( Actor image )
   mPopupBackgroundImage.SetParentOrigin( ParentOrigin::CENTER );
 
   // OnDialogTouched only consumes the event. It prevents the touch event to be caught by the backing.
-  mPopupBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
+  mPopupBackgroundImage.TouchSignal().Connect( this, &Popup::OnDialogTouched );
 
   // Set the popup border to be slightly larger than the layout contents.
   mPopupBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
@@ -902,7 +902,7 @@ Toolkit::Control Popup::CreateBacking()
 
   // Default to being transparent.
   backing.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
-  backing.TouchedSignal().Connect( this, &Popup::OnBackingTouched );
+  backing.TouchSignal().Connect( this, &Popup::OnBackingTouched );
   backing.WheelEventSignal().Connect( this, &Popup::OnBackingWheelEvent );
   return backing;
 }
@@ -1454,7 +1454,7 @@ bool Popup::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra
   return connected;
 }
 
-bool Popup::OnBackingTouched( Actor actor, const TouchEvent& event )
+bool Popup::OnBackingTouched( Actor actor, const TouchData& touch )
 {
   // Allow events to pass through if touch transparency is enabled.
   if( mTouchTransparent )
@@ -1462,11 +1462,9 @@ bool Popup::OnBackingTouched( Actor actor, const TouchEvent& event )
     return false;
   }
 
-  if( event.GetPointCount() > 0 )
+  if( touch.GetPointCount() > 0 )
   {
-    const TouchPoint& point = event.GetPoint( 0 );
-
-    if( point.state == TouchPoint::Down )
+    if( touch.GetState( 0 ) == PointState::DOWN )
     {
       // Guard against destruction during signal emission.
       Toolkit::Popup handle( GetOwner() );
@@ -1493,7 +1491,7 @@ bool Popup::OnBackingWheelEvent( Actor actor, const WheelEvent& event )
   return true;
 }
 
-bool Popup::OnDialogTouched(Actor actor, const TouchEvent& event)
+bool Popup::OnDialogTouched( Actor actor, const TouchData& touch )
 {
   // Allow events to pass through if touch transparency is enabled.
   if( mTouchTransparent )
index 91d68b7..cc5a2f6 100755 (executable)
@@ -396,10 +396,10 @@ private:
   /**
    * Signal occurs when the dimmed backing for the Popup is touched.
    * @param[in] actor The Actor Touched
-   * @param[in] event The Touch Event.
+   * @param[in] touch The Touch Data.
    * @return Whether to consume event or not.
    */
-  bool OnBackingTouched(Actor actor, const TouchEvent& event);
+  bool OnBackingTouched(Actor actor, const TouchData& touch);
 
   /**
    * Signal occurs when a mouse wheel event occurs on the dimmed backing.
@@ -412,10 +412,10 @@ private:
   /**
    * Signal occurs when the dialog has been touched.
    * @param[in] actor The Actor Touched
-   * @param[in] event The Touch Event.
+   * @param[in] touch The Touch Data.
    * @return Whether to consume event or not.
    */
-  bool OnDialogTouched(Actor actor, const TouchEvent& event);
+  bool OnDialogTouched( Actor actor, const TouchData& touch );
 
   /**
    * @copydoc Toolkit::Control::OnInitialize()
index f10dfb5..97e2680 100755 (executable)
@@ -175,7 +175,7 @@ const char* INDICATOR_HEIGHT_POLICY_NAME[] = {"Variable", "Fixed"};
 }
 
 ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction)
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mIndicatorShowAlpha(1.0f),
   mDirection(direction),
   mScrollableObject(WeakHandleBase()),
index 2f13c17..741b057 100644 (file)
@@ -26,7 +26,7 @@
 #include <dali/devel-api/common/set-wrapper.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/wheel-event.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 
@@ -328,6 +328,7 @@ void ItemView::OnInitialize()
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
 
+  self.TouchSignal().Connect( this, &ItemView::OnTouch );
   EnableGestureDetection(Gesture::Type(Gesture::Pan));
 
   mWheelEventFinishedTimer = Timer::New( WHEEL_EVENT_FINISHED_TIME_OUT );
@@ -980,37 +981,6 @@ void ItemView::OnChildAdd(Actor& child)
   }
 }
 
-bool ItemView::OnTouchEvent(const TouchEvent& event)
-{
-  // Ignore events with multiple-touch points
-  if (event.GetPointCount() != 1)
-  {
-    return false;
-  }
-
-  if (event.GetPoint(0).state == TouchPoint::Down)
-  {
-    // Cancel ongoing scrolling etc.
-    mGestureState = Gesture::Clear;
-
-    mScrollDistance = 0.0f;
-    mScrollSpeed = 0.0f;
-    Self().SetProperty(Toolkit::ItemView::Property::SCROLL_SPEED, mScrollSpeed);
-
-    mScrollOvershoot = 0.0f;
-    AnimateScrollOvershoot(0.0f);
-
-    if(mScrollAnimation)
-    {
-      mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
-    }
-
-    RemoveAnimation(mScrollAnimation);
-  }
-
-  return true; // consume since we're potentially scrolling
-}
-
 bool ItemView::OnWheelEvent(const WheelEvent& event)
 {
   // Respond the wheel event to scroll
@@ -1103,6 +1073,37 @@ float ItemView::ClampFirstItemPosition( float targetPosition, const Vector3& tar
   return clamppedPosition;
 }
 
+bool ItemView::OnTouch( Actor actor, const TouchData& touch )
+{
+  // Ignore events with multiple-touch points
+  if (touch.GetPointCount() != 1)
+  {
+    return false;
+  }
+
+  if ( touch.GetState( 0 ) == PointState::DOWN )
+  {
+    // Cancel ongoing scrolling etc.
+    mGestureState = Gesture::Clear;
+
+    mScrollDistance = 0.0f;
+    mScrollSpeed = 0.0f;
+    Self().SetProperty(Toolkit::ItemView::Property::SCROLL_SPEED, mScrollSpeed);
+
+    mScrollOvershoot = 0.0f;
+    AnimateScrollOvershoot(0.0f);
+
+    if(mScrollAnimation)
+    {
+      mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
+    }
+
+    RemoveAnimation(mScrollAnimation);
+  }
+
+  return true; // consume since we're potentially scrolling
+}
+
 void ItemView::OnPan( const PanGesture& gesture )
 {
   Actor self = Self();
index 3d31e1c..d8bbcac 100644 (file)
@@ -392,13 +392,6 @@ private: // From CustomActorImpl
   virtual void OnChildAdd(Actor& child);
 
   /**
-   * From CustomActorImpl; called after a touch-signal is received by the owning actor.
-   * @param[in] event The touch event.
-   * @return True if the event should be consumed.
-   */
-  virtual bool OnTouchEvent(const TouchEvent& event);
-
-  /**
    * From CustomActorImpl; called after a wheel-event is received by the owning actor.
    * @param[in] event The wheel event.
    * @return True if the event should be consumed.
@@ -484,14 +477,6 @@ private:
   // Input Handling
 
   /**
-   * Helper to handle pressed (Down) events.
-   * @param[in] x The X coordinate of the touch event.
-   * @param[in] y The Y coordinate of the touch event.
-   * @param[in] timeMs The time-stamp of the touch event.
-   */
-  void OnPressed(float x, float y, unsigned long timeMs);
-
-  /**
    * Helper to clamp the first-item position when dragging/swiping.
    * @param[in] targetPosition The target position of the drag etc.
    * @param[in] targetSize The target ItemView & layout size.
@@ -502,6 +487,14 @@ private:
   float ClampFirstItemPosition(float targetPosition, const Vector3& targetSize, ItemLayout& layout, bool updateOvershoot = true);
 
   /**
+   * Called after a touch-signal is received by the owning actor.
+   * @param[in] actor The touched actor.
+   * @param[in] touch The touch information.
+   * @return True if the event should be consumed.
+   */
+  bool OnTouch( Actor actor, const TouchData& touch );
+
+  /**
    * Called upon pan gesture event.
    *
    * @param[in] gesture The gesture event.
index 4cc2393..690704d 100644 (file)
@@ -23,7 +23,7 @@
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/wheel-event.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/integration-api/debug.h>
@@ -683,6 +683,7 @@ void ScrollView::OnInitialize()
 
   mGestureStackDepth = 0;
 
+  self.TouchSignal().Connect( this, &ScrollView::OnTouch );
   EnableGestureDetection( Gesture::Type( Gesture::Pan ) );
 
   // By default we'll allow the user to freely drag the scroll view,
@@ -2043,7 +2044,7 @@ bool ScrollView::OnTouchDownTimeout()
   return false;
 }
 
-bool ScrollView::OnTouchEvent(const TouchEvent& event)
+bool ScrollView::OnTouch( Actor actor, const TouchData& touch )
 {
   if(!mSensitive)
   {
@@ -2054,21 +2055,21 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event)
   }
 
   // Ignore events with multiple-touch points
-  if (event.GetPointCount() != 1)
+  if (touch.GetPointCount() != 1)
   {
     DALI_LOG_SCROLL_STATE("[0x%X], multiple touch, ignoring", this);
 
     return false;
   }
 
-  const TouchPoint::State pointState = event.GetPoint(0).state;
-  if( pointState == TouchPoint::Down )
+  const PointState::Type pointState = touch.GetState( 0 );
+  if( pointState == PointState::DOWN )
   {
     DALI_LOG_SCROLL_STATE("[0x%X] Down", this);
 
     if(mGestureStackDepth==0)
     {
-      mTouchDownTime = event.time;
+      mTouchDownTime = touch.GetTime();
 
       // This allows time for a pan-gesture to start, to avoid breaking snap-animation behavior with fast flicks.
       // If touch-down does not become a pan (after timeout interval), then snap-animation can be interrupted.
@@ -2077,8 +2078,8 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event)
       StartTouchDownTimer();
     }
   }
-  else if( ( pointState == TouchPoint::Up ) ||
-           ( ( pointState == TouchPoint::Interrupted ) && ( event.GetPoint(0).hitActor == Self() ) ) )
+  else if( ( pointState == PointState::UP ) ||
+           ( ( pointState == PointState::INTERRUPTED ) && ( touch.GetHitActor( 0 )== Self() ) ) )
   {
     DALI_LOG_SCROLL_STATE("[0x%X] %s", this, ( ( pointState == TouchPoint::Up ) ? "Up" : "Interrupted" ) );
 
@@ -2089,8 +2090,8 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event)
     // otherwise our scroll could be stopped (interrupted) half way through an animation.
     if(mGestureStackDepth==0 && mTouchDownTimeoutReached)
     {
-      if( ( event.GetPoint(0).state == TouchPoint::Interrupted ) ||
-          ( ( event.time - mTouchDownTime ) >= MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET ) )
+      if( ( pointState == PointState::INTERRUPTED ) ||
+          ( ( touch.GetTime() - mTouchDownTime ) >= MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET ) )
       {
         // Reset the velocity only if down was received a while ago
         mLastVelocity = Vector2( 0.0f, 0.0f );
index b9db77d..63df8dc 100644 (file)
@@ -539,7 +539,7 @@ public: //Signals
    */
   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
 
-private: // private overriden functions from CustomActorImpl and Controls
+private: // private overridden functions from CustomActorImpl and Controls
 
   /**
    * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
@@ -564,16 +564,6 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual void OnChildRemove(Actor& child);
 
   /**
-   * From CustomActorImpl; called after a touchSignal is received by the owning actor.
-   *
-   * We don't listen to these events as content within the contain may consume events.
-   *
-   * @param[in] event The touch event.
-   * @return True if the event should be consumed.
-   */
-  virtual bool OnTouchEvent(const TouchEvent& event);
-
-  /**
    * From CustomActorImpl; called after a wheelEvent is received by the owning actor.
    * @param[in] event The wheel event.
    * @return True if the event should be consumed.
@@ -608,6 +598,17 @@ private: // private overriden functions from CustomActorImpl and Controls
 private:
 
   /**
+   * Called after a touchSignal is received by the owning actor.
+   *
+   * We don't consume these events as content within the container may consume events.
+   *
+   * @param[in] actor The touched actor.
+   * @param[in] touch The touch information.
+   * @return True if the event should be consumed.
+   */
+  bool OnTouch( Actor actor, const TouchData& touch );
+
+  /**
    * Start a timer which calls OnTouchDownTimeout()
    */
   void StartTouchDownTimer();
@@ -894,7 +895,7 @@ private:
   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 mTouchDownTimer;                ///< Used to interrupt snap-animation. This cannot be done in OnTouch without breaking fast flick behavior.
 
   float mScrollUpdateDistance;          ///< Distance for scrolling to travel for the scroll update notifications
   Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
index e33c920..2bec6b6 100644 (file)
@@ -81,7 +81,7 @@ const Vector2 OVERSHOOT_DEFAULT_SIZE( 720.0f, 42.0f );
 // Scrollable controls are not layout containers so they dont need size negotiation..
 // we dont want size negotiation while scrolling if we can avoid it
 Scrollable::Scrollable()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ),
   mOvershootEffectColor(  DEFAULT_OVERSHOOT_COLOUR ),
   mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
   mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
@@ -91,7 +91,7 @@ Scrollable::Scrollable()
 }
 
 Scrollable::Scrollable( ControlBehaviour behaviourFlags )
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | behaviourFlags ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS | behaviourFlags ) ),
   mOvershootEffectColor(  DEFAULT_OVERSHOOT_COLOUR ),
   mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
   mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
index 9c9965c..915db02 100755 (executable)
@@ -22,7 +22,7 @@
 #include <cstring> // for strcmp
 #include <sstream>
 #include <limits>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/images/resource-image.h>
@@ -135,7 +135,7 @@ Dali::Toolkit::Slider Slider::New()
 }
 
 Slider::Slider()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mState( NORMAL ),
   mPopupVisual(""),
   mPopupArrowVisual(""),
@@ -201,6 +201,9 @@ void Slider::OnInitialize()
 
   // Size the Slider actor to a default
   self.SetSize( DEFAULT_HIT_REGION.x, DEFAULT_HIT_REGION.y );
+
+  // Connect to the touch signal
+  self.TouchSignal().Connect( this, &Slider::OnTouch );
 }
 
 void Slider::OnSizeSet( const Vector3& size )
@@ -210,22 +213,22 @@ void Slider::OnSizeSet( const Vector3& size )
   SetTrackRegion( Vector2( size.x - GetHandleSize().x, GetTrackRegion().y ) );
 }
 
-bool Slider::OnTouchEvent(Actor actor, const TouchEvent& event)
+bool Slider::OnTouch(Actor actor, const TouchData& touch)
 {
   if( mState != DISABLED )
   {
-    TouchPoint::State touchState = event.GetPoint(0).state;
+    const PointState::Type touchState = touch.GetState(0);
 
-    if( touchState == TouchPoint::Down )
+    if( touchState == PointState::DOWN )
     {
       mState = PRESSED;
 
-      float percentage = MapPercentage( event.GetPoint(0).local );
+      float percentage = MapPercentage( touch.GetLocalPosition( 0 ) );
       float value = MapBounds( ( GetSnapToMarks() ) ? SnapToMark( percentage ) : MarkFilter( percentage ), GetLowerBound(), GetUpperBound() );
       SetValue( value );
       DisplayPopup( value );
     }
-    else if( touchState == TouchPoint::Up)
+    else if( touchState == PointState::UP )
     {
       if( mState == PRESSED )
       {
@@ -372,7 +375,7 @@ Actor Slider::CreateHitRegion()
   Actor hitRegion = Actor::New();
   hitRegion.SetParentOrigin( ParentOrigin::CENTER );
   hitRegion.SetAnchorPoint( AnchorPoint::CENTER );
-  hitRegion.TouchedSignal().Connect( this, &Slider::OnTouchEvent );
+  hitRegion.TouchSignal().Connect( this, &Slider::OnTouch );
 
   return hitRegion;
 }
index acc7494..f2c81b2 100755 (executable)
@@ -324,13 +324,13 @@ private:
   virtual void OnInitialize();
 
   /**
-   * Hit region touch event
+   * Hit region touch
    *
    * @param[in] actor The actor the event is raised for
-   * @param[in] event The touch event info
-   * @return If the event is handled or not
+   * @param[in] touch The touch info
+   * @return If touch is handled or not
    */
-  bool OnTouchEvent( Actor actor, const TouchEvent& event );
+  bool OnTouch( Actor actor, const TouchData& touch );
 
   /**
    * Pan gesture event
index 2fbd6d0..be5f541 100644 (file)
@@ -936,7 +936,7 @@ void TextEditor::OnInitialize()
   EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
   GetTapGestureDetector().SetMaximumTapsRequired( 2 );
 
-  self.TouchedSignal().Connect( this, &TextEditor::OnTouched );
+  self.TouchSignal().Connect( this, &TextEditor::OnTouched );
 
   // Set BoundingBox to stage size if not already set.
   Rect<int> boundingBox;
@@ -1313,7 +1313,7 @@ void TextEditor::OnStageConnection( int depth )
   // The depth of the text renderer is set in the RenderText() called from OnRelayout().
 }
 
-bool TextEditor::OnTouched( Actor actor, const TouchEvent& event )
+bool TextEditor::OnTouched( Actor actor, const TouchData& touch )
 {
   return true;
 }
index f00d66d..118f557 100644 (file)
@@ -211,9 +211,9 @@ private: // Implementation
    * @brief Callback when TextEditor is touched
    *
    * @param[in] actor TextEditor touched
-   * @param[in] event TouchEvent information
+   * @param[in] touch Touch information
    */
-  bool OnTouched( Actor actor, const TouchEvent& event );
+  bool OnTouched( Actor actor, const TouchData& touch );
 
   /**
    * Construct a new TextEditor.
index b5f4858..4abf4c3 100644 (file)
@@ -1120,7 +1120,7 @@ void TextField::OnInitialize()
   EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
   GetTapGestureDetector().SetMaximumTapsRequired( 2 );
 
-  self.TouchedSignal().Connect( this, &TextField::OnTouched );
+  self.TouchSignal().Connect( this, &TextField::OnTouched );
 
   // Set BoundingBox to stage size if not already set.
   Rect<int> boundingBox;
@@ -1499,7 +1499,7 @@ void TextField::OnStageConnection( int depth )
   // The depth of the text renderer is set in the RenderText() called from OnRelayout().
 }
 
-bool TextField::OnTouched( Actor actor, const TouchEvent& event )
+bool TextField::OnTouched( Actor actor, const TouchData& touch )
 {
   return true;
 }
index 91d757b..bd02762 100644 (file)
@@ -216,9 +216,9 @@ private: // Implementation
    * @brief Callback when TextField is touched
    *
    * @param[in] actor TextField touched
-   * @param[in] event TouchEvent information
+   * @param[in] touch Touch information
    */
-  bool OnTouched( Actor actor, const TouchEvent& event );
+  bool OnTouched( Actor actor, const TouchData& touch );
 
   /**
    * Construct a new TextField.
index ff03ac9..74fc924 100644 (file)
@@ -24,7 +24,7 @@
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/property-notification.h>
@@ -284,7 +284,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-    SetupTouchEvents();
+    SetupGestures();
   }
 
   /**
@@ -621,7 +621,7 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  void SetupTouchEvents()
+  void SetupGestures()
   {
     mTapDetector = TapGestureDetector::New();
     mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
@@ -694,7 +694,7 @@ struct Decorator::Impl : public ConnectionTracker
         grabHandle.actor.Add( grabHandle.grabArea );
         grabHandle.actor.SetColor( mHandleColor );
 
-        grabHandle.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
+        grabHandle.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
         mTapDetector.Attach( grabHandle.grabArea );
         mPanGestureDetector.Attach( grabHandle.grabArea );
 
@@ -757,7 +757,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         mTapDetector.Attach( primary.grabArea );
         mPanGestureDetector.Attach( primary.grabArea );
-        primary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
+        primary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
 
         primary.actor.Add( primary.grabArea );
 
@@ -794,7 +794,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         mTapDetector.Attach( secondary.grabArea );
         mPanGestureDetector.Attach( secondary.grabArea );
-        secondary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
+        secondary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
 
         secondary.actor.Add( secondary.grabArea );
 
@@ -1179,20 +1179,20 @@ struct Decorator::Impl : public ConnectionTracker
     }
   }
 
-  bool OnGrabHandleTouched( Actor actor, const TouchEvent& event )
+  bool OnGrabHandleTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release grab-handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[GRAB_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[GRAB_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[GRAB_HANDLE].pressed = false;
       }
@@ -1204,20 +1204,20 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  bool OnHandleOneTouched( Actor actor, const TouchEvent& event )
+  bool OnHandleOneTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release selection handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[LEFT_SELECTION_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[LEFT_SELECTION_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[LEFT_SELECTION_HANDLE].pressed = false;
         mHandlePreviousCrossed = mHandleCurrentCrossed;
@@ -1231,20 +1231,20 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  bool OnHandleTwoTouched( Actor actor, const TouchEvent& event )
+  bool OnHandleTwoTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release selection handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[RIGHT_SELECTION_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[RIGHT_SELECTION_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[RIGHT_SELECTION_HANDLE].pressed = false;
         mHandlePreviousCrossed = mHandleCurrentCrossed;