Support screen and client rotation
[platform/core/uifw/dali-core.git] / dali / integration-api / scene.cpp
1 /*
2  * Copyright (c) 2020 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 // INTERNAL INCLUDES
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>
25
26 namespace Dali
27 {
28 namespace Integration
29 {
30 Scene Scene::New(Size size, int orientation)
31 {
32   Internal::ScenePtr internal = Internal::Scene::New(size, orientation);
33   return Scene(internal.Get());
34 }
35
36 Scene Scene::DownCast(BaseHandle handle)
37 {
38   return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
39 }
40
41 Scene::Scene() = default;
42
43 Scene::~Scene() = default;
44
45 Scene::Scene(const Scene& handle) = default;
46
47 Scene::Scene(Internal::Scene* internal)
48 : BaseHandle(internal)
49 {
50 }
51
52 Scene& Scene::operator=(const Scene& rhs) = default;
53
54 void Scene::Add(Actor actor)
55 {
56   GetImplementation(*this).Add(GetImplementation(actor));
57 }
58
59 void Scene::Remove(Actor actor)
60 {
61   GetImplementation(*this).Remove(GetImplementation(actor));
62 }
63
64 Size Scene::GetSize() const
65 {
66   return GetImplementation(*this).GetSize();
67 }
68
69 void Scene::SetDpi(Vector2 dpi)
70 {
71   GetImplementation(*this).SetDpi(dpi);
72 }
73
74 Vector2 Scene::GetDpi() const
75 {
76   return GetImplementation(*this).GetDpi();
77 }
78
79 void Scene::SetBackgroundColor(const Vector4& color)
80 {
81   GetImplementation(*this).SetBackgroundColor(color);
82 }
83
84 Vector4 Scene::GetBackgroundColor() const
85 {
86   return GetImplementation(*this).GetBackgroundColor();
87 }
88
89 RenderTaskList Scene::GetRenderTaskList() const
90 {
91   return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
92 }
93
94 Layer Scene::GetRootLayer() const
95 {
96   return GetImplementation(*this).GetRootLayer();
97 }
98
99 uint32_t Scene::GetLayerCount() const
100 {
101   return GetImplementation(*this).GetLayerCount();
102 }
103
104 Layer Scene::GetLayer(uint32_t depth) const
105 {
106   return GetImplementation(*this).GetLayer(depth);
107 }
108
109 void Scene::SurfaceResized(float width, float height)
110 {
111   GetImplementation(*this).SurfaceResized(width, height);
112 }
113
114 void Scene::SurfaceReplaced()
115 {
116   GetImplementation(*this).SurfaceReplaced();
117 }
118
119 void Scene::Discard()
120 {
121   GetImplementation(*this).Discard();
122 }
123
124 Integration::Scene Scene::Get(Actor actor)
125 {
126   return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
127 }
128
129 void Scene::QueueEvent(const Integration::Event& event)
130 {
131   GetImplementation(*this).QueueEvent(event);
132 }
133
134 void Scene::ProcessEvents()
135 {
136   GetImplementation(*this).ProcessEvents();
137 }
138
139 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
140 {
141   GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
142 }
143
144 void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
145 {
146   GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
147 }
148
149 void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
150 {
151   GetImplementation(*this).GetFrameRenderedCallback(callbacks);
152 }
153
154 void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
155 {
156   GetImplementation(*this).GetFramePresentedCallback(callbacks);
157 }
158
159 void Scene::SurfaceRotated(float width, float height, int orientation)
160 {
161   GetImplementation(*this).SurfaceRotated(width, height, orientation);
162 }
163
164 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
165 {
166   return GetImplementation(*this).EventProcessingFinishedSignal();
167 }
168
169 Scene::KeyEventSignalType& Scene::KeyEventSignal()
170 {
171   return GetImplementation(*this).KeyEventSignal();
172 }
173
174 Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
175 {
176   return GetImplementation(*this).KeyEventGeneratedSignal();
177 }
178
179 Scene::TouchEventSignalType& Scene::TouchedSignal()
180 {
181   return GetImplementation(*this).TouchedSignal();
182 }
183
184 Scene::WheelEventSignalType& Scene::WheelEventSignal()
185 {
186   return GetImplementation(*this).WheelEventSignal();
187 }
188
189 } // namespace Integration
190
191 } // namespace Dali