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/integration-api/debug.h>
25 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
26 #include <dali/devel-api/adaptor-framework/style-monitor.h>
27 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
28 #include <dali/integration-api/adaptor-framework/scene-holder.h>
29 #include <dali/internal/adaptor/common/adaptor-impl.h>
30 #include <dali/internal/window-system/common/window-impl.h>
35 Adaptor& Adaptor::New( Window window )
37 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
40 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
42 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
43 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
47 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
49 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
52 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
54 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
55 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
56 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, configuration, NULL );
60 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
62 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
65 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
67 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
71 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
73 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
76 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
78 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
79 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
98 void Adaptor::Resume()
108 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
110 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
111 return mImpl->AddIdle( callback, hasReturnValue, false );
114 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
116 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
117 return mImpl->AddWindow( childWindow, childWindowName, childWindowClassName, childWindowMode );
120 void Adaptor::RemoveIdle( CallbackBase* callback )
122 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
123 mImpl->RemoveIdle( callback );
126 void Adaptor::ProcessIdle()
128 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
129 mImpl->ProcessIdle();
132 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
134 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
135 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
138 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
140 mImpl->ReplaceSurface( window, surface );
143 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
145 return mImpl->ResizedSignal();
148 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
150 return mImpl->LanguageChangedSignal();
153 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
155 return mImpl->WindowCreatedSignal();
158 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
160 return mImpl->GetSurface();
163 Any Adaptor::GetNativeWindowHandle()
165 return mImpl->GetNativeWindowHandle();
168 Any Adaptor::GetNativeWindowHandle( Actor actor )
170 return mImpl->GetNativeWindowHandle( actor );
173 Any Adaptor::GetGraphicsDisplay()
175 return mImpl->GetGraphicsDisplay();
178 void Adaptor::ReleaseSurfaceLock()
180 mImpl->ReleaseSurfaceLock();
183 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
185 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
188 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
190 mImpl->SetPreRenderCallback( callback );
193 Adaptor& Adaptor::Get()
195 return Internal::Adaptor::Adaptor::Get();
198 bool Adaptor::IsAvailable()
200 return Internal::Adaptor::Adaptor::IsAvailable();
203 void Adaptor::NotifySceneCreated()
205 mImpl->NotifySceneCreated();
208 void Adaptor::NotifyLanguageChanged()
210 mImpl->NotifyLanguageChanged();
213 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
215 mImpl->FeedTouchPoint(point, timeStamp);
218 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
220 mImpl->FeedWheelEvent(wheelEvent);
223 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
225 mImpl->FeedKeyEvent(keyEvent);
228 void Adaptor::SceneCreated()
230 mImpl->SceneCreated();
233 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
235 mImpl->SurfaceResizePrepare( surface, surfaceSize );
238 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
240 mImpl->SurfaceResizeComplete( surface, surfaceSize );
243 void Adaptor::RenderOnce()
248 const LogFactoryInterface& Adaptor::GetLogFactory()
250 return mImpl->GetLogFactory();
253 void Adaptor::RegisterProcessor( Integration::Processor& processor )
255 mImpl->RegisterProcessor( processor );
258 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
260 mImpl->UnregisterProcessor( processor );
263 Dali::WindowContainer Adaptor::GetWindows() const
265 return mImpl->GetWindows();
268 SceneHolderList Adaptor::GetSceneHolders() const
270 return mImpl->GetSceneHolders();
273 void Adaptor::OnWindowShown()
275 mImpl->OnWindowShown();
278 void Adaptor::OnWindowHidden()
280 mImpl->OnWindowHidden();