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>
32 #include <dali/internal/adaptor/common/thread-controller-interface.h>
37 Adaptor& Adaptor::New( Window window )
39 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
40 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), NULL );
44 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
46 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
47 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
48 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL );
52 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
54 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, NULL );
58 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
60 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
61 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL );
80 void Adaptor::Resume()
90 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
92 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
93 return mImpl->AddIdle( callback, hasReturnValue, false );
96 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow )
98 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
99 return mImpl->AddWindow( childWindow );
102 void Adaptor::RemoveIdle( CallbackBase* callback )
104 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
105 mImpl->RemoveIdle( callback );
108 void Adaptor::ProcessIdle()
110 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
111 mImpl->ProcessIdle();
114 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
116 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
117 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
120 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
122 mImpl->ReplaceSurface( window, surface );
125 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
127 return mImpl->ResizedSignal();
130 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
132 return mImpl->LanguageChangedSignal();
135 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
137 return mImpl->WindowCreatedSignal();
140 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
142 return mImpl->GetSurface();
145 Any Adaptor::GetNativeWindowHandle()
147 return mImpl->GetNativeWindowHandle();
150 Any Adaptor::GetNativeWindowHandle( Actor actor )
152 return mImpl->GetNativeWindowHandle( actor );
155 Any Adaptor::GetGraphicsDisplay()
157 return mImpl->GetGraphicsDisplay();
160 void Adaptor::ReleaseSurfaceLock()
162 mImpl->ReleaseSurfaceLock();
165 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
167 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
170 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
172 mImpl->SetPreRenderCallback( callback );
175 Adaptor& Adaptor::Get()
177 return Internal::Adaptor::Adaptor::Get();
180 bool Adaptor::IsAvailable()
182 return Internal::Adaptor::Adaptor::IsAvailable();
185 void Adaptor::NotifySceneCreated()
187 mImpl->NotifySceneCreated();
190 void Adaptor::NotifyLanguageChanged()
192 mImpl->NotifyLanguageChanged();
195 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
197 mImpl->FeedTouchPoint(point, timeStamp);
200 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
202 mImpl->FeedWheelEvent(wheelEvent);
205 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
207 mImpl->FeedKeyEvent(keyEvent);
210 void Adaptor::SceneCreated()
212 mImpl->SceneCreated();
215 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
217 mImpl->SurfaceResizePrepare( surface, surfaceSize );
220 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
222 mImpl->SurfaceResizeComplete( surface, surfaceSize );
225 void Adaptor::RenderOnce()
230 const LogFactoryInterface& Adaptor::GetLogFactory()
232 return mImpl->GetLogFactory();
235 void Adaptor::RegisterProcessor( Integration::Processor& processor )
237 mImpl->RegisterProcessor( processor );
240 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
242 mImpl->UnregisterProcessor( processor );
245 Dali::WindowContainer Adaptor::GetWindows() const
247 return mImpl->GetWindows();
250 SceneHolderList Adaptor::GetSceneHolders() const
252 return mImpl->GetSceneHolders();
255 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
257 return mImpl->GetObjectRegistry();
260 void Adaptor::OnWindowShown()
262 mImpl->OnWindowShown();
265 void Adaptor::OnWindowHidden()
267 mImpl->OnWindowHidden();