X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fadaptor-framework%2Fscene-holder-impl.h;h=2b5ba2f4ced5bc5e68e48050bf24fa6b8b79cb57;hb=fe649671feabf0fd2f09fdfab62e3b2bf52f89ff;hp=9b14bfc36c19c7a379122321d894847c93f57d87;hpb=ab6276d5a0686fbbcbd559a992819ee5a8695876;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 9b14bfc..2b5ba2f 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -19,16 +19,16 @@ */ // EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include +#include +#include +#include // INTERNAL INCLUDES #include @@ -36,52 +36,46 @@ namespace Dali { - class Any; class Adaptor; class Actor; class Layer; +class WheelEvent; struct TouchPoint; -struct WheelEvent; -struct KeyEvent; +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 @@ -116,12 +110,13 @@ 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. + * @brief Called when the surface is resized. + * @param[in] forceUpdate The flag to update force */ - void SurfaceResized(); + void SurfaceResized( bool forceUpdate ); /** * @brief Get the render surface @@ -133,12 +128,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 +155,25 @@ 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; + } /** * @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 +189,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 +205,46 @@ 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); /** * @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::TouchSignal() + * @copydoc Dali::Integration::SceneHolder::TouchedSignal() */ - Dali::Integration::SceneHolder::TouchSignalType& TouchSignal() { return mScene.TouchSignal(); } + 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 - /** * @brief Returns whether the Scene is visible or not. * @return True if the Scene is visible, false otherwise. @@ -243,14 +252,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 +270,38 @@ 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 */ - virtual void RecalculateTouchPosition( Integration::Point& point ) {}; + virtual void RecalculateTouchPosition(Integration::Point& point){}; private: - /** * Resets the event handling. */ @@ -308,51 +313,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