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