#define DALI_INTERNAL_SCENE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#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
+{
+
+struct Event;
+
+}
+
namespace Internal
{
+namespace SceneGraph
+{
+class Scene;
+}
+
+class EventProcessor;
class Layer;
class LayerList;
class CameraActor;
{
public:
-
/**
* @copydoc Dali::Integration::Scene::New
*/
/**
* virtual destructor
*/
- virtual ~Scene();
+ ~Scene() override;
/**
* @copydoc Dali::Integration::Scene::Add
Dali::Layer GetLayer(uint32_t depth) const;
/**
- * @copydoc Dali::Integration::Scene::SetSurface
+ * Notify the surface has been resized.
+ *
+ * @param[in] width The new width of the set surface
+ * @param[in] height The new height of the set surface
*/
- void SetSurface( Integration::RenderSurface& surface );
+ void SurfaceResized( float width, float height );
/**
- * Retrieve the render surface the scene is binded to.
- * @return The render surface.
+ * @copydoc Dali::Integration::Scene::SurfaceReplaced
*/
- Integration::RenderSurface* GetSurface() const;
+ void SurfaceReplaced();
/**
- * Retrieve the ordered list of on-stage layers.
+ * @copydoc Dali::Integration::Scene::Discard
+ */
+ void Discard();
+
+ /**
+ * 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.
*/
void RebuildDepthTree();
/**
- * @brief Sets the background color of the render surface.
+ * @brief Sets the background color of the render surface.
* @param[in] color The new background color
*/
- void SetBackgroundColor(Vector4 color);
+ void SetBackgroundColor( const Vector4& color );
/**
* @brief Gets the background color of the render surface.
*/
Vector4 GetBackgroundColor() const;
+ /**
+ * @brief Get the Scene scene graph object
+ *
+ * @return the Scene scene graph object
+ */
+ SceneGraph::Scene* GetSceneObject() const;
+
+ /**
+ * Used by the EventProcessor to emit key event signals.
+ * @param[in] event The key event.
+ */
+ void EmitKeyEventSignal(const Dali::KeyEvent& event);
+
+ /**
+ * Used by the KeyEventProcessor to emit KeyEventGenerated signals.
+ * @param[in] event The key event.
+ * @return The return is true if KeyEvent is consumed, otherwise false.
+ */
+ bool EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event);
+
+ /**
+ * Emits the event processing finished signal.
+ *
+ * @see Dali::Scene::SignalEventProcessingFinished()
+ */
+ void EmitEventProcessingFinishedSignal();
+
+ /**
+ * Emits the touched signal.
+ * @param[in] touch The touch event details.
+ */
+ void EmitTouchedSignal( const Dali::TouchEvent& touch );
+
+ /**
+ * Used by the EventProcessor to emit wheel event signals.
+ * @param[in] event The wheel event.
+ */
+ void EmitWheelEventSignal( const Dali::WheelEvent& event );
+
+ /**
+ * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback
+ */
+ void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+ /**
+ * @copydoc Dali::Integration::Scene::AddFramePresentedCallback
+ */
+ void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+ /**
+ * @copydoc Dali::Integration::Scene::GetFrameRenderedCallback
+ */
+ void GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+
+ /**
+ * @copydoc Dali::Integration::Scene::GetFramePresentedCallback
+ */
+ void GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+
+ /**
+ * @copydoc Integration::Scene::KeyEventSignal()
+ */
+ Integration::Scene::KeyEventSignalType& KeyEventSignal();
+
+ /**
+ * @copydoc Integration::Scene::KeyEventGeneratedSignal()
+ */
+ Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
+ /**
+ * @copydoc Integration::Scene::SignalEventProcessingFinished()
+ */
+ Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
+
+ /**
+ * @copydoc Integration::Scene::TouchedSignal()
+ */
+ Integration::Scene::TouchEventSignalType& TouchedSignal();
+
+ /**
+ * @copydoc Integration::Scene::sWheelEventSignal()
+ */
+ Integration::Scene::WheelEventSignalType& WheelEventSignal();
+
public:
/**
* From RenderTaskDefaults; retrieve the default root actor.
* @return The default root actor.
*/
- virtual Actor& GetDefaultRootActor();
+ Actor& GetDefaultRootActor() override;
/**
* From RenderTaskDefaults; retrieve the default camera actor.
* @return The default camera actor.
*/
- virtual CameraActor& GetDefaultCameraActor();
+ CameraActor& GetDefaultCameraActor() override;
private:
// Constructor
- Scene( Size size );
+ Scene();
/**
* Second-phase constructor.
+ *
+ * @param[in] size The size of the set surface
*/
- void Initialize();
+ void Initialize( Size size );
// Undefined
Scene(const Scene&) = delete;
Scene& operator=(const Scene& rhs) = delete;
private:
+ Internal::SceneGraph::Scene* mSceneObject;
- Integration::RenderSurface* mSurface;
-
- // The scene-size may be different with the surface-size
Size mSize;
- Size mSurfaceSize;
Vector2 mDpi;
+ Vector4 mBackgroundColor;
+
LayerPtr mRootLayer;
// Ordered list of currently on-stage layers
// The list of render-tasks
IntrusivePtr<RenderTaskList> mRenderTaskList;
- // The frame buffer
- FrameBufferPtr mFrameBuffer;
-
bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating
+
+ EventProcessor mEventProcessor;
+
+ // The key event signal
+ Integration::Scene::KeyEventSignalType mKeyEventSignal;
+ Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
+
+ // The event processing finished signal
+ Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
+
+ // The touch signal
+ Integration::Scene::TouchEventSignalType mTouchedSignal;
+
+ // The wheel event signal
+ Integration::Scene::WheelEventSignalType mWheelEventSignal;
};
} // Internal