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