2 * Copyright (c) 2019 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/adaptors/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/render-surface.h>
28 #include <dali/integration-api/adaptors/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 return mImpl->AddIdle( callback, hasReturnValue, false );
113 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
115 return mImpl->AddWindow( childWindow, childWindowName, childWindowClassName, childWindowMode );
118 void Adaptor::RemoveIdle( CallbackBase* callback )
120 mImpl->RemoveIdle( callback );
123 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
125 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
126 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
129 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
131 mImpl->ReplaceSurface( window, surface );
134 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
136 return mImpl->ResizedSignal();
139 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
141 return mImpl->LanguageChangedSignal();
144 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
146 return mImpl->WindowCreatedSignal();
149 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
151 return mImpl->GetSurface();
154 Any Adaptor::GetNativeWindowHandle()
156 return mImpl->GetNativeWindowHandle();
159 Any Adaptor::GetNativeWindowHandle( Actor actor )
161 return mImpl->GetNativeWindowHandle( actor );
164 Any Adaptor::GetGraphicsDisplay()
166 return mImpl->GetGraphicsDisplay();
169 void Adaptor::ReleaseSurfaceLock()
171 mImpl->ReleaseSurfaceLock();
174 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
176 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
179 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
181 mImpl->SetPreRenderCallback( callback );
184 Adaptor& Adaptor::Get()
186 return Internal::Adaptor::Adaptor::Get();
189 bool Adaptor::IsAvailable()
191 return Internal::Adaptor::Adaptor::IsAvailable();
194 void Adaptor::NotifySceneCreated()
196 mImpl->NotifySceneCreated();
199 void Adaptor::NotifyLanguageChanged()
201 mImpl->NotifyLanguageChanged();
204 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
206 mImpl->FeedTouchPoint(point, timeStamp);
209 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
211 mImpl->FeedWheelEvent(wheelEvent);
214 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
216 mImpl->FeedKeyEvent(keyEvent);
219 void Adaptor::SceneCreated()
221 mImpl->SceneCreated();
224 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
226 mImpl->SurfaceResizePrepare( surface, surfaceSize );
229 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
231 mImpl->SurfaceResizeComplete( surface, surfaceSize );
234 void Adaptor::RenderOnce()
239 const LogFactoryInterface& Adaptor::GetLogFactory()
241 return mImpl->GetLogFactory();
244 void Adaptor::RegisterProcessor( Integration::Processor& processor )
246 mImpl->RegisterProcessor( processor );
249 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
251 mImpl->UnregisterProcessor( processor );
254 Dali::WindowContainer Adaptor::GetWindows() const
256 return mImpl->GetWindows();
259 SceneHolderList Adaptor::GetSceneHolders() const
261 return mImpl->GetSceneHolders();
264 void Adaptor::OnWindowShown()
266 mImpl->OnWindowShown();
269 void Adaptor::OnWindowHidden()
271 mImpl->OnWindowHidden();