#include <dali/devel-api/actors/layer-devel.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/radian.h>
// Signals
+const char* const SIGNAL_TOUCHED = "touched";
const char* const SIGNAL_HOVERED = "hovered";
const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
const char* const SIGNAL_ON_SCENE = "onScene";
TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties );
+SignalConnectorType signalConnector1( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal );
SignalConnectorType signalConnector2( mType, SIGNAL_HOVERED, &Actor::DoConnectSignal );
SignalConnectorType signalConnector3( mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal );
SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal );
bool Actor::GetTouchRequired() const
{
- return !mTouchSignal.Empty() || mDerivedRequiresTouch;
+ return !mTouchedSignal.Empty() || !mTouchSignal.Empty() || mDerivedRequiresTouch;
}
bool Actor::GetHoverRequired() const
return mGestureData && mGestureData->IsGestureRequred( type );
}
-bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch )
+bool Actor::EmitTouchEventSignal( const TouchEvent& event, const Dali::TouchData& touch )
{
bool consumed = false;
consumed = mTouchSignal.Emit( handle, touch );
}
+ if( !mTouchedSignal.Empty() )
+ {
+ Dali::Actor handle( this );
+ consumed |= mTouchedSignal.Emit( handle, event );
+ }
+
+ if( !consumed )
+ {
+ // Notification for derived classes
+ consumed = OnTouchEvent( event ); // TODO
+ }
+
return consumed;
}
}
}
-Dali::Actor::TouchEventSignalType& Actor::TouchSignal()
+Dali::Actor::TouchSignalType& Actor::TouchedSignal()
+{
+ return mTouchedSignal;
+}
+
+Dali::Actor::TouchDataSignalType& Actor::TouchSignal()
{
return mTouchSignal;
}
bool connected( true );
Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_HOVERED ) )
+ if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
+ {
+ actor->TouchedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == signalName.compare( SIGNAL_HOVERED ) )
{
actor->HoveredSignal().Connect( tracker, functor );
}
mAnchorPoint( NULL ),
mRelayoutData( NULL ),
mGestureData( NULL ),
+ mTouchedSignal(),
mTouchSignal(),
mHoveredSignal(),
mWheelEventSignal(),
// A 0 width or height may also be required so if the resize policy has not been changed, i.e. is still set to DEFAULT,
// then change to FIXED as well
- if( size.width > 0.0f || GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DEFAULT )
+ if( size.width > 0.0f )
{
SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
}
- if( size.height > 0.0f || GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DEFAULT )
+ if( size.height > 0.0f )
{
SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
}