1 #ifndef DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
2 #define DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
23 #include <dali/integration-api/scene.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/object/base-object.h>
30 class TestRenderSurface : public Dali::RenderSurfaceInterface
34 TestRenderSurface( PositionSize positionSize ) {};
36 PositionSize GetPositionSize() const override { PositionSize size; return size; };
38 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
40 void InitializeGraphics() override {};
42 void CreateSurface() override {};
44 void DestroySurface() override {};
46 bool ReplaceGraphicsSurface() override { return false; };
48 void MoveResize( Dali::PositionSize positionSize ) override {};
50 void StartRender() override {};
52 bool PreRender( bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect ) override { return false; };
54 void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects ) override {};
56 void StopRender() override {};
58 void ReleaseLock() override {};
60 void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override {};
62 RenderSurfaceInterface::Type GetSurfaceType() override { return RenderSurfaceInterface::WINDOW_RENDER_SURFACE; };
64 void MakeContextCurrent() override {};
66 Integration::DepthBufferAvailable GetDepthBufferRequired() override { return Integration::DepthBufferAvailable::FALSE; };
68 Integration::StencilBufferAvailable GetStencilBufferRequired() override { return Integration::StencilBufferAvailable::FALSE; };
70 int GetOrientation() const override {return 0;};
72 void SetBackgroundColor( Vector4 color ) {};
74 Vector4 GetBackgroundColor() { return Color::WHITE; };
83 class SceneHolder : public Dali::BaseObject
87 SceneHolder( const Dali::Rect<int>& positionSize );
89 virtual ~SceneHolder();
91 void Add( Dali::Actor actor );
93 void Remove( Dali::Actor actor );
95 Dali::Layer GetRootLayer() const;
97 void SetBackgroundColor( Vector4 color );
99 Vector4 GetBackgroundColor() const;
101 void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
103 void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
105 void FeedKeyEvent( Dali::KeyEvent& keyEvent );
107 Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal();
109 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
111 Dali::Integration::SceneHolder::TouchEventSignalType& TouchedSignal();
113 Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal();
115 Integration::Scene GetScene();
117 Dali::RenderSurfaceInterface& GetRenderSurface();
121 TestRenderSurface mRenderSurface;
122 Integration::Scene mScene;
125 } // namespace Adaptor
127 } // namespace Internal
129 inline Internal::Adaptor::SceneHolder& GetImplementation( Dali::Integration::SceneHolder& sceneHolder )
131 DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
132 BaseObject& object = sceneHolder.GetBaseObject();
133 return static_cast<Internal::Adaptor::SceneHolder&>( object );
136 inline const Internal::Adaptor::SceneHolder& GetImplementation( const Dali::Integration::SceneHolder& sceneHolder )
138 DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
139 const BaseObject& object = sceneHolder.GetBaseObject();
140 return static_cast<const Internal::Adaptor::SceneHolder&>( object );
145 #endif // DALI_TOOLKIT_SCENE_HOLDER_IMPL_H