#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;
}