2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/integration-api/adaptor-framework/adaptor.h>
22 #include <dali/public-api/object/object-registry.h>
23 #include <dali/integration-api/debug.h>
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>
36 Adaptor& Adaptor::New( Window window )
38 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
41 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
43 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
44 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
48 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
50 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
53 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
55 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
56 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
57 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, configuration, NULL );
61 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
63 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
66 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
68 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
72 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
74 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
77 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
79 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
80 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
99 void Adaptor::Resume()
109 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
111 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
112 return mImpl->AddIdle( callback, hasReturnValue, false );
115 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
117 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
118 return mImpl->AddWindow( childWindow, childWindowName, childWindowClassName, childWindowMode );
121 void Adaptor::RemoveIdle( CallbackBase* callback )
123 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
124 mImpl->RemoveIdle( callback );
127 void Adaptor::ProcessIdle()
129 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
130 mImpl->ProcessIdle();
133 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
135 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
136 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
139 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
141 mImpl->ReplaceSurface( window, surface );
144 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
146 return mImpl->ResizedSignal();
149 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
151 return mImpl->LanguageChangedSignal();
154 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
156 return mImpl->WindowCreatedSignal();
159 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
161 return mImpl->GetSurface();
164 Any Adaptor::GetNativeWindowHandle()
166 return mImpl->GetNativeWindowHandle();
169 Any Adaptor::GetNativeWindowHandle( Actor actor )
171 return mImpl->GetNativeWindowHandle( actor );
174 Any Adaptor::GetGraphicsDisplay()
176 return mImpl->GetGraphicsDisplay();
179 void Adaptor::ReleaseSurfaceLock()
181 mImpl->ReleaseSurfaceLock();
184 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
186 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
189 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
191 mImpl->SetPreRenderCallback( callback );
194 Adaptor& Adaptor::Get()
196 return Internal::Adaptor::Adaptor::Get();
199 bool Adaptor::IsAvailable()
201 return Internal::Adaptor::Adaptor::IsAvailable();
204 void Adaptor::NotifySceneCreated()
206 mImpl->NotifySceneCreated();
209 void Adaptor::NotifyLanguageChanged()
211 mImpl->NotifyLanguageChanged();
214 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
216 mImpl->FeedTouchPoint(point, timeStamp);
219 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
221 mImpl->FeedWheelEvent(wheelEvent);
224 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
226 mImpl->FeedKeyEvent(keyEvent);
229 void Adaptor::SceneCreated()
231 mImpl->SceneCreated();
234 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
236 mImpl->SurfaceResizePrepare( surface, surfaceSize );
239 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
241 mImpl->SurfaceResizeComplete( surface, surfaceSize );
244 void Adaptor::RenderOnce()
249 const LogFactoryInterface& Adaptor::GetLogFactory()
251 return mImpl->GetLogFactory();
254 void Adaptor::RegisterProcessor( Integration::Processor& processor )
256 mImpl->RegisterProcessor( processor );
259 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
261 mImpl->UnregisterProcessor( processor );
264 Dali::WindowContainer Adaptor::GetWindows() const
266 return mImpl->GetWindows();
269 SceneHolderList Adaptor::GetSceneHolders() const
271 return mImpl->GetSceneHolders();
274 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
276 return mImpl->GetObjectRegistry();
279 void Adaptor::OnWindowShown()
281 mImpl->OnWindowShown();
284 void Adaptor::OnWindowHidden()
286 mImpl->OnWindowHidden();