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