Add all basic event handling for multiple windows.
Event gestures are partially supported for now.
Change-Id: I2c2d81b0e0eb25c0d8619afd94b5aa8784b0db8a
#include <stdlib.h>
#include <dali/integration-api/scene.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/public-api/events/key-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
+
#include <dali-test-suite-utils.h>
// Internal headers are allowed here
+namespace
+{
+
+const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
+
+// Functor for EventProcessingFinished signal
+struct EventProcessingFinishedFunctor
+{
+ /**
+ * @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called.
+ */
+ EventProcessingFinishedFunctor( bool& eventProcessingFinished )
+ : mEventProcessingFinished( eventProcessingFinished )
+ {}
+
+ void operator()()
+ {
+ mEventProcessingFinished = true;
+ }
+
+ bool& mEventProcessingFinished;
+};
+
+// Stores data that is populated in the key-event callback and will be read by the TET cases
+struct KeyEventSignalData
+{
+ KeyEventSignalData()
+ : functorCalled(false)
+ {}
+
+ void Reset()
+ {
+ functorCalled = false;
+
+ receivedKeyEvent.keyModifier = 0;
+ receivedKeyEvent.keyPressedName.clear();
+ receivedKeyEvent.keyPressed.clear();
+ }
+
+ bool functorCalled;
+ KeyEvent receivedKeyEvent;
+};
+
+// Functor that sets the data when called
+struct KeyEventReceivedFunctor
+{
+ KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { }
+
+ bool operator()( const KeyEvent& keyEvent )
+ {
+ signalData.functorCalled = true;
+ signalData.receivedKeyEvent = keyEvent;
+
+ return true;
+ }
+
+ KeyEventSignalData& signalData;
+};
+
+// Stores data that is populated in the touched signal callback and will be read by the TET cases
+struct TouchedSignalData
+{
+ TouchedSignalData()
+ : functorCalled(false)
+ {}
+
+ void Reset()
+ {
+ functorCalled = false;
+
+ receivedTouchEvent.points.clear();
+ receivedTouchEvent.time = 0;
+
+ receivedTouchData.Reset();
+ }
+
+ bool functorCalled;
+ TouchEvent receivedTouchEvent;
+ TouchData receivedTouchData;
+};
+
+// Functor that sets the data when touched signal is received
+struct TouchedFunctor
+{
+ TouchedFunctor( TouchedSignalData& data ) : signalData( data ) { }
+
+ void operator()( const TouchEvent& touch )
+ {
+ signalData.functorCalled = true;
+ signalData.receivedTouchEvent = touch;
+ }
+
+ TouchedSignalData& signalData;
+};
+
+// Functor that sets the data when touched signal is received
+struct TouchFunctor
+{
+ TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
+
+ void operator()( const TouchData& touch )
+ {
+ signalData.functorCalled = true;
+ signalData.receivedTouchData = touch;
+ }
+
+ void operator()()
+ {
+ signalData.functorCalled = true;
+ }
+
+ TouchedSignalData& signalData;
+};
+
+// Stores data that is populated in the wheel-event callback and will be read by the TET cases
+struct WheelEventSignalData
+{
+ WheelEventSignalData()
+ : functorCalled(false)
+ {}
+
+ void Reset()
+ {
+ functorCalled = false;
+ }
+
+ bool functorCalled;
+ WheelEvent receivedWheelEvent;
+};
+
+// Functor that sets the data when wheel-event signal is received
+struct WheelEventReceivedFunctor
+{
+ WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { }
+
+ bool operator()( const WheelEvent& wheelEvent )
+ {
+ signalData.functorCalled = true;
+ signalData.receivedWheelEvent = wheelEvent;
+
+ return true;
+ }
+
+ WheelEventSignalData& signalData;
+};
+
+void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition )
+{
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+}
+
+bool DummyTouchCallback( Actor actor, const TouchEvent& touch )
+{
+ return true;
+}
+
+} // unnamed namespace
+
int UtcDaliSceneAdd(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliSceneEventProcessingFinishedP(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor( eventProcessingFinished );
+ scene.EventProcessingFinishedSignal().Connect( &application, functor );
+
+ Actor actor( Actor::New() );
+ scene.Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( eventProcessingFinished );
+
+ END_TEST;
+}
+
+int UtcDaliSceneEventProcessingFinishedN(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor( eventProcessingFinished );
+ scene.EventProcessingFinishedSignal().Connect( &application, functor );
+
+ Actor actor( Actor::New() );
+ scene.Add( actor );
+
+ // Do not complete event processing and confirm the signal has not been emitted.
+ DALI_TEST_CHECK( !eventProcessingFinished );
+
+ END_TEST;
+}
+
+int UtcDaliSceneSignalKeyEventP(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor( data );
+ scene.KeyEventSignal().Connect( &application, functor );
+
+ Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Down, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.keyModifier );
+ DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
+
+ data.Reset();
+
+ Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+ application.ProcessEvent( event2 );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.keyModifier );
+ DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
+
+ data.Reset();
+
+ Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+ application.ProcessEvent( event3 );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.keyModifier );
+ DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
+
+ data.Reset();
+
+ Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+ application.ProcessEvent( event4 );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.keyModifier );
+ DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
+ END_TEST;
+}
+
+int UtcDaliSceneSignalKeyEventN(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor( data );
+ scene.KeyEventSignal().Connect( &application, functor );
+
+ // Check that a non-pressed key events data is not modified.
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliSceneTouchSignalP(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ TouchedSignalData data;
+ TouchFunctor functor( data );
+ scene.TouchSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Basic test: No actors, single touch (down then up).
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+
+ GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+ }
+
+ // Add an actor to the scene.
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
+ scene.Add( actor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Actor on scene, single touch, down in actor, motion, then up outside actor.
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
+ data.Reset();
+
+ GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+ }
+
+ // Multiple touch. Should only receive a touch on first down and last up.
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+
+ // 1st point
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+ data.Reset();
+
+ // 2nd point
+ touchEvent.points[0].SetState( PointState::STATIONARY );
+ point.SetDeviceId( 1 );
+ point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Primary point is up
+ touchEvent.points[0].SetState( PointState::UP );
+ touchEvent.points[1].SetState( PointState::STATIONARY );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Remove 1st point now, 2nd point is now in motion
+ touchEvent.points.erase( touchEvent.points.begin() );
+ touchEvent.points[0].SetState( PointState::MOTION );
+ touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Final point Up
+ touchEvent.points[0].SetState( PointState::UP );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+ data.Reset();
+ }
+ END_TEST;
+}
+
+int UtcDaliSceneTouchSignalN(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ TouchedSignalData data;
+ TouchFunctor functor( data );
+ scene.TouchSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Confirm functor not called before there has been any touch event.
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ // No actors, single touch, down, motion then up.
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
+
+ data.Reset();
+
+ // Confirm there is no signal when the touchpoint is only moved.
+ GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Confirm a following up event generates a signal.
+ GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
+ data.Reset();
+ }
+
+ // Add an actor to the scene.
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
+ scene.Add( actor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Actor on scene. Interrupted before down and interrupted after down.
+ {
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
+ data.Reset();
+
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::DOWN );
+ data.Reset();
+
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
+
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+
+ // Check that getting info about a non-existent point returns an empty handle
+ Actor actor = data.receivedTouchData.GetHitActor( 1 );
+ DALI_TEST_CHECK( !actor );
+
+ data.Reset();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliSceneSignalWheelEventP(void)
+{
+ TestApplication application;
+ Dali::Integration::Scene scene = application.GetScene();
+
+ WheelEventSignalData data;
+ WheelEventReceivedFunctor functor( data );
+ scene.WheelEventSignal().Connect( &application, functor );
+
+ Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
+ DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
+ DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
+ DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
+ DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
+ DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );
+
+ data.Reset();
+
+ Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
+ application.ProcessEvent( event2 );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
+ DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
+ DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
+ DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
+ DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
+ DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );
+ END_TEST;
+}
+
// INTERNAL INCLUDES
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
{
- return Internal::HitTestAlgorithm::HitTest( GetImplementation(stage), screenCoordinates, results, func );
+ Internal::Stage& stageImpl = GetImplementation( stage );
+ return Internal::HitTestAlgorithm::HitTest( stageImpl.GetSize(), stageImpl.GetRenderTaskList(), stageImpl.GetLayerList(), screenCoordinates, results, func );
}
} // namespace HitTestAlgorithm
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/common/stage.h>
+#include <dali/integration-api/scene.h>
namespace Dali
namespace Integration
{
-Scene Scene::New( Size size )
+Scene Scene::New( const Size& size )
{
Internal::ScenePtr internal = Internal::Scene::New( size );
- return Scene(internal.Get());
+ return Scene( internal.Get() );
}
Scene Scene::DownCast( BaseHandle handle )
GetImplementation(*this).SetSurface( surface );
}
+Integration::RenderSurface* Scene::GetSurface() const
+{
+ return GetImplementation(*this).GetSurface();
+}
+
+void Scene::QueueEvent( const Integration::Event& event )
+{
+ GetImplementation(*this).QueueEvent( event );
+}
+
+void Scene::ProcessEvents()
+{
+ GetImplementation(*this).ProcessEvents();
+}
+
+Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
+{
+ return GetImplementation(*this).EventProcessingFinishedSignal();
+}
+
+Scene::KeyEventSignalType& Scene::KeyEventSignal()
+{
+ return GetImplementation(*this).KeyEventSignal();
+}
+
+Scene::TouchSignalType& Scene::TouchSignal()
+{
+ return GetImplementation(*this).TouchSignal();
+}
+
+Scene::WheelEventSignalType& Scene::WheelEventSignal()
+{
+ return GetImplementation(*this).WheelEventSignal();
+}
+
} // Integration
} // Dali
{
class Actor;
+class KeyEvent;
class Layer;
class RenderTaskList;
+class TouchData;
+class WheelEvent;
namespace Internal DALI_INTERNAL
{
{
class RenderSurface;
+struct Event;
/**
* @brief
class DALI_CORE_API Scene : public BaseHandle
{
public:
+ typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
+ typedef Signal< void (const Dali::KeyEvent&) > KeyEventSignalType; ///< Key event signal type
+ typedef Signal< void (const Dali::TouchData&) > TouchSignalType; ///< Touch signal type
+ typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< Touched signal type
/**
* @brief Create an initialized Scene handle.
*
* @return a handle to a newly allocated Dali resource.
*/
- static Scene New( Size size );
+ static Scene New( const Size& size );
/**
* @brief Downcast an Object handle to Scene handle.
*/
void SetSurface( Integration::RenderSurface& surface );
+ /**
+ * @brief Gets the rendering surface bound to the scene
+ *
+ * @return The render surface
+ */
+ Integration::RenderSurface* GetSurface() const;
+
+ /**
+ * This function is called when an event is queued.
+ * @param[in] event A event to queue.
+ */
+ void QueueEvent( const Integration::Event& event );
+
+ /**
+ * This function is called by Core when events are processed.
+ */
+ void ProcessEvents();
+
+ /**
+ * @brief This signal is emitted just after the event processing is finished.
+ *
+ * @return The signal to connect to
+ */
+ EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
+
+ /**
+ * @brief This signal is emitted when key event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const KeyEvent& event);
+ * @endcode
+ * @return The signal to connect to
+ */
+ KeyEventSignalType& KeyEventSignal();
+
+ /**
+ * @brief This signal is emitted when the screen is touched and when the touch ends
+ * (i.e. the down & up touch events only).
+ *
+ * If there are multiple touch points, then this will be emitted when the first touch occurs and
+ * then when the last finger is lifted.
+ * An interrupted event will also be emitted (if it occurs).
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( TouchData event );
+ * @endcode
+ *
+ * @return The touch signal to connect to
+ * @note Motion events are not emitted.
+ */
+ TouchSignalType& TouchSignal();
+
+ /**
+ * @brief This signal is emitted when wheel event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const WheelEvent& event);
+ * @endcode
+ * @return The signal to connect to
+ */
+ WheelEventSignalType& WheelEventSignal();
+
public: // Not intended for application developers
/**
// This must be called after stage is created but before stage initialization
mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) );
- mGestureEventProcessor = new GestureEventProcessor( *mStage, *mUpdateManager, gestureManager, mRenderController );
- mEventProcessor = new EventProcessor( *mStage, *mNotificationManager, *mGestureEventProcessor );
+ mGestureEventProcessor = new GestureEventProcessor( *mUpdateManager, gestureManager, mRenderController );
mShaderFactory = new ShaderFactory();
mUpdateManager->SetShaderSaver( *mShaderFactory );
void Core::QueueEvent( const Integration::Event& event )
{
- mEventProcessor->QueueEvent( event );
+ if (mScenes.size() != 0)
+ {
+ mScenes.front()->QueueEvent( event );
+ }
}
void Core::ProcessEvents()
// Signal that any messages received will be flushed soon
mUpdateManager->EventProcessingStarted();
- mEventProcessor->ProcessEvents();
+ // process events in all scenes
+ for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ {
+ (*iter)->ProcessEvents();
+ }
mNotificationManager->ProcessMessages();
// Emit signal here to inform listeners that event processing has finished.
- mStage->EmitEventProcessingFinishedSignal();
+ for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ {
+ (*iter)->EmitEventProcessingFinishedSignal();
+ }
// Run any registered processors
RunProcessors();
// Run the size negotiation after event processing finished signal
mRelayoutController->Relayout();
-
// Rebuild depth tree after event processing has finished
for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
{
OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
- OwnerPointer<EventProcessor> mEventProcessor; ///< The event processor
Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
std::vector<ScenePtr> mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core
} //Unnamed namespace
-ScenePtr Scene::New( Size size )
+ScenePtr Scene::New( const Size& size )
{
ScenePtr scene = new Scene( size );
return scene;
}
-Scene::Scene( Size size )
+Scene::Scene( const Size& size )
: mSurface( nullptr ),
mSize( size ),
mSurfaceSize( Vector2::ZERO ),
mDpi( Vector2::ZERO ),
- mDepthTreeDirty( false )
+ mDepthTreeDirty( false ),
+ mEventProcessor( *this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor() )
{
}
// Create the ordered list of layers
mLayerList = LayerList::New( updateManager );
- // The stage owns the default layer
+ // The scene owns the default layer
mRootLayer = Layer::NewRoot( *mLayerList, updateManager );
mRootLayer->SetName("RootLayer");
mRootLayer->SetScene( *this );
mDepthTreeDirty = true;
}
+void Scene::QueueEvent( const Integration::Event& event )
+{
+ mEventProcessor.QueueEvent( event );
+}
+
+void Scene::ProcessEvents()
+{
+ mEventProcessor.ProcessEvents();
+}
+
void Scene::RebuildDepthTree()
{
// If the depth tree needs rebuilding, do it in this frame only.
return mSurface ? mSurface->GetBackgroundColor() : DEFAULT_BACKGROUND_COLOR;
}
+void Scene::EmitKeyEventSignal(const KeyEvent& event)
+{
+ mKeyEventSignal.Emit( event );
+}
+
+void Scene::EmitEventProcessingFinishedSignal()
+{
+ mEventProcessingFinishedSignal.Emit();
+}
+
+void Scene::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch )
+{
+ mTouchedSignal.Emit( touchEvent );
+ mTouchSignal.Emit( touch );
+}
+
+void Scene::EmitWheelEventSignal(const WheelEvent& event)
+{
+ mWheelEventSignal.Emit( event );
+}
+
+Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal()
+{
+ return mKeyEventSignal;
+}
+
+Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
+{
+ return mEventProcessingFinishedSignal;
+}
+
+Scene::TouchedSignalType& Scene::TouchedSignal()
+{
+ return mTouchedSignal;
+}
+
+Integration::Scene::TouchSignalType& Scene::TouchSignal()
+{
+ return mTouchSignal;
+}
+
+Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal()
+{
+ return mWheelEventSignal;
+}
} // Internal
#include <dali/integration-api/render-surface.h>
#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/event/actors/layer-impl.h>
+#include <dali/internal/event/events/event-processor.h>
#include <dali/internal/event/render-tasks/render-task-defaults.h>
namespace Dali
{
+namespace Integration
+{
+
+class Event;
+
+}
+
namespace Internal
{
+class EventProcessor;
class Layer;
class LayerList;
class CameraActor;
{
public:
-
/**
* @copydoc Dali::Integration::Scene::New
*/
- static ScenePtr New( Size size );
+ static ScenePtr New( const Size& size );
/**
* virtual destructor
Integration::RenderSurface* GetSurface() const;
/**
- * Retrieve the ordered list of on-stage layers.
+ * Retrieve the ordered list of on-scene layers.
* @return The layer-list.
*/
LayerList& GetLayerList() const;
void RequestRebuildDepthTree();
/**
+ * This function is called when an event is queued.
+ * @param[in] event A event to queue.
+ */
+ void QueueEvent( const Integration::Event& event );
+
+ /**
+ * This function is called by Core when events are processed.
+ */
+ void ProcessEvents();
+
+ /**
* Rebuilds the depth tree at the end of the event frame if
* it was requested this frame.
*/
*/
Vector4 GetBackgroundColor() const;
+ /**
+ * Used by the EventProcessor to emit key event signals.
+ * @param[in] event The key event.
+ */
+ void EmitKeyEventSignal(const KeyEvent& event);
+
+ /**
+ * Emits the event processing finished signal.
+ *
+ * @see Dali::Scene::SignalEventProcessingFinished()
+ */
+ void EmitEventProcessingFinishedSignal();
+
+ /**
+ * Emits the touched signal.
+ * @param[in] touchEvent The touch event details (Old API).
+ * @param[in] touch The touch event details.
+ */
+ void EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch );
+
+ /**
+ * Used by the EventProcessor to emit wheel event signals.
+ * @param[in] event The wheel event.
+ */
+ void EmitWheelEventSignal( const WheelEvent& event );
+
+ /**
+ * @copydoc Integration::Scene::KeyEventSignal()
+ */
+ Integration::Scene::KeyEventSignalType& KeyEventSignal();
+
+ /**
+ * @copydoc Integration::Scene::SignalEventProcessingFinished()
+ */
+ Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
+
+ // The touched signal, to support Stage touched signal, will be removed when deprecated in public Stage API
+ using TouchedSignalType = Signal< void (const TouchEvent&) >;
+
+ /**
+ * Touched signal to support deprecated stage touched signal.
+ */
+ TouchedSignalType& TouchedSignal();
+
+ /**
+ * @copydoc Integration::Scene::TouchSignal()
+ */
+ Integration::Scene::TouchSignalType& TouchSignal();
+
+ /**
+ * @copydoc Integration::Scene::sWheelEventSignal()
+ */
+ Integration::Scene::WheelEventSignalType& WheelEventSignal();
+
public:
/**
private:
// Constructor
- Scene( Size size );
+ Scene( const Size& size );
/**
* Second-phase constructor.
Scene& operator=(const Scene& rhs) = delete;
private:
-
Integration::RenderSurface* mSurface;
// The scene-size may be different with the surface-size
FrameBufferPtr mFrameBuffer;
bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating
+
+ EventProcessor mEventProcessor;
+
+ // The key event signal
+ Integration::Scene::KeyEventSignalType mKeyEventSignal;
+
+ // The event processing finished signal
+ Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
+
+ // The touch signal
+ Integration::Scene::TouchSignalType mTouchSignal;
+
+ // The touched signal
+ TouchedSignalType mTouchedSignal;
+
+ // The wheel event signal
+ Integration::Scene::WheelEventSignalType mWheelEventSignal;
};
} // Internal
#include <dali/internal/event/common/object-registry-impl.h>
#include <dali/integration-api/platform-abstraction.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/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
{
mScene = &scene;
mScene->SetBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR );
+ mScene->EventProcessingFinishedSignal().Connect( this, &Stage::OnEventProcessingFinished );
+ mScene->KeyEventSignal().Connect( this, &Stage::OnKeyEvent );
+ mScene->TouchedSignal().Connect( this, &Stage::OnTouchedEvent );
+ mScene->TouchSignal().Connect( this, &Stage::OnTouchEvent );
+ mScene->WheelEventSignal().Connect( this, &Stage::OnWheelEvent );
}
StagePtr Stage::GetCurrent()
return connected;
}
+void Stage::OnEventProcessingFinished()
+{
+ EmitEventProcessingFinishedSignal();
+}
+
+void Stage::OnKeyEvent( const Dali::KeyEvent& event )
+{
+ bool consumed = EmitKeyEventGeneratedSignal( event );
+ if( !consumed )
+ {
+ EmitKeyEventSignal( event );
+ }
+}
+
+void Stage::OnTouchedEvent( const Dali::TouchEvent& touchEvent )
+{
+ mTouchedSignal.Emit( touchEvent );
+}
+
+void Stage::OnTouchEvent( const Dali::TouchData& touch )
+{
+ mTouchSignal.Emit( touch );
+}
+
+void Stage::OnWheelEvent( const Dali::WheelEvent& event )
+{
+ EmitWheelEventSignal( event );
+}
+
void Stage::EmitKeyEventSignal(const KeyEvent& event)
{
// Emit the key event signal when no actor in the stage has gained the key input focus
mTouchSignal.Emit( touch );
}
-void Stage::EmitWheelEventSignal(const WheelEvent& event)
+void Stage::EmitWheelEventSignal( const WheelEvent& event )
{
// Emit the wheel event signal when no actor in the stage has gained the wheel input focus
/**
* Implementation of Stage
*/
-class Stage : public BaseObject, public RenderTaskDefaults, public Integration::ContextNotifierInterface
+class Stage : public BaseObject, public RenderTaskDefaults, public Integration::ContextNotifierInterface, public ConnectionTracker
{
public:
DevelStage::Rendering GetRenderingBehavior() const;
/**
+ * Callback for Internal::Scene EventProcessingFinished signal
+ */
+ void OnEventProcessingFinished();
+
+ /**
+ * Callback for Internal::Scene KeyEventSignal signal
+ */
+ void OnKeyEvent( const Dali::KeyEvent& event );
+
+ /**
+ * Callback for Internal::Scene TouchedEventSignal signal
+ */
+ void OnTouchedEvent( const Dali::TouchEvent& touch );
+
+ /**
+ * Callback for Internal::Scene TouchSignal signal
+ */
+ void OnTouchEvent( const Dali::TouchData& touch );
+
+ /**
+ * Callback for Internal::Scene WheelEventSignal signal
+ */
+ void OnWheelEvent( const Dali::WheelEvent& event );
+
+ /**
* Used by the EventProcessor to emit key event signals.
* @param[in] event The key event.
*/
} // unnamed namespace
-EventProcessor::EventProcessor(Stage& stage, NotificationManager& /* notificationManager */, GestureEventProcessor& gestureEventProcessor)
-: mTouchEventProcessor(stage),
- mHoverEventProcessor(stage),
- mGestureEventProcessor(gestureEventProcessor),
- mKeyEventProcessor(stage),
- mWheelEventProcessor(stage),
+EventProcessor::EventProcessor( Scene& scene, GestureEventProcessor& gestureEventProcessor )
+: mScene( scene ),
+ mTouchEventProcessor( scene ),
+ mHoverEventProcessor( scene ),
+ mGestureEventProcessor( gestureEventProcessor ),
+ mKeyEventProcessor( scene ),
+ mWheelEventProcessor( scene ),
mEventQueue0( INITIAL_BUFFER_SIZE ),
mEventQueue1( INITIAL_BUFFER_SIZE ),
mCurrentEventQueue( &mEventQueue0 )
MessageBuffer* queueToProcess = mCurrentEventQueue;
// Switch current queue; events can be added safely while iterating through the other queue.
- mCurrentEventQueue = (&mEventQueue0 == mCurrentEventQueue) ? &mEventQueue1 : &mEventQueue0;
+ mCurrentEventQueue = ( &mEventQueue0 == mCurrentEventQueue ) ? &mEventQueue1 : &mEventQueue0;
for( MessageBuffer::Iterator iter = queueToProcess->Begin(); iter.IsValid(); iter.Next() )
{
case Event::Gesture:
{
- mGestureEventProcessor.ProcessGestureEvent( static_cast<const Integration::GestureEvent&>(*event) );
+ mGestureEventProcessor.ProcessGestureEvent( mScene, static_cast<const Integration::GestureEvent&>(*event) );
break;
}
namespace Internal
{
-class Stage;
+class Scene;
class GestureEventProcessor;
class NotificationManager;
/**
* Constructor
- * @param[in] stage The stage.
- * @param[in] notificationManager The Notification Manager.
+ * @param[in] scene The scene.
* @param[in] gestureEventProcessor The gesture event processor.
*/
- EventProcessor(Stage& stage, NotificationManager& notificationManager, GestureEventProcessor& gestureEventProcessor);
+ EventProcessor( Scene& scene, GestureEventProcessor& gestureEventProcessor );
/**
* Destructor
public:
/**
- * This function is called by Core when an event is queued.
+ * This function is called when an event is queued.
* @param[in] event A event to queue.
*/
void QueueEvent( const Integration::Event& event );
/**
- * This function is called by Core when events are processed.
+ * This function is called when events are processed.
*/
void ProcessEvents();
private:
+ Scene& mScene; ///< The Scene events are processed for.
TouchEventProcessor mTouchEventProcessor; ///< Processes touch events.
HoverEventProcessor mHoverEventProcessor; ///< Processes hover events.
GestureEventProcessor& mGestureEventProcessor; ///< Processes gesture events.
}
}
-void GestureDetector::Attach(Actor& actor)
+void GestureDetector::Attach( Actor& actor )
{
- if ( !IsAttached(actor) )
+ if ( !IsAttached( actor) )
{
// Register with EventProcessor if first actor being added
- if ( mAttachedActors.empty() )
+ if( mAttachedActors.empty() )
{
- mGestureEventProcessor.AddGestureDetector(this);
+ mGestureEventProcessor.AddGestureDetector( this );
}
- mAttachedActors.push_back(&actor);
+ mAttachedActors.push_back( &actor );
// We need to observe the actor's destruction
- actor.AddObserver(*this);
+ actor.AddObserver( *this );
// Add the detector to the actor (so the actor knows it requires this gesture when going through hit-test algorithm)
actor.GetGestureData().AddGestureDetector( *this );
// Notification for derived classes
- OnActorAttach(actor);
+ OnActorAttach( actor );
}
}
namespace Internal
{
-GestureEventProcessor::GestureEventProcessor( Stage& stage, SceneGraph::UpdateManager& updateManager, Integration::GestureManager& gestureManager, Integration::RenderController& renderController )
-: mStage( stage ),
- mGestureManager( gestureManager ),
- mLongPressGestureProcessor( stage, gestureManager ),
- mPanGestureProcessor( stage, gestureManager, updateManager ),
- mPinchGestureProcessor( stage, gestureManager ),
- mTapGestureProcessor( stage, gestureManager ),
+GestureEventProcessor::GestureEventProcessor( SceneGraph::UpdateManager& updateManager, Integration::GestureManager& gestureManager, Integration::RenderController& renderController )
+: mGestureManager( gestureManager ),
+ mLongPressGestureProcessor( gestureManager ),
+ mPanGestureProcessor( gestureManager, updateManager ),
+ mPinchGestureProcessor( gestureManager ),
+ mTapGestureProcessor( gestureManager ),
mRenderController( renderController ),
mUpdateRequired( false )
{
{
}
-void GestureEventProcessor::ProcessGestureEvent(const Integration::GestureEvent& event)
+void GestureEventProcessor::ProcessGestureEvent( Scene& scene, const Integration::GestureEvent& event)
{
if( Gesture::Started == event.state || Gesture::Continuing == event.state )
{
switch(event.gestureType)
{
case Gesture::LongPress:
- mLongPressGestureProcessor.Process(static_cast<const Integration::LongPressGestureEvent&>(event));
+ mLongPressGestureProcessor.Process( scene, static_cast<const Integration::LongPressGestureEvent&>(event) );
break;
case Gesture::Pan:
- mPanGestureProcessor.Process(static_cast<const Integration::PanGestureEvent&>(event));
+ mPanGestureProcessor.Process( scene, static_cast<const Integration::PanGestureEvent&>(event));
break;
case Gesture::Pinch:
- mPinchGestureProcessor.Process(static_cast<const Integration::PinchGestureEvent&>(event));
+ mPinchGestureProcessor.Process( scene, static_cast<const Integration::PinchGestureEvent&>(event));
break;
case Gesture::Tap:
- mTapGestureProcessor.Process(static_cast<const Integration::TapGestureEvent&>(event));
+ mTapGestureProcessor.Process( scene, static_cast<const Integration::TapGestureEvent&>(event));
break;
}
}
{
class Stage;
+class Scene;
/**
* Gesture Event Processing:
/**
* Create a gesture event processor.
- * @param[in] stage The stage.
* @param[in] updateManager The update manager
* @param[in] gestureManager The gesture manager
* @param[in] renderController The render controller
*/
- GestureEventProcessor( Stage& stage, SceneGraph::UpdateManager& updateManager, Integration::GestureManager& gestureManager, Integration::RenderController& renderController );
+ GestureEventProcessor( SceneGraph::UpdateManager& updateManager, Integration::GestureManager& gestureManager, Integration::RenderController& renderController );
/**
* Non-virtual destructor; GestureProcessor is not a base class
* This function is called by Core whenever a gesture event occurs.
* @param[in] event The event that has occurred.
*/
- void ProcessGestureEvent(const Integration::GestureEvent& event);
+ void ProcessGestureEvent( Scene& scene, const Integration::GestureEvent& event );
public: // To be called by gesture detectors
private:
- Stage& mStage;
Integration::GestureManager& mGestureManager;
LongPressGestureProcessor mLongPressGestureProcessor;
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/events/actor-gesture-data.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
}
}
-bool GestureProcessor::HitTest(
- Stage& stage,
- Vector2 screenCoordinates,
- HitTestAlgorithm::Results& hitTestResults)
+bool GestureProcessor::HitTest( Scene& scene, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults )
{
GestureHitTestCheck hitCheck( mType );
- HitTestAlgorithm::HitTest( stage, screenCoordinates, hitTestResults, hitCheck );
+ HitTestAlgorithm::HitTest( scene.GetSize(), scene.GetRenderTaskList(), scene.GetLayerList(), screenCoordinates, hitTestResults, hitCheck );
return hitTestResults.renderTask && hitTestResults.actor;
}
/**
* Hit test the screen coordinates, and place the results in hitTestResults.
- * @param[in] stage Stage.
+ * @param[in] scene Scene.
* @param[in] screenCoordinates The screen coordinates to test.
* @param[out] hitTestResults Structure to write results into.
* @return false if the system overlay was hit or no actor was hit.
*/
- virtual bool HitTest(Stage& stage, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults);
+ virtual bool HitTest( Scene& scene, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults);
/**
* Sets the mCurrentGesturedActor and connects to the required signals.
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
-#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/projection.h>
#include <dali/internal/event/images/frame-buffer-image-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
* Hit test a RenderTask
*/
bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives,
- Stage& stage,
+ const Vector2& sceneSize,
LayerList& layers,
RenderTask& renderTask,
Vector2 screenCoordinates,
HitActor hit;
bool overlayHit = false;
bool layerConsumesHit = false;
- const Vector2& stageSize = stage.GetSize();
for( int32_t i = layers.GetLayerCount() - 1; i >= 0 && !( hit.actor ); --i )
{
overlayHit = false;
// Ensure layer is touchable (also checks whether ancestors are also touchable)
- if( IsActuallyHittable( *layer, screenCoordinates, stageSize, hitCheck ) )
+ if( IsActuallyHittable( *layer, screenCoordinates, sceneSize, hitCheck ) )
{
// Always hit-test the source actor; otherwise test whether the layer is below the source actor in the hierarchy
if( sourceActorDepth == static_cast<uint32_t>( i ) )
/**
* Iterate through the RenderTaskList and perform hit testing.
*
- * @param[in] stage The stage the tests will be performed in
+ * @param[in] sceneSize The scene size the tests will be performed in
* @param[in] layers The list of layers to test
* @param[in] taskList The list of render tasks
* @param[out] results Ray information calculated by the camera
* @param[in] onScreen True to test on-screen, false to test off-screen
* @return True if we have a hit, false otherwise
*/
-bool HitTestRenderTaskList( Stage& stage,
+bool HitTestRenderTaskList( const Vector2& sceneSize,
LayerList& layers,
RenderTaskList& taskList,
const Vector2& screenCoordinates,
continue;
}
- if( HitTestRenderTask( exclusives, stage, layers, renderTask, screenCoordinates, results, hitCheck ) )
+ if( HitTestRenderTask( exclusives, sceneSize, layers, renderTask, screenCoordinates, results, hitCheck ) )
{
// Return true when an actor is hit (or layer in our render-task consumes the hit)
return true; // don't bother checking off screen tasks
/**
* Iterate through the RenderTaskList and perform hit testing for both on-screen and off-screen.
*
- * @param[in] stage The stage the tests will be performed in
+ * @param[in] sceneSize The scene size the tests will be performed in
* @param[in] layers The list of layers to test
* @param[in] taskList The list of render tasks
* @param[out] results Ray information calculated by the camera
* @param[in] onScreen True to test on-screen, false to test off-screen
* @return True if we have a hit, false otherwise
*/
-bool HitTestForEachRenderTask( Stage& stage,
+bool HitTestForEachRenderTask( const Vector2& sceneSize,
LayerList& layers,
RenderTaskList& taskList,
const Vector2& screenCoordinates,
// Check on-screen tasks before off-screen ones.
// Hit test order should be reverse of draw order (see ProcessRenderTasks() where off-screen tasks are drawn first).
- if( HitTestRenderTaskList( stage, layers, taskList, screenCoordinates, results, hitCheck, true ) ||
- HitTestRenderTaskList( stage, layers, taskList, screenCoordinates, results, hitCheck, false ) )
+ if( HitTestRenderTaskList( sceneSize, layers, taskList, screenCoordinates, results, hitCheck, true ) ||
+ HitTestRenderTaskList( sceneSize, layers, taskList, screenCoordinates, results, hitCheck, false ) )
{
// Found hit.
result = true;
{
}
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
+bool HitTest( const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
{
bool wasHit( false );
- // Hit-test the regular on-stage actors
- RenderTaskList& taskList = stage.GetRenderTaskList();
- LayerList& layerList = stage.GetLayerList();
-
+ // Hit-test the regular on-scene actors
Results hitTestResults;
HitTestFunctionWrapper hitTestFunctionWrapper( func );
- if( HitTestForEachRenderTask( stage, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
+ if( HitTestForEachRenderTask( sceneSize, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
{
results.actor = hitTestResults.actor;
results.actorCoordinates = hitTestResults.actorCoordinates;
return wasHit;
}
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface )
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface )
{
bool wasHit( false );
- // Hit-test the regular on-stage actors
+ // Hit-test the regular on-scene actors
if( !wasHit )
{
- RenderTaskList& taskList = stage.GetRenderTaskList();
- LayerList& layerList = stage.GetLayerList();
-
- wasHit = HitTestForEachRenderTask( stage, layerList, taskList, screenCoordinates, results, hitTestInterface );
+ wasHit = HitTestForEachRenderTask( sceneSize, layerList, renderTaskList, screenCoordinates, results, hitTestInterface );
}
return wasHit;
}
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results )
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results )
{
ActorTouchableCheck actorTouchableCheck;
- return HitTest( stage, screenCoordinates, results, actorTouchableCheck );
+ return HitTest( sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck );
}
-bool HitTest( Stage& stage, RenderTask& renderTask, const Vector2& screenCoordinates,
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, RenderTask& renderTask, const Vector2& screenCoordinates,
Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
{
bool wasHit( false );
Results hitTestResults;
- const Vector< RenderTaskList::Exclusive >& exclusives = stage.GetRenderTaskList().GetExclusivesList();
+ const Vector< RenderTaskList::Exclusive >& exclusives = renderTaskList.GetExclusivesList();
HitTestFunctionWrapper hitTestFunctionWrapper( func );
- if( HitTestRenderTask( exclusives, stage, stage.GetLayerList(), renderTask, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
+ if( HitTestRenderTask( exclusives, sceneSize, layerList, renderTask, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
{
results.actor = hitTestResults.actor;
results.actorCoordinates = hitTestResults.actorCoordinates;
{
class Layer;
+class LayerList;
/**
* This namespace is provided for application developers to do hit test for the actors.
};
/**
- * @copydoc Dali::HitTestAlgorithm::HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
+ * Hit test specific to a given scene.
+ *
+ * @param[in] sceneSize The size of the scene.
+ * @param[in] renderTaskList The render task list of the scene.
+ * @param[in] layerList The layer list of the scene.
+ * @param[in] screenCoordinates The screen coordinates.
+ * @param[out] results The results of the hit-test.
+ * @param[in] func The function to use in the hit-test algorithm.
+ * @return true if something was hit
+ *
+ * @see HitTest(Stage&, const Vector2&, Results&, HitTestInterface&)
*/
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates,
+ Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
/**
* Given screen coordinates, this method returns the hit actor & the local coordinates relative to the actor etc.
- * @param[in] stage The stage.
+ * @param[in] sceneSize The size of the scene.
+ * @param[in] renderTaskList The render task list of the scene.
+ * @param[in] layerList The layer list of the scene.
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @param[in] hitTestInterface Used to determine whether the actor is hit or whether we walk down its hierarchy
*
* <h3>Hit Test Algorithm:</h3>
*
- * - The system overlay RenderTaskList is hit-tested first.
- * - If no hit then the regular RenderTaskList is used to hit test the on stage actors.
+ * - The regular RenderTaskList is used to hit test the on scene actors.
* - The bulk of the hit test algorithm is described in Dali::Actor.
* - In each RenderTask's its viewing parameters (the view and projection matrices, and the viewport)
* are used to build a picking ray into the scene which is used for our ray tests when hit testing
* @note Currently, we prefer a child hit over a parent (regardless of the distance from the
* camera) unless the parent is a RenderableActor but this is subject to change.
*/
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface );
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates,
+ Results& results, HitTestInterface& hitTestInterface );
/**
* Default HitTest where we check if a touch is required.
*
- * @param[in] stage The stage.
+ * @param[in] sceneSize The size of the scene.
+ * @param[in] renderTaskList The render task list of the scene.
+ * @param[in] layerList The layer list of the scene.
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @return true if something was hit
*
* @see HitTest(Stage&, const Vector2&, Results&, HitTestInterface&)
*/
-bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results );
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results );
/**
* Hit test specific to a given RenderTask
*
- * @param[in] stage The stage.
+ * @param[in] sceneSize The size of the scene.
+ * @param[in] renderTaskList The render task list of the scene.
+ * @param[in] layerList The layer list of the scene.
* @param[in] renderTask The render task for hit test
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @param[in] func The function to use in the hit-test algorithm.
* @return true if something was hit
*/
-bool HitTest( Stage& stage, RenderTask& renderTask, const Vector2& screenCoordinates,
+bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, RenderTask& renderTask, const Vector2& screenCoordinates,
Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/events/multi-point-event-util.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
} // unnamed namespace
-HoverEventProcessor::HoverEventProcessor( Stage& stage )
-: mStage( stage ),
- mLastPrimaryHitActor(),
- mLastConsumedActor(),
- mHoverStartConsumedActor(),
- mLastRenderTask()
+HoverEventProcessor::HoverEventProcessor( Scene& scene )
+: mScene( scene )
{
DALI_LOG_TRACE_METHOD( gLogFilter );
}
void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& event )
{
DALI_LOG_TRACE_METHOD( gLogFilter );
-
DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty HoverEvent sent from Integration\n" );
- Stage& stage = mStage;
TouchPoint::State state = static_cast< TouchPoint::State >( event.points[0].GetState() );
PRINT_HIERARCHY(gLogFilter);
{
HitTestAlgorithm::Results hitTestResults;
ActorHoverableCheck actorHoverableCheck;
- HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
+ HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
TouchPoint newPoint( iter->GetTouchPoint() );
newPoint.hitActor = hitTestResults.actor;
{
struct ActorObserver;
-class Stage;
+class Scene;
/**
* <h3>Multi-Hover Event Processing:</h3>
/**
* Create an event processor.
- * @param[in] stage The stage.
+ * @param[in] scene The scene the event processor belongs to.
*/
- HoverEventProcessor( Stage& stage );
+ HoverEventProcessor( Scene& scene );
/**
* Non-virtual destructor; HoverEventProcessor is not a base class
// Undefined
HoverEventProcessor& operator=(const HoverEventProcessor& rhs);
- Stage& mStage; ///< Used to deliver touch events
+ Scene& mScene; ///< Reference to the scene
ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
ActorObserver mHoverStartConsumedActor; ///< Stores the hover-start consumed actor
#include <dali/public-api/events/key-event.h>
#include <dali/internal/event/events/key-event-impl.h>
#include <dali/internal/event/actors/actor-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/integration-api/events/key-event-integ.h>
namespace Dali
namespace Internal
{
-KeyEventProcessor::KeyEventProcessor(Stage& stage)
-: mStage(stage)
+KeyEventProcessor::KeyEventProcessor( Scene& scene )
+: mScene( scene )
{
}
{
}
-void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
+void KeyEventProcessor::ProcessKeyEvent( const Integration::KeyEvent& event )
{
KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state));
-
GetImplementation( &keyEvent )->SetLogicalKey( event.logicalKey );
GetImplementation( &keyEvent )->SetCompose( event.compose );
GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
GetImplementation( &keyEvent )->SetDeviceClass( event.deviceClass );
GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass );
- // Emit the key event signal from stage.
- bool consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent );
-
- if( !consumed )
- {
- mStage.EmitKeyEventSignal(keyEvent);
- }
+ // Emit the key event signal from the scene.
+ mScene.EmitKeyEventSignal( keyEvent );
}
} // namespace Internal
*
*/
+#include <vector>
+
namespace Dali
{
namespace Internal
{
+class Scene;
class Stage;
/**
* KeyEventProcessor receives the filtered key events from the Dali Event processor.
*
- * When a key event is received the KeyEvent Processor queries the Stage to get the actor in focus.
+ * When a key event is received the KeyEventProcessor queues the event in the scene events queue.
* Any actor can be set by the actor api to be the focus of key events. The actor is then sent the key event.
* If no actor is set for focus then the key event is discarded.
*/
/**
* Create a Key event processor.
+ * @param[in] scene The scene the event processor belongs to.
*/
- KeyEventProcessor(Stage& stage);
+ KeyEventProcessor( Scene& scene );
/**
* Non-virtual destructor; KeyEventProcessor is not a base class
private:
- Stage& mStage; ///< Used to deliver touch events
-
+ Scene& mScene; ///< Used to deliver key events
};
} // namespace Internal
#include <dali/integration-api/gesture-manager.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
} // unnamed namespace
-LongPressGestureProcessor::LongPressGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager)
+LongPressGestureProcessor::LongPressGestureProcessor( Integration::GestureManager& gestureManager)
: GestureProcessor( Gesture::LongPress ),
- mStage( stage ),
mGestureManager( gestureManager ),
mGestureDetectors(),
mCurrentEmitters(),
{
}
-void LongPressGestureProcessor::Process( const Integration::LongPressGestureEvent& longPressEvent )
+void LongPressGestureProcessor::Process( Scene& scene, const Integration::LongPressGestureEvent& longPressEvent )
{
switch ( longPressEvent.state )
{
ResetActor();
HitTestAlgorithm::Results hitTestResults;
- if( HitTest( mStage, longPressEvent.point, hitTestResults ) )
+ if( HitTest( scene, longPressEvent.point, hitTestResults ) )
{
SetActor( &GetImplementation( hitTestResults.actor ) );
}
if ( currentGesturedActor )
{
HitTestAlgorithm::Results hitTestResults;
- HitTest( mStage, longPressEvent.point, hitTestResults );
+ HitTest( scene, longPressEvent.point, hitTestResults );
if ( hitTestResults.actor && ( currentGesturedActor == &GetImplementation( hitTestResults.actor ) ) )
{
{
class Stage;
+class Scene;
/**
* Long Press Gesture Event Processing:
/**
* Create a long press gesture processor.
- * @param[in] stage The stage.
* @param[in] gestureManager The gesture manager.
*/
- LongPressGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager );
+ LongPressGestureProcessor( Integration::GestureManager& gestureManager );
/**
* Non-virtual destructor; LongPressGestureProcessor is not a base class
/**
* This method is called whenever a long press gesture event occurs.
+ * @param[in] scene The scene the long press gesture event occurs in.
* @param[in] longPressEvent The event that has occurred.
*/
- void Process( const Integration::LongPressGestureEvent& longPressEvent );
+ void Process( Scene& scene, const Integration::LongPressGestureEvent& longPressEvent );
/**
* Adds a gesture detector to this gesture processor.
private:
- Stage& mStage;
Integration::GestureManager& mGestureManager;
LongPressGestureDetectorContainer mGestureDetectors;
#include <dali/integration-api/events/pan-gesture-event.h>
#include <dali/integration-api/gesture-manager.h>
#include <dali/integration-api/debug.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
} // unnamed namespace
-PanGestureProcessor::PanGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager, SceneGraph::UpdateManager& updateManager )
+PanGestureProcessor::PanGestureProcessor( Integration::GestureManager& gestureManager, SceneGraph::UpdateManager& updateManager )
: GestureProcessor( Gesture::Pan ),
- mStage( stage ),
mGestureManager( gestureManager ),
mGestureDetectors(),
mCurrentPanEmitters(),
mSceneObject = NULL; // mSceneObject is owned and destroyed by update manager (there is only one of these for now)
}
-void PanGestureProcessor::Process( const Integration::PanGestureEvent& panEvent )
+void PanGestureProcessor::Process( Scene& scene, const Integration::PanGestureEvent& panEvent )
{
switch( panEvent.state )
{
ResetActor();
HitTestAlgorithm::Results hitTestResults;
- if( HitTest( mStage, panEvent.currentPosition, hitTestResults ) )
+ if( HitTest( scene, panEvent.currentPosition, hitTestResults ) )
{
SetActor( &GetImplementation( hitTestResults.actor ) );
mPossiblePanPosition = panEvent.currentPosition;
// it can be told when the gesture ends as well.
HitTestAlgorithm::Results hitTestResults;
- HitTest( mStage, mPossiblePanPosition, hitTestResults ); // Hit test original possible position...
+ HitTest( scene, mPossiblePanPosition, hitTestResults ); // Hit test original possible position...
if ( hitTestResults.actor && ( GetCurrentGesturedActor() == &GetImplementation( hitTestResults.actor ) ) )
{
{
class Stage;
+class Scene;
namespace SceneGraph
{
/**
* Create a pan gesture processor.
- * @param[in] stage The stage.
* @param[in] gestureManager The gesture manager
* @param[in] updateManager The Update Manager
*/
- PanGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager, SceneGraph::UpdateManager& updateManager );
+ PanGestureProcessor( Integration::GestureManager& gestureManager, SceneGraph::UpdateManager& updateManager );
/**
* Destructor
/**
* This method is called whenever a pan gesture event occurs.
+ * @param[in] scene The scene the pan gesture event occurs in.
* @param[in] panEvent The event that has occurred.
*/
- void Process( const Integration::PanGestureEvent& panEvent );
+ void Process( Scene& scene, const Integration::PanGestureEvent& panEvent );
/**
* Adds a gesture detector to this gesture processor.
private:
- Stage& mStage;
Integration::GestureManager& mGestureManager;
PanGestureDetectorContainer mGestureDetectors;
GestureDetectorContainer mCurrentPanEmitters;
#include <dali/integration-api/events/pinch-gesture-event.h>
#include <dali/integration-api/gesture-manager.h>
#include <dali/integration-api/debug.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
} // unnamed namespace
-PinchGestureProcessor::PinchGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager )
+PinchGestureProcessor::PinchGestureProcessor( Integration::GestureManager& gestureManager )
: GestureProcessor( Gesture::Pinch ),
- mStage(stage),
mGestureManager(gestureManager),
mGestureDetectors(),
mCurrentPinchEmitters(),
{
}
-void PinchGestureProcessor::Process( const Integration::PinchGestureEvent& pinchEvent )
+void PinchGestureProcessor::Process( Scene& scene, const Integration::PinchGestureEvent& pinchEvent )
{
switch ( pinchEvent.state )
{
ResetActor();
HitTestAlgorithm::Results hitTestResults;
- if( HitTest( mStage, pinchEvent.centerPoint, hitTestResults ) )
+ if( HitTest( scene, pinchEvent.centerPoint, hitTestResults ) )
{
// Record the current render-task for Screen->Actor coordinate conversions
mCurrentRenderTask = hitTestResults.renderTask;
namespace Internal
{
+class Scene;
class Stage;
/**
/**
* Create a pinch gesture processor.
- * @param[in] stage The stage.
* @param[in] gestureManager The gesture manager
*/
- PinchGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
+ PinchGestureProcessor( Integration::GestureManager& gestureManager );
/**
* Non-virtual destructor; PinchGestureProcessor is not a base class
/**
* This method is called whenever a pinch gesture event occurs.
+ * @param[in] scene The scene the pinch gesture event occurs in.
* @param[in] pinchEvent The event that has occurred.
*/
- void Process(const Integration::PinchGestureEvent& pinchEvent);
+ void Process( Scene& scene, const Integration::PinchGestureEvent& pinchEvent );
/**
* Adds a gesture detector to this gesture processor.
private:
- Stage& mStage;
Integration::GestureManager& mGestureManager;
PinchGestureDetectorContainer mGestureDetectors;
GestureDetectorContainer mCurrentPinchEmitters;
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
namespace Dali
{
} // unnamed namespace
-TapGestureProcessor::TapGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager)
+TapGestureProcessor::TapGestureProcessor( Integration::GestureManager& gestureManager)
: GestureProcessor( Gesture::Tap ),
- mStage( stage ),
mGestureManager( gestureManager ),
mGestureDetectors(),
mMinTapsRequired( 1 ),
{
}
-void TapGestureProcessor::Process( const Integration::TapGestureEvent& tapEvent )
+void TapGestureProcessor::Process( Scene& scene, const Integration::TapGestureEvent& tapEvent )
{
switch ( tapEvent.state )
{
{
// Do a hit test and if an actor has been hit then save to see if tap event is still valid on a tap( same actor being hit )
HitTestAlgorithm::Results hitTestResults;
- if ( HitTest( mStage, tapEvent.point, hitTestResults ) )
+ if ( HitTest( scene, tapEvent.point, hitTestResults ) )
{
SetActor( &GetImplementation( hitTestResults.actor ) );
mCurrentTapActor.SetActor( GetCurrentGesturedActor() );
{
// Ensure that we're processing a hit on the current actor and that we've already processed a touch down
HitTestAlgorithm::Results hitTestResults;
- if ( GetCurrentGesturedActor() && HitTest( mStage, tapEvent.point, hitTestResults ) && mPossibleProcessed )
+ if ( GetCurrentGesturedActor() && HitTest( scene, tapEvent.point, hitTestResults ) && mPossibleProcessed )
{
// Check that this actor is still the one that was used for the last touch down ?
if ( mCurrentTapActor.GetActor() == &GetImplementation( hitTestResults.actor ) )
namespace Internal
{
+class Scene;
class Stage;
class Actor;
/**
* Create a tap gesture processor.
- * @param[in] stage The stage.
* @param[in] gestureManager The gesture manager.
*/
- TapGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
+ TapGestureProcessor( Integration::GestureManager& gestureManager );
/**
* Non-virtual destructor; TapGestureProcessor is not a base class
/**
* This method is called whenever a tap gesture event occurs.
+ * @param[in] scene The scene the tap gesture event occurs in.
* @param[in] tapEvent The event that has occurred.
*/
- void Process(const Integration::TapGestureEvent& tapEvent);
+ void Process( Scene& scene, const Integration::TapGestureEvent& tapEvent);
/**
* Adds a gesture detector to this gesture processor.
private:
- Stage& mStage;
Integration::GestureManager& mGestureManager;
TapGestureDetectorContainer mGestureDetectors;
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/events/multi-point-event-util.h>
#include <dali/internal/event/events/touch-data-impl.h>
} // unnamed namespace
-TouchEventProcessor::TouchEventProcessor( Stage& stage )
-: mStage( stage ),
+TouchEventProcessor::TouchEventProcessor( Scene& scene )
+: mScene( scene ),
mLastPrimaryHitActor( MakeCallback( this, &TouchEventProcessor::OnObservedActorDisconnected ) ),
mLastConsumedActor(),
mTouchDownConsumedActor(),
void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& event )
{
DALI_LOG_TRACE_METHOD( gLogFilter );
-
DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty TouchEvent sent from Integration\n" );
- Stage& stage = mStage;
-
PRINT_HIERARCHY(gLogFilter);
// 1) Check if it is an interrupted event - we should inform our last primary hit actor about this
touchEvent.points.push_back( currentPoint.GetTouchPoint() );
touchData->AddPoint( currentPoint );
- mStage.EmitTouchedSignal( touchEvent, touchDataHandle );
-
+ mScene.EmitTouchedSignal( touchEvent, touchDataHandle );
return; // No need for hit testing
}
for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
{
HitTestAlgorithm::Results hitTestResults;
- HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults );
+ HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), iter->GetScreenPosition(), hitTestResults );
Integration::Point newPoint( *iter );
newPoint.SetHitActor( hitTestResults.actor );
Actor* lastConsumedActor( mLastConsumedActor.GetActor() );
if( ( primaryPointState == PointState::MOTION ) || ( primaryPointState == PointState::UP ) || ( primaryPointState == PointState::STATIONARY ) )
{
- if ( mLastRenderTask )
+ if( mLastRenderTask )
{
Dali::Actor leaveEventConsumer;
RenderTask& lastRenderTaskImpl = *mLastRenderTask.Get();
case PointState::DOWN:
{
- mStage.EmitTouchedSignal( touchEvent, touchDataHandle );
+ mScene.EmitTouchedSignal( touchEvent, touchDataHandle );
break;
}
{
class Actor;
-class Stage;
+class Scene;
struct ActorObserver;
/**
/**
* Create an event processor.
- * @param[in] stage The stage.
+ * @param[in] scene The scene the event processor belongs to.
*/
- TouchEventProcessor( Stage& stage );
+ TouchEventProcessor( Scene& scene );
/**
* Non-virtual destructor; TouchEventProcessor is not a base class
// Undefined
TouchEventProcessor& operator=(const TouchEventProcessor& rhs);
+private:
+
+ Scene& mScene; ///< Used to deliver touch events
+
/**
* Called by some actor-observers when the observed actor is disconnected.
*
*/
void OnObservedActorDisconnected( Actor* actor );
-private:
-
- Stage& mStage; ///< Used to deliver touch events
ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
ActorObserver mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
// INTERNAL INCLUDES
#include <dali/public-api/events/wheel-event.h>
-#include <dali/devel-api/events/hit-test-algorithm.h>
+
#include <dali/public-api/math/vector2.h>
#include <dali/integration-api/events/wheel-event-integ.h>
-#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/events/hit-test-algorithm-impl.h>
namespace Dali
{
} // unnamed namespace
-WheelEventProcessor::WheelEventProcessor(Stage& stage)
-: mStage(stage)
+WheelEventProcessor::WheelEventProcessor( Scene& scene )
+: mScene( scene )
{
}
{
}
-void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event)
+void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event )
{
- Stage& stage = mStage;
- WheelEvent wheelEvent( static_cast< WheelEvent::Type >(event.type), event.direction, event.modifiers, event.point, event.z, event.timeStamp );
+ WheelEvent wheelEvent( static_cast< WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.z, event.timeStamp );
if( wheelEvent.type == WheelEvent::MOUSE_WHEEL )
{
- HitTestAlgorithm::Results hitTestResults;
- HitTestAlgorithm::HitTest( Dali::Stage(&stage), event.point, hitTestResults, IsActorWheelableFunction );
+ Dali::HitTestAlgorithm::Results hitTestResults;
+ HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction );
DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
event.point.x, event.point.y,
}
else
{
- // if CUSTOM_WHEEL, emit the key event signal from stage.
- mStage.EmitWheelEventSignal( wheelEvent );
+ // if CUSTOM_WHEEL, emit the wheel event signal from the scene.
+ mScene.EmitWheelEventSignal( wheelEvent );
}
}
*
*/
+#include <vector>
+
namespace Dali
{
namespace Internal
{
-class Stage;
+class Scene;
/**
* WheelEventProcessor receives the wheel events from the Dali Event processor.
/**
* Create a wheel event processor.
*/
- WheelEventProcessor(Stage& stage);
+ WheelEventProcessor( Scene& scenes );
/**
* Non-virtual destructor; WheelEventProcessor is not a base class
private:
- Stage& mStage; ///< Used to deliver the wheel events
+ Scene& mScene; ///< Used to deliver the wheel events
};
} // namespace Internal
return *static_cast<const SceneGraph::RenderTask*>( mUpdateObject );
}
+RenderTaskList& RenderTask::GetRenderTaskList() const
+{
+ return mRenderTaskList;
+}
+
/********************************************************************************
******************************** PROPERTY METHODS **************************
********************************************************************************/
*/
const SceneGraph::RenderTask& GetRenderTaskSceneObject() const;
+ /**
+ * Retrieve the render task list RenderTask object belongs to.
+ * @return The render task list
+ */
+ RenderTaskList& GetRenderTaskList() const;
+
public: // Implementation of Object
/**