X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fadaptor-framework%2Fscene-holder-impl.h;h=8cb30c3226e8fcc7be9a6ae3a211bbc874cdd9b2;hb=6639efb20527a94f0cb5e2660dbb8585c95b07d2;hp=26285261867811b2dca2c650a9de025434a4c788;hpb=cd0d370ba71e3d26d42b5ec47c389d53293ee7a9;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.h b/dali/integration-api/adaptor-framework/scene-holder-impl.h index 2628526..8cb30c3 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H /* - * Copyright (c) 2020 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. @@ -19,16 +19,17 @@ */ // EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include // INTERNAL INCLUDES #include @@ -36,7 +37,6 @@ namespace Dali { - class Any; class Adaptor; class Actor; @@ -47,41 +47,36 @@ class KeyEvent; namespace Integration { - class Scene; struct Point; struct KeyEvent; struct WheelEvent; -} +} // namespace Integration namespace Internal { - namespace Adaptor { - class Adaptor; class SceneHolder; -using SceneHolderPtr = IntrusivePtr< SceneHolder >; +using SceneHolderPtr = IntrusivePtr; /** * @brief SceneHolder creates a Scene for rendering. */ class DALI_ADAPTOR_API SceneHolder : public BaseObject { - public: - /** * @copydoc Dali::Integration::SceneHolder::Add */ - void Add( Dali::Actor actor ); + void Add(Dali::Actor actor); /** * @copydoc Dali::Integration::SceneHolder::Remove */ - void Remove( Dali::Actor actor ); + void Remove(Dali::Actor actor); /** * @copydoc Dali::Integration::SceneHolder::GetRootLayer @@ -89,6 +84,11 @@ public: Dali::Layer GetRootLayer() const; /** + * @copydoc Dali::Integration::SceneHolder::GetOverlayLayer + */ + Dali::Layer GetOverlayLayer(); + + /** * @brief Gets the window name. * @return The name of the window */ @@ -116,12 +116,14 @@ public: * @brief Set the render surface * @param[in] surface The render surface */ - void SetSurface( Dali::RenderSurfaceInterface* surface ); + void SetSurface(Dali::RenderSurfaceInterface* surface); /** * @brief Called when the surface set is resized. + * @param[in] width the resized window's width + * @param[in] height the resized window's height */ - void SurfaceResized(); + void SurfaceResized(float width, float height); /** * @brief Get the render surface @@ -133,12 +135,12 @@ public: * @brief Set the adaptor to the scene holder * @param[in] adaptor An initialized adaptor */ - void SetAdaptor( Dali::Adaptor& adaptor ); + void SetAdaptor(Dali::Adaptor& adaptor); /** * @copydoc Dali::Integration::SceneHolder::SetBackgroundColor */ - void SetBackgroundColor( const Dali::Vector4& color ); + void SetBackgroundColor(const Dali::Vector4& color); /** * @copydoc Dali::Integration::SceneHolder::GetBackgroundColor @@ -160,22 +162,41 @@ public: * * @return true if this scene holder is being deleted in the event thread, or false if not. */ - bool IsBeingDeleted() const { return mIsBeingDeleted; } + bool IsBeingDeleted() const + { + return mIsBeingDeleted; + } + + /** + * @brief Informs the scene that the set surface has been 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 SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation); + + /** + * @brief Send message to acknowledge window rotation with current window orientation. + * It is to send message to render thread for completing window rotation by user. + */ + void SetRotationCompletedAcknowledgement(); /** * @copydoc Dali::Integration::SceneHolder::FeedTouchPoint */ - void FeedTouchPoint( Dali::Integration::Point& point, int timeStamp ); + void FeedTouchPoint(Dali::Integration::Point& point, int timeStamp); /** * @copydoc Dali::Integration::SceneHolder::FeedWheelEvent */ - void FeedWheelEvent( Dali::Integration::WheelEvent& wheelEvent ); + void FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent); /** * @copydoc Dali::Integration::SceneHolder::FeedKeyEvent */ - void FeedKeyEvent( Dali::Integration::KeyEvent& keyEvent ); + void FeedKeyEvent(Dali::Integration::KeyEvent& keyEvent); /** * @brief Adds a callback that is called when the frame rendering is done by the graphics driver. @@ -191,7 +212,7 @@ public: * * @note Ownership of the callback is passed onto this class. */ - void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId ); + void AddFrameRenderedCallback(std::unique_ptr callback, int32_t frameId); /** * @brief Adds a callback that is called when the frame rendering is done by the graphics driver. @@ -207,35 +228,67 @@ public: * * @note Ownership of the callback is passed onto this class. */ - void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId ); + void AddFramePresentedCallback(std::unique_ptr callback, int32_t frameId); + + /** + * @brief Creates the render target for the surface when the surface is created/resized/replaced. + */ + void CreateRenderTarget(); /** * @copydoc Dali::Integration::SceneHolder::Get() */ - static Dali::Integration::SceneHolder Get( Dali::Actor actor ); + static Dali::Integration::SceneHolder Get(Dali::Actor actor); /** * @copydoc Dali::Integration::SceneHolder::KeyEventSignal() */ - Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal() { return mScene.KeyEventSignal(); } + Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal() + { + return mScene.KeyEventSignal(); + } /** * @copydoc Dali::Integration::SceneHolder::KeyEventGeneratedSignal() */ - Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal() { return mScene.KeyEventGeneratedSignal(); } + Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal() + { + return mScene.KeyEventGeneratedSignal(); + } + + /** + * @copydoc Dali::Integration::SceneHolder::InterceptKeyEventSignal() + */ + Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& InterceptKeyEventSignal() + { + return mScene.InterceptKeyEventSignal(); + } /** * @copydoc Dali::Integration::SceneHolder::TouchedSignal() */ - Dali::Integration::SceneHolder::TouchEventSignalType& TouchedSignal() { return mScene.TouchedSignal(); } + Dali::Integration::SceneHolder::TouchEventSignalType& TouchedSignal() + { + return mScene.TouchedSignal(); + } /** * @copydoc Dali::Integration::SceneHolder::WheelEventSignal() */ - Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal() { return mScene.WheelEventSignal(); } + Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal() + { + return mScene.WheelEventSignal(); + } -public: // The following methods can be overridden if required + /** + * @copydoc Dali::Integration::SceneHolder::WheelEventGeneratedSignal() + */ + Dali::Integration::SceneHolder::WheelEventGeneratedSignalType& WheelEventGeneratedSignal() + { + return mScene.WheelEventGeneratedSignal(); + } +public: // The following methods can be overridden if required /** * @brief Returns whether the Scene is visible or not. * @return True if the Scene is visible, false otherwise. @@ -243,14 +296,12 @@ public: // The following methods can be overridden if required virtual bool IsVisible() const; public: // The following methods must be overridden - /** * @copydoc Dali::Integration::SceneHolder::GetNativeHandle */ virtual Dali::Any GetNativeHandle() const = 0; protected: - // Constructor SceneHolder(); @@ -263,40 +314,42 @@ protected: /** * virtual destructor */ - virtual ~SceneHolder(); + ~SceneHolder() override; private: // The following methods can be overridden if required - /** * @brief Called by the base class to inform deriving classes that the adaptor has been set. * @param[in] adaptor The adaptor */ - virtual void OnAdaptorSet( Dali::Adaptor& adaptor ) {}; + virtual void OnAdaptorSet(Dali::Adaptor& adaptor){}; /** * @brief Called by the base class to inform deriving classes that a new surface has been set. * @param[in] surface The new render surface */ - virtual void OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) {}; + virtual void OnSurfaceSet(Dali::RenderSurfaceInterface* surface){}; /** * @brief Called by the base class to inform deriving classes that we are being paused. */ - virtual void OnPause() {}; + virtual void OnPause(){}; /** * @brief Called by the base class to inform deriving classes that we are resuming from a paused state. */ - virtual void OnResume() {}; + virtual void OnResume(){}; /** - * Recalculate the touch position if required - * @param[in,out] point The touch point + * Recalculate the position if required + * @param[in] position The screen position + * @return converted position by oriention */ - virtual void RecalculateTouchPosition( Integration::Point& point ) {}; + virtual Vector2 RecalculatePosition(const Vector2& position) + { + return position; + }; private: - /** * Resets the event handling. */ @@ -308,51 +361,48 @@ private: void InitializeDpi(); private: - - static uint32_t mSceneHolderCounter; ///< A counter to track the SceneHolder creation + static uint32_t mSceneHolderCounter; ///< A counter to track the SceneHolder creation class SceneHolderLifeCycleObserver; - std::unique_ptr< SceneHolderLifeCycleObserver > mLifeCycleObserver; ///< The adaptor life cycle observer + std::unique_ptr mLifeCycleObserver; ///< The adaptor life cycle observer protected: + uint32_t mId; ///< A unique ID to identify the SceneHolder starting from 0 + Dali::Integration::Scene mScene; ///< The Scene + std::string mName; ///< The name of the SceneHolder - uint32_t mId; ///< A unique ID to identify the SceneHolder starting from 0 - Dali::Integration::Scene mScene; ///< The Scene - std::string mName; ///< The name of the SceneHolder - - std::unique_ptr< Dali::RenderSurfaceInterface > mSurface; ///< The window rendering surface - Adaptor* mAdaptor; ///< The adaptor - - Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events. + std::unique_ptr mSurface; ///< The window rendering surface + Adaptor* mAdaptor; ///< The adaptor + Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events. - Uint16Pair mDpi; ///< The DPI for this SceneHolder. + Uint16Pair mDpi; ///< The DPI for this SceneHolder. - std::atomic mIsBeingDeleted; ///< This is set only from the event thread and read only from the render thread + std::atomic mIsBeingDeleted; ///< This is set only from the event thread and read only from the render thread - bool mAdaptorStarted:1; ///< Whether the adaptor has started or not - bool mVisible:1; ///< Whether the scene is visible or not + bool mAdaptorStarted : 1; ///< Whether the adaptor has started or not + bool mVisible : 1; ///< Whether the scene is visible or not }; -} // Adaptor +} // namespace Adaptor -} // Internal +} // namespace Internal // Get impl of handle -inline Internal::Adaptor::SceneHolder& GetImplementation( Dali::Integration::SceneHolder& sceneHolder ) +inline Internal::Adaptor::SceneHolder& GetImplementation(Dali::Integration::SceneHolder& sceneHolder) { - DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" ); + DALI_ASSERT_ALWAYS(sceneHolder && "SceneHolder handle is empty"); Dali::RefObject& object = sceneHolder.GetBaseObject(); - return static_cast( object ); + return static_cast(object); } -inline const Internal::Adaptor::SceneHolder& GetImplementation( const Dali::Integration::SceneHolder& sceneHolder ) +inline const Internal::Adaptor::SceneHolder& GetImplementation(const Dali::Integration::SceneHolder& sceneHolder) { - DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" ); + DALI_ASSERT_ALWAYS(sceneHolder && "SceneHolder handle is empty"); const Dali::RefObject& object = sceneHolder.GetBaseObject(); - return static_cast( object ); + return static_cast(object); } -} // Dali +} // namespace Dali #endif // DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H