2 * Copyright (c) 2020 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.
19 #include <dali/integration-api/scene.h>
22 #include <dali/internal/event/common/scene-impl.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
30 Scene Scene::New(Size size)
32 Internal::ScenePtr internal = Internal::Scene::New(size);
33 return Scene(internal.Get());
36 Scene Scene::DownCast(BaseHandle handle)
38 return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
41 Scene::Scene() = default;
43 Scene::~Scene() = default;
45 Scene::Scene(const Scene& handle) = default;
47 Scene::Scene(Internal::Scene* internal)
48 : BaseHandle(internal)
52 Scene& Scene::operator=(const Scene& rhs) = default;
54 void Scene::Add(Actor actor)
56 GetImplementation(*this).Add(GetImplementation(actor));
59 void Scene::Remove(Actor actor)
61 GetImplementation(*this).Remove(GetImplementation(actor));
64 Size Scene::GetSize() const
66 return GetImplementation(*this).GetSize();
69 void Scene::SetDpi(Vector2 dpi)
71 GetImplementation(*this).SetDpi(dpi);
74 Vector2 Scene::GetDpi() const
76 return GetImplementation(*this).GetDpi();
79 void Scene::SetBackgroundColor(const Vector4& color)
81 GetImplementation(*this).SetBackgroundColor(color);
84 Vector4 Scene::GetBackgroundColor() const
86 return GetImplementation(*this).GetBackgroundColor();
89 RenderTaskList Scene::GetRenderTaskList() const
91 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
94 Layer Scene::GetRootLayer() const
96 return GetImplementation(*this).GetRootLayer();
99 uint32_t Scene::GetLayerCount() const
101 return GetImplementation(*this).GetLayerCount();
104 Layer Scene::GetLayer(uint32_t depth) const
106 return GetImplementation(*this).GetLayer(depth);
109 void Scene::SurfaceResized(float width, float height)
111 GetImplementation(*this).SurfaceResized(width, height);
114 void Scene::SurfaceReplaced()
116 GetImplementation(*this).SurfaceReplaced();
119 void Scene::Discard()
121 GetImplementation(*this).Discard();
124 Integration::Scene Scene::Get(Actor actor)
126 return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
129 void Scene::QueueEvent(const Integration::Event& event)
131 GetImplementation(*this).QueueEvent(event);
134 void Scene::ProcessEvents()
136 GetImplementation(*this).ProcessEvents();
139 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
141 GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
144 void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
146 GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
149 void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
151 GetImplementation(*this).GetFrameRenderedCallback(callbacks);
154 void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
156 GetImplementation(*this).GetFramePresentedCallback(callbacks);
159 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
161 return GetImplementation(*this).EventProcessingFinishedSignal();
164 Scene::KeyEventSignalType& Scene::KeyEventSignal()
166 return GetImplementation(*this).KeyEventSignal();
169 Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
171 return GetImplementation(*this).KeyEventGeneratedSignal();
174 Scene::TouchEventSignalType& Scene::TouchedSignal()
176 return GetImplementation(*this).TouchedSignal();
179 Scene::WheelEventSignalType& Scene::WheelEventSignal()
181 return GetImplementation(*this).WheelEventSignal();
184 } // namespace Integration