20f85f206ad9e3ccde632f696ec0a4ac2d18968b
[platform/core/uifw/dali-core.git] / dali / integration-api / scene.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/scene.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/graphics-api/graphics-render-target.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
25
26 // INTERNAL INCLUDES
27 #include <dali/internal/event/common/scene-impl.h>
28
29 namespace Dali
30 {
31 namespace Integration
32 {
33 Scene Scene::New(Size size, int32_t windowOrientation, int32_t screenOrientation)
34 {
35   Internal::ScenePtr internal = Internal::Scene::New(size, windowOrientation, screenOrientation);
36   return Scene(internal.Get());
37 }
38
39 Scene Scene::DownCast(BaseHandle handle)
40 {
41   return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
42 }
43
44 Scene::Scene() = default;
45
46 Scene::~Scene() = default;
47
48 Scene::Scene(const Scene& handle) = default;
49
50 Scene& Scene::operator=(const Scene& rhs) = default;
51
52 Scene::Scene(Scene&& handle) = default;
53
54 Scene& Scene::operator=(Scene&& rhs) = default;
55
56 Scene::Scene(Internal::Scene* internal)
57 : BaseHandle(internal)
58 {
59 }
60
61 void Scene::Add(Actor actor)
62 {
63   GetImplementation(*this).Add(GetImplementation(actor));
64 }
65
66 void Scene::Remove(Actor actor)
67 {
68   GetImplementation(*this).Remove(GetImplementation(actor));
69 }
70
71 Size Scene::GetSize() const
72 {
73   return GetImplementation(*this).GetSize();
74 }
75
76 void Scene::SetDpi(Vector2 dpi)
77 {
78   GetImplementation(*this).SetDpi(dpi);
79 }
80
81 Vector2 Scene::GetDpi() const
82 {
83   return GetImplementation(*this).GetDpi();
84 }
85
86 void Scene::SetBackgroundColor(const Vector4& color)
87 {
88   GetImplementation(*this).SetBackgroundColor(color);
89 }
90
91 Vector4 Scene::GetBackgroundColor() const
92 {
93   return GetImplementation(*this).GetBackgroundColor();
94 }
95
96 RenderTaskList Scene::GetRenderTaskList() const
97 {
98   return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
99 }
100
101 Layer Scene::GetRootLayer() const
102 {
103   return GetImplementation(*this).GetRootLayer();
104 }
105
106 uint32_t Scene::GetLayerCount() const
107 {
108   return GetImplementation(*this).GetLayerCount();
109 }
110
111 Layer Scene::GetLayer(uint32_t depth) const
112 {
113   return GetImplementation(*this).GetLayer(depth);
114 }
115
116 void Scene::SurfaceResized(float width, float height)
117 {
118   GetImplementation(*this).SurfaceResized(width, height);
119 }
120
121 void Scene::SurfaceReplaced()
122 {
123   GetImplementation(*this).SurfaceReplaced();
124 }
125
126 void Scene::Discard()
127 {
128   GetImplementation(*this).Discard();
129 }
130
131 void Scene::SetSurfaceRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo)
132 {
133   GetImplementation(*this).SetSurfaceRenderTarget(renderTargetCreateInfo);
134 }
135
136 Integration::Scene Scene::Get(Actor actor)
137 {
138   return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
139 }
140
141 void Scene::QueueEvent(const Integration::Event& event)
142 {
143   GetImplementation(*this).QueueEvent(event);
144 }
145
146 void Scene::ProcessEvents()
147 {
148   GetImplementation(*this).ProcessEvents();
149 }
150
151 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
152 {
153   GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
154 }
155
156 void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
157 {
158   GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
159 }
160
161 void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
162 {
163   GetImplementation(*this).GetFrameRenderedCallback(callbacks);
164 }
165
166 void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
167 {
168   GetImplementation(*this).GetFramePresentedCallback(callbacks);
169 }
170
171 void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
172 {
173   GetImplementation(*this).SurfaceRotated(width, height, windowOrientation, screenOrientation);
174 }
175
176 int32_t Scene::GetCurrentSurfaceOrientation() const
177 {
178   return GetImplementation(*this).GetCurrentSurfaceOrientation();
179 }
180
181 int32_t Scene::GetCurrentScreenOrientation() const
182 {
183   return GetImplementation(*this).GetCurrentScreenOrientation();
184 }
185
186 const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
187 {
188   return GetImplementation(*this).GetCurrentSurfaceRect();
189 }
190
191 bool Scene::IsSurfaceRectChanged() const
192 {
193   return GetImplementation(*this).IsSurfaceRectChanged();
194 }
195
196 void Scene::SetRotationCompletedAcknowledgement()
197 {
198   GetImplementation(*this).SetRotationCompletedAcknowledgement();
199 }
200
201 bool Scene::IsRotationCompletedAcknowledgementSet() const
202 {
203   return GetImplementation(*this).IsRotationCompletedAcknowledgementSet();
204 }
205
206 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
207 {
208   return GetImplementation(*this).EventProcessingFinishedSignal();
209 }
210
211 Scene::KeyEventSignalType& Scene::KeyEventSignal()
212 {
213   return GetImplementation(*this).KeyEventSignal();
214 }
215
216 Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
217 {
218   return GetImplementation(*this).KeyEventGeneratedSignal();
219 }
220
221 Scene::KeyEventGeneratedSignalType& Scene::InterceptKeyEventSignal()
222 {
223   return GetImplementation(*this).InterceptKeyEventSignal();
224 }
225
226 Scene::TouchEventSignalType& Scene::TouchedSignal()
227 {
228   return GetImplementation(*this).TouchedSignal();
229 }
230
231 Scene::WheelEventSignalType& Scene::WheelEventSignal()
232 {
233   return GetImplementation(*this).WheelEventSignal();
234 }
235
236 Scene::WheelEventGeneratedSignalType& Scene::WheelEventGeneratedSignal()
237 {
238   return GetImplementation(*this).WheelEventGeneratedSignal();
239 }
240
241 } // namespace Integration
242
243 } // namespace Dali