2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/integration-api/adaptor-framework/scene-holder.h>
19 #include <dali/integration-api/events/touch-event-integ.h>
21 #include <toolkit-scene-holder-impl.h>
23 #include <dali/public-api/actors/actor.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/object/base-object.h>
27 #include <dali/integration-api/adaptor-framework/adaptor.h>
28 #include <dali/public-api/render-tasks/render-task-list.h>
29 #include <toolkit-adaptor-impl.h>
31 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
35 ///////////////////////////////////////////////////////////////////////////////
37 // Dali::Internal::Adaptor::SceneHolder Stub
39 ///////////////////////////////////////////////////////////////////////////////
45 SceneHolder::SceneHolder(const Dali::Rect<int>& positionSize)
46 : mRenderSurface(positionSize),
47 mScene(Dali::Integration::Scene::New(Dali::Size(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height))))
51 SceneHolder::~SceneHolder()
53 if(Dali::Adaptor::IsAvailable())
55 AdaptorImpl::GetImpl(AdaptorImpl::Get()).RemoveWindow(this);
59 void SceneHolder::Add(Dali::Actor actor)
64 void SceneHolder::Remove(Dali::Actor actor)
69 Dali::Layer SceneHolder::GetRootLayer() const
71 return mScene.GetRootLayer();
74 void SceneHolder::SetBackgroundColor(Vector4 color)
76 return mScene.SetBackgroundColor(color);
79 Vector4 SceneHolder::GetBackgroundColor() const
81 return mScene.GetBackgroundColor();
84 void SceneHolder::FeedTouchPoint(Dali::TouchPoint& point, int timeStamp)
88 void SceneHolder::FeedWheelEvent(Dali::WheelEvent& wheelEvent)
92 void SceneHolder::FeedKeyEvent(Dali::KeyEvent& keyEvent)
96 Dali::Integration::SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
98 return mScene.KeyEventSignal();
101 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
103 return mScene.KeyEventGeneratedSignal();
106 Dali::Integration::SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
108 return mScene.TouchedSignal();
111 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
113 return mScene.WheelEventSignal();
116 Dali::Integration::SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal()
118 return mScene.WheelEventGeneratedSignal();
121 Integration::Scene SceneHolder::GetScene()
126 Dali::RenderSurfaceInterface& SceneHolder::GetRenderSurface()
128 return mRenderSurface;
131 Dali::RenderTaskList SceneHolder::GetRenderTaskList()
133 return mScene.GetRenderTaskList();
136 } // namespace Adaptor
138 } // namespace Internal
140 ///////////////////////////////////////////////////////////////////////////////
142 // Dali::Integration::SceneHolder Stub
144 ///////////////////////////////////////////////////////////////////////////////
146 namespace Integration
148 SceneHolder::SceneHolder()
150 // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
153 SceneHolder::~SceneHolder()
157 SceneHolder::SceneHolder(const SceneHolder& handle)
162 SceneHolder::SceneHolder(Internal::Adaptor::SceneHolder* internal)
163 : BaseHandle(internal)
167 SceneHolder& SceneHolder::operator=(const SceneHolder& rhs)
169 BaseHandle::operator=(rhs);
173 Dali::Integration::SceneHolder SceneHolder::Get(Dali::Actor actor)
175 Internal::Adaptor::SceneHolder* sceneHolderImpl = nullptr;
177 if(Dali::Adaptor::IsAvailable())
179 sceneHolderImpl = AdaptorImpl::GetImpl(AdaptorImpl::Get()).GetWindow(actor);
182 return Dali::Integration::SceneHolder(sceneHolderImpl);
185 void SceneHolder::Add(Actor actor)
187 GetImplementation(*this).Add(actor);
190 void SceneHolder::Remove(Actor actor)
192 GetImplementation(*this).Remove(actor);
195 Dali::Layer SceneHolder::GetRootLayer() const
197 return GetImplementation(*this).GetRootLayer();
200 void SceneHolder::SetBackgroundColor(Vector4 color)
202 GetImplementation(*this).SetBackgroundColor(color);
205 Vector4 SceneHolder::GetBackgroundColor() const
207 return GetImplementation(*this).GetBackgroundColor();
210 void SceneHolder::FeedTouchPoint(Dali::TouchPoint& point, int timeStamp)
212 GetImplementation(*this).FeedTouchPoint(point, timeStamp);
215 void SceneHolder::FeedWheelEvent(Dali::WheelEvent& wheelEvent)
217 GetImplementation(*this).FeedWheelEvent(wheelEvent);
220 void SceneHolder::FeedKeyEvent(Dali::KeyEvent& keyEvent)
222 GetImplementation(*this).FeedKeyEvent(keyEvent);
225 RenderTaskList SceneHolder::GetRenderTaskList()
227 return GetImplementation(*this).GetRenderTaskList();
230 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
232 return GetImplementation(*this).KeyEventSignal();
235 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
237 return GetImplementation(*this).KeyEventGeneratedSignal();
240 SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
242 return GetImplementation(*this).TouchedSignal();
245 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
247 return GetImplementation(*this).WheelEventSignal();
250 SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal()
252 return GetImplementation(*this).WheelEventGeneratedSignal();
255 } // namespace Integration