X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fscene-impl.h;h=cda29a234bcd719f5c00726dce0e1cceb0fc1465;hb=eacc080fe975c523d722dd17c044652317ddd6e8;hp=b94175ac5c74f3d80c411f1044fa335f1942cec8;hpb=9782dbc189818145d565164c78c09269348c0e77;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/scene-impl.h b/dali/internal/event/common/scene-impl.h index b94175a..cda29a2 100644 --- a/dali/internal/event/common/scene-impl.h +++ b/dali/internal/event/common/scene-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -20,27 +20,28 @@ // INTERNAL INCLUDES #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include namespace Dali { - namespace Integration { - -class Event; +struct Event; } namespace Internal { +namespace SceneGraph +{ +class Scene; +} // namespace SceneGraph class EventProcessor; class Layer; @@ -50,24 +51,23 @@ class RenderTaskList; class FrameBuffer; using FrameBufferPtr = IntrusivePtr; -using ScenePtr = IntrusivePtr; +using ScenePtr = IntrusivePtr; /** * @brief Scene creates a "world" that can be bound to a surface for rendering. */ class Scene : public BaseObject, public RenderTaskDefaults { - public: /** * @copydoc Dali::Integration::Scene::New */ - static ScenePtr New( const Size& size ); + static ScenePtr New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0); /** * virtual destructor */ - virtual ~Scene(); + ~Scene() override; /** * @copydoc Dali::Integration::Scene::Add @@ -87,7 +87,7 @@ public: /** * @copydoc Dali::Integration::Scene::SetDpi */ - void SetDpi( Vector2 dpi ); + void SetDpi(Vector2 dpi); /** * @copydoc Dali::Integration::Scene::GetDpi @@ -105,6 +105,11 @@ public: Dali::Layer GetRootLayer() const; /** + * @copydoc Dali::Integration::Scene::GetOverlayLayer + */ + Dali::Layer GetOverlayLayer(); + + /** * @copydoc Dali::Integration::Scene::GetLayerCount */ uint32_t GetLayerCount() const; @@ -115,20 +120,22 @@ public: 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); /** - * @copydoc Dali::Integration::Scene::Discard + * @copydoc Dali::Integration::Scene::SurfaceReplaced */ - void Discard(); + void SurfaceReplaced(); /** - * Retrieve the render surface the scene is binded to. - * @return The render surface. + * @copydoc Dali::Integration::Scene::Discard */ - Integration::RenderSurface* GetSurface() const; + void Discard(); /** * Retrieve the ordered list of on-scene layers. @@ -145,7 +152,7 @@ public: * This function is called when an event is queued. * @param[in] event A event to queue. */ - void QueueEvent( const Integration::Event& event ); + void QueueEvent(const Integration::Event& event); /** * This function is called by Core when events are processed. @@ -159,10 +166,10 @@ public: 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. @@ -171,10 +178,78 @@ public: Vector4 GetBackgroundColor() const; /** + * @brief Get the Scene scene graph object + * + * @return the Scene scene graph object + */ + SceneGraph::Scene* GetSceneObject() const; + + /** + * Notify the surface has been rotated. + * When the device is rotated or the rotation event is received by display manager, + * this function will be called by window implementation. + * + * @param[in] width The width of rotated surface + * @param[in] height The height of rotated surface + * @param[in] windowOrientation the current window orientation + * @param[in] screenOrientation the current screen orientation + */ + void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation); + + /** + * @copydoc Dali::Integration::Scene::SetRotationCompletedAcknowledgement + */ + void SetRotationCompletedAcknowledgement(); + + /** + * @copydoc Dali::Integration::Scene::IsRotationCompletedAcknowledgementSet + */ + bool IsRotationCompletedAcknowledgementSet() const; + + /** + * @copydoc Dali::Integration::Scene::GetCurrentSurfaceOrientation + */ + int32_t GetCurrentSurfaceOrientation() const; + + /** + * @copydoc Dali::Integration::Scene::GetCurrentScreenOrientation + */ + int32_t GetCurrentScreenOrientation() const; + + /** + * @copydoc Dali::Integration::Scene::GetCurrentSurfaceRect + */ + const Rect& GetCurrentSurfaceRect() const; + + /** + * @copydoc Dali::Integration::Scene::IsSurfaceRectChanged + */ + bool IsSurfaceRectChanged() const; + + /** + * @copydoc Dali::Integration::Scene::SetSurfaceRenderTarget + */ + void SetSurfaceRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo); + + /** * Used by the EventProcessor to emit key event signals. * @param[in] event The key event. */ - void EmitKeyEventSignal(const KeyEvent& 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); + + /** + * Used by the KeyEventProcessor to emit InterceptKeyEventSignal signals. + * @param[in] event The key event. + * @return The return is true if KeyEvent is consumed, otherwise false. + */ + bool EmitInterceptKeyEventSignal(const Dali::KeyEvent& event); /** * Emits the event processing finished signal. @@ -185,16 +260,42 @@ public: /** * 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 ); + void EmitTouchedSignal(const Dali::TouchEvent& touch); /** * Used by the EventProcessor to emit wheel event signals. * @param[in] event The wheel event. */ - void EmitWheelEventSignal( const WheelEvent& event ); + void EmitWheelEventSignal(const Dali::WheelEvent& event); + + /** + * Used by the WheelEventProcessor to emit WheelEventGenerated signals. + * @param[in] event The wheel event. + * @return The return is true if WheelEvent is consumed, otherwise false. + */ + bool EmitWheelEventGeneratedSignal(const Dali::WheelEvent& event); + + /** + * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback + */ + void AddFrameRenderedCallback(std::unique_ptr callback, int32_t frameId); + + /** + * @copydoc Dali::Integration::Scene::AddFramePresentedCallback + */ + void AddFramePresentedCallback(std::unique_ptr 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() @@ -202,51 +303,60 @@ public: Integration::Scene::KeyEventSignalType& KeyEventSignal(); /** - * @copydoc Integration::Scene::SignalEventProcessingFinished() + * @copydoc Integration::Scene::KeyEventGeneratedSignal() */ - Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); + Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal(); - // The touched signal, to support Stage touched signal, will be removed when deprecated in public Stage API - using TouchedSignalType = Signal< void (const TouchEvent&) >; + /** + * @copydoc Integration::Scene::InterceptKeyEventSignal() + */ + Integration::Scene::KeyEventGeneratedSignalType& InterceptKeyEventSignal(); /** - * Touched signal to support deprecated stage touched signal. + * @copydoc Integration::Scene::SignalEventProcessingFinished() */ - TouchedSignalType& TouchedSignal(); + Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); /** - * @copydoc Integration::Scene::TouchSignal() + * @copydoc Integration::Scene::TouchedSignal() */ - Integration::Scene::TouchSignalType& TouchSignal(); + Integration::Scene::TouchEventSignalType& TouchedSignal(); /** * @copydoc Integration::Scene::sWheelEventSignal() */ Integration::Scene::WheelEventSignalType& WheelEventSignal(); -public: + /** + * @copydoc Integration::Scene::WheelEventGeneratedSignal() + */ + Integration::Scene::WheelEventGeneratedSignalType& WheelEventGeneratedSignal(); +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() const override; private: - // Constructor - Scene( const Size& size ); + Scene(); /** * Second-phase constructor. + * + * @param[in] size The size of the set surface + * @param[in] windowOrientation The rotated angle of the set surface for this scene + * @param[in] screenOrientation The rotated angle of the screen */ - void Initialize(); + void Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation); // Undefined Scene(const Scene&) = delete; @@ -254,17 +364,29 @@ private: // Undefined Scene& operator=(const Scene& rhs) = delete; + /** + * Informs the scene that the set surface has been resized or rotated. + * + * @param[in] width The width of rotated surface + * @param[in] height The height of rotated surface + * @param[in] windowOrientation the current window orientation + * @param[in] screenOrientation the current screen orientation + */ + void ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation); + private: - Integration::RenderSurface* mSurface; + Internal::SceneGraph::Scene* mSceneObject; - // The scene-size may be different with the surface-size Size mSize; - Size mSurfaceSize; Vector2 mDpi; + Vector4 mBackgroundColor; + LayerPtr mRootLayer; + LayerPtr mOverlayLayer; + // Ordered list of currently on-stage layers OwnerPointer mLayerList; @@ -273,46 +395,49 @@ private: // The list of render-tasks IntrusivePtr mRenderTaskList; - // The frame buffer - FrameBufferPtr mFrameBuffer; - - bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating + bool mDepthTreeDirty : 1; ///< True if the depth tree needs recalculating EventProcessor mEventProcessor; + // The Surface's orientation + int32_t mSurfaceOrientation; + + // The Screen's orientation + int32_t mScreenOrientation; + // The key event signal - Integration::Scene::KeyEventSignalType mKeyEventSignal; + Integration::Scene::KeyEventSignalType mKeyEventSignal; + Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal; + Integration::Scene::KeyEventGeneratedSignalType mInterceptKeyEventSignal; // The event processing finished signal Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal; // The touch signal - Integration::Scene::TouchSignalType mTouchSignal; - - // The touched signal - TouchedSignalType mTouchedSignal; + Integration::Scene::TouchEventSignalType mTouchedSignal; // The wheel event signal - Integration::Scene::WheelEventSignalType mWheelEventSignal; + Integration::Scene::WheelEventSignalType mWheelEventSignal; + Integration::Scene::WheelEventGeneratedSignalType mWheelEventGeneratedSignal; }; -} // Internal +} // namespace Internal // Get impl of handle inline Internal::Scene& GetImplementation(Dali::Integration::Scene& scene) { - DALI_ASSERT_ALWAYS( scene && "Scene handle is empty" ); + DALI_ASSERT_ALWAYS(scene && "Scene handle is empty"); Dali::RefObject& object = scene.GetBaseObject(); return static_cast(object); } inline const Internal::Scene& GetImplementation(const Dali::Integration::Scene& scene) { - DALI_ASSERT_ALWAYS( scene && "Scene handle is empty" ); + DALI_ASSERT_ALWAYS(scene && "Scene handle is empty"); const Dali::RefObject& object = scene.GetBaseObject(); return static_cast(object); } -} // Dali +} // namespace Dali #endif // DALI_INTERNAL_SCENE_H