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