*/
// EXTERNAL INCLUDES
-#include <memory>
-#include <vector>
-#include <atomic>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/math/uint-16-pair.h>
-#include <dali/integration-api/scene.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/point.h>
#include <dali/integration-api/events/touch-event-combiner.h>
+#include <dali/integration-api/scene.h>
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/public-api/object/base-object.h>
+#include <atomic>
+#include <memory>
+#include <vector>
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
namespace Dali
{
-
class Any;
class Adaptor;
class Actor;
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<SceneHolder>;
/**
* @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
* @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 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
*
* @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.
*
* @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<CallbackBase> callback, int32_t frameId);
/**
* @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
*
* @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<CallbackBase> 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.
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();
/**
* 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.
*/
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<SceneHolderLifeCycleObserver> 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<Dali::RenderSurfaceInterface> 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<bool> mIsBeingDeleted; ///< This is set only from the event thread and read only from the render thread
+ std::atomic<bool> 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<Internal::Adaptor::SceneHolder&>( object );
+ return static_cast<Internal::Adaptor::SceneHolder&>(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<const Internal::Adaptor::SceneHolder&>( object );
+ return static_cast<const Internal::Adaptor::SceneHolder&>(object);
}
-} // Dali
+} // namespace Dali
#endif // DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H