#define DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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/integration-api/adaptor-framework/render-surface-interface.h>
-
#include <dali/integration-api/scene.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/object/base-object.h>
+#include "test-render-surface.h"
-namespace Dali
-{
+#include <dali/public-api/events/hover-event.h>
+#include <dali/public-api/events/touch-event.h>
-class TestRenderSurface : public Dali::RenderSurfaceInterface
+namespace Dali
{
-public:
-
- TestRenderSurface( PositionSize positionSize ) : mPositionSize(positionSize) {};
-
- PositionSize GetPositionSize() const override { return mPositionSize; };
-
- virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
-
- void InitializeGraphics() override {};
-
- void CreateSurface() override {};
-
- void DestroySurface() override {};
-
- bool ReplaceGraphicsSurface() override { return false; };
-
- void MoveResize( Dali::PositionSize positionSize ) override { mPositionSize = positionSize; };
-
- void StartRender() override {};
-
- bool PreRender( bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect ) override { return false; };
-
- void PostRender()
- {
- }
-
- //void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects ) override {};
-
- void StopRender() override {};
-
- void ReleaseLock() override {};
-
- void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override {};
-
- RenderSurfaceInterface::Type GetSurfaceType() override { return RenderSurfaceInterface::WINDOW_RENDER_SURFACE; };
-
- void MakeContextCurrent() override {};
-
- Integration::DepthBufferAvailable GetDepthBufferRequired() override { return Integration::DepthBufferAvailable::FALSE; };
-
- Integration::StencilBufferAvailable GetStencilBufferRequired() override { return Integration::StencilBufferAvailable::FALSE; };
-
- int GetOrientation() const override {return 0;};
-
- void SetBackgroundColor( Vector4 color ) {};
-
- Vector4 GetBackgroundColor() { return Color::WHITE; };
-
-private:
- PositionSize mPositionSize;
-};
-
namespace Internal
{
-
namespace Adaptor
{
-
class SceneHolder : public Dali::BaseObject
{
public:
-
- SceneHolder( const Dali::Rect<int>& positionSize );
+ SceneHolder(const Dali::Rect<int>& positionSize);
virtual ~SceneHolder();
- void Add( Dali::Actor actor );
+ void Add(Dali::Actor actor);
- void Remove( Dali::Actor actor );
+ void Remove(Dali::Actor actor);
Dali::Layer GetRootLayer() const;
- void SetBackgroundColor( Vector4 color );
+ void SetBackgroundColor(Vector4 color);
Vector4 GetBackgroundColor() const;
- void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
+ void FeedTouchPoint(Dali::TouchPoint& point, int timeStamp);
- void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
+ void FeedWheelEvent(Dali::WheelEvent& wheelEvent);
- void FeedKeyEvent( Dali::KeyEvent& keyEvent );
+ void FeedKeyEvent(Dali::KeyEvent& keyEvent);
Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal();
Integration::Scene GetScene();
- Dali::RenderSurfaceInterface& GetRenderSurface();
+ Dali::Integration::RenderSurfaceInterface& GetRenderSurface();
+
+ Dali::RenderTaskList GetRenderTaskList();
+
+ class SceneHolderLifeCycleObserver;
+ std::unique_ptr<SceneHolderLifeCycleObserver> mLifeCycleObserver; ///< The adaptor life cycle observer
+ Dali::TouchEvent mLastTouchEvent;
+ Dali::HoverEvent mLastHoverEvent;
-protected:
+ uint32_t mId; ///< A unique ID to identify the SceneHolder starting from 0
+ Dali::Integration::Scene mScene{nullptr}; ///< The Scene
+ std::string mName; ///< The name of the SceneHolder
- TestRenderSurface mRenderSurface;
- Integration::Scene mScene;
+ TestRenderSurface* mRenderSurface;
};
} // namespace Adaptor
} // namespace Internal
-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");
BaseObject& 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 BaseObject& object = sceneHolder.GetBaseObject();
- return static_cast<const Internal::Adaptor::SceneHolder&>( object );
+ return static_cast<const Internal::Adaptor::SceneHolder&>(object);
}
} // namespace Dali