Image shapeImage,
unsigned int maximumNumberOfBubble,
const Vector2& bubbleSizeRange )
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
mShapeImage( shapeImage ),
mMovementArea( movementArea ),
mBubbleSizeRange( bubbleSizeRange ),
// 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>
} // 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 ),
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.
mState = ButtonDown;
break;
}
- case TouchPoint::Up:
+ case PointState::UP:
{
OnButtonUp(); // Notification for derived classes.
mState = ButtonUp;
break;
}
- case TouchPoint::Interrupted:
+ case PointState::INTERRUPTED:
{
OnTouchPointInterrupted(); // Notification for derived classes.
mState = ButtonUp;
break;
}
- case TouchPoint::Leave:
+ case PointState::LEAVE:
{
OnTouchPointLeave(); // Notification for derived classes.
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.
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.
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();
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.
*/
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).
}
Magnifier::Magnifier()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
mDefaultCameraDistance(1000.f),
mActorSize(Vector3::ZERO),
mMagnificationFactor(1.0f)
}
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 ),
#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>
}
Popup::Popup()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mTouchedOutsideSignal(),
mShowingSignal(),
mShownSignal(),
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 );
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 );
// 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;
}
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 )
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() );
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 )
/**
* 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.
/**
* 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()
}
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()),
#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>
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 );
}
}
-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
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();
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.
// 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.
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.
#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>
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,
return false;
}
-bool ScrollView::OnTouchEvent(const TouchEvent& event)
+bool ScrollView::OnTouch( Actor actor, const TouchData& touch )
{
if(!mSensitive)
{
}
// 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.
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" ) );
// 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 );
*/
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&)
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.
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();
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
// 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 ),
}
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 ),
#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>
}
Slider::Slider()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( NORMAL ),
mPopupVisual(""),
mPopupArrowVisual(""),
// 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 )
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 )
{
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;
}
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
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;
// 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;
}
* @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.
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;
// 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;
}
* @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.
#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>
{
mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
- SetupTouchEvents();
+ SetupGestures();
}
/**
return true;
}
- void SetupTouchEvents()
+ void SetupGestures()
{
mTapDetector = TapGestureDetector::New();
mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
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 );
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 );
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 );
}
}
- 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;
}
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;
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;