Revert "[Tizen] Add OffscreenApplication"
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor.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/adaptor-framework/adaptor.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/object-registry.h>
23 #include <dali/integration-api/debug.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
27 #include <dali/devel-api/adaptor-framework/style-monitor.h>
28 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
29 #include <dali/integration-api/adaptor-framework/scene-holder.h>
30 #include <dali/internal/adaptor/common/adaptor-impl.h>
31 #include <dali/internal/window-system/common/window-impl.h>
32
33 namespace Dali
34 {
35
36 Adaptor& Adaptor::New( Window window )
37 {
38   Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
39   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), NULL );
40   return *adaptor;
41 }
42
43 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
44 {
45   Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
46   Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
47   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, NULL );
48   return *adaptor;
49 }
50
51 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
52 {
53   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, NULL );
54   return *adaptor;
55 }
56
57 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
58 {
59   Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
60   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, NULL );
61   return *adaptor;
62 }
63
64 Adaptor::~Adaptor()
65 {
66   delete mImpl;
67 }
68
69 void Adaptor::Start()
70 {
71   mImpl->Start();
72 }
73
74 void Adaptor::Pause()
75 {
76   mImpl->Pause();
77 }
78
79 void Adaptor::Resume()
80 {
81   mImpl->Resume();
82 }
83
84 void Adaptor::Stop()
85 {
86   mImpl->Stop();
87 }
88
89 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
90 {
91   DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
92   return mImpl->AddIdle( callback, hasReturnValue, false );
93 }
94
95 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow )
96 {
97   DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
98   return mImpl->AddWindow( childWindow );
99 }
100
101 void Adaptor::RemoveIdle( CallbackBase* callback )
102 {
103   DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
104   mImpl->RemoveIdle( callback );
105 }
106
107 void Adaptor::ProcessIdle()
108 {
109   DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
110   mImpl->ProcessIdle();
111 }
112
113 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
114 {
115   Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
116   mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
117 }
118
119 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
120 {
121   mImpl->ReplaceSurface( window, surface );
122 }
123
124 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
125 {
126   return mImpl->ResizedSignal();
127 }
128
129 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
130 {
131   return mImpl->LanguageChangedSignal();
132 }
133
134 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
135 {
136   return mImpl->WindowCreatedSignal();
137 }
138
139 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
140 {
141   return mImpl->GetSurface();
142 }
143
144 Any Adaptor::GetNativeWindowHandle()
145 {
146   return mImpl->GetNativeWindowHandle();
147 }
148
149 Any Adaptor::GetNativeWindowHandle( Actor actor )
150 {
151   return mImpl->GetNativeWindowHandle( actor );
152 }
153
154 Any Adaptor::GetGraphicsDisplay()
155 {
156   return mImpl->GetGraphicsDisplay();
157 }
158
159 void Adaptor::ReleaseSurfaceLock()
160 {
161   mImpl->ReleaseSurfaceLock();
162 }
163
164 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
165 {
166   mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
167 }
168
169 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
170 {
171   mImpl->SetPreRenderCallback( callback );
172 }
173
174 Adaptor& Adaptor::Get()
175 {
176   return Internal::Adaptor::Adaptor::Get();
177 }
178
179 bool Adaptor::IsAvailable()
180 {
181   return Internal::Adaptor::Adaptor::IsAvailable();
182 }
183
184 void Adaptor::NotifySceneCreated()
185 {
186   mImpl->NotifySceneCreated();
187 }
188
189 void Adaptor::NotifyLanguageChanged()
190 {
191   mImpl->NotifyLanguageChanged();
192 }
193
194 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
195 {
196   mImpl->FeedTouchPoint(point, timeStamp);
197 }
198
199 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
200 {
201   mImpl->FeedWheelEvent(wheelEvent);
202 }
203
204 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
205 {
206   mImpl->FeedKeyEvent(keyEvent);
207 }
208
209 void Adaptor::SceneCreated()
210 {
211   mImpl->SceneCreated();
212 }
213
214 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
215 {
216   mImpl->SurfaceResizePrepare( surface, surfaceSize );
217 }
218
219 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
220 {
221   mImpl->SurfaceResizeComplete( surface, surfaceSize );
222 }
223
224 void Adaptor::RenderOnce()
225 {
226   mImpl->RenderOnce();
227 }
228
229 const LogFactoryInterface& Adaptor::GetLogFactory()
230 {
231   return mImpl->GetLogFactory();
232 }
233
234 void Adaptor::RegisterProcessor( Integration::Processor& processor )
235 {
236   mImpl->RegisterProcessor( processor );
237 }
238
239 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
240 {
241   mImpl->UnregisterProcessor( processor );
242 }
243
244 Dali::WindowContainer Adaptor::GetWindows() const
245 {
246   return mImpl->GetWindows();
247 }
248
249 SceneHolderList Adaptor::GetSceneHolders() const
250 {
251   return mImpl->GetSceneHolders();
252 }
253
254 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
255 {
256   return mImpl->GetObjectRegistry();
257 }
258
259 void Adaptor::OnWindowShown()
260 {
261   mImpl->OnWindowShown();
262 }
263
264 void Adaptor::OnWindowHidden()
265 {
266   mImpl->OnWindowHidden();
267 }
268
269 Adaptor::Adaptor()
270 : mImpl( NULL )
271 {
272 }
273
274 } // namespace Dali