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 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
39 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), NULL );
43 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
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 );
51 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
53 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, NULL );
57 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
59 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
60 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, NULL );
79 void Adaptor::Resume()
89 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
91 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
92 return mImpl->AddIdle( callback, hasReturnValue, false );
95 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow )
97 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
98 return mImpl->AddWindow( childWindow );
101 void Adaptor::RemoveIdle( CallbackBase* callback )
103 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
104 mImpl->RemoveIdle( callback );
107 void Adaptor::ProcessIdle()
109 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
110 mImpl->ProcessIdle();
113 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
115 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
116 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
119 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
121 mImpl->ReplaceSurface( window, surface );
124 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
126 return mImpl->ResizedSignal();
129 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
131 return mImpl->LanguageChangedSignal();
134 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
136 return mImpl->WindowCreatedSignal();
139 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
141 return mImpl->GetSurface();
144 Any Adaptor::GetNativeWindowHandle()
146 return mImpl->GetNativeWindowHandle();
149 Any Adaptor::GetNativeWindowHandle( Actor actor )
151 return mImpl->GetNativeWindowHandle( actor );
154 Any Adaptor::GetGraphicsDisplay()
156 return mImpl->GetGraphicsDisplay();
159 void Adaptor::ReleaseSurfaceLock()
161 mImpl->ReleaseSurfaceLock();
164 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
166 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
169 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
171 mImpl->SetPreRenderCallback( callback );
174 Adaptor& Adaptor::Get()
176 return Internal::Adaptor::Adaptor::Get();
179 bool Adaptor::IsAvailable()
181 return Internal::Adaptor::Adaptor::IsAvailable();
184 void Adaptor::NotifySceneCreated()
186 mImpl->NotifySceneCreated();
189 void Adaptor::NotifyLanguageChanged()
191 mImpl->NotifyLanguageChanged();
194 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
196 mImpl->FeedTouchPoint(point, timeStamp);
199 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
201 mImpl->FeedWheelEvent(wheelEvent);
204 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
206 mImpl->FeedKeyEvent(keyEvent);
209 void Adaptor::SceneCreated()
211 mImpl->SceneCreated();
214 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
216 mImpl->SurfaceResizePrepare( surface, surfaceSize );
219 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
221 mImpl->SurfaceResizeComplete( surface, surfaceSize );
224 void Adaptor::RenderOnce()
229 const LogFactoryInterface& Adaptor::GetLogFactory()
231 return mImpl->GetLogFactory();
234 void Adaptor::RegisterProcessor( Integration::Processor& processor )
236 mImpl->RegisterProcessor( processor );
239 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
241 mImpl->UnregisterProcessor( processor );
244 Dali::WindowContainer Adaptor::GetWindows() const
246 return mImpl->GetWindows();
249 SceneHolderList Adaptor::GetSceneHolders() const
251 return mImpl->GetSceneHolders();
254 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
256 return mImpl->GetObjectRegistry();
259 void Adaptor::OnWindowShown()
261 mImpl->OnWindowShown();
264 void Adaptor::OnWindowHidden()
266 mImpl->OnWindowHidden();