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/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/render-surface.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 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 void Adaptor::DeleteSurface( Dali::RenderSurfaceInterface& surface )
136 mImpl->DeleteSurface( surface );
139 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
141 return mImpl->ResizedSignal();
144 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
146 return mImpl->LanguageChangedSignal();
149 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
151 return mImpl->WindowCreatedSignal();
154 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
156 return mImpl->GetSurface();
159 Any Adaptor::GetNativeWindowHandle()
161 return mImpl->GetNativeWindowHandle();
164 Any Adaptor::GetNativeWindowHandle( Actor actor )
166 return mImpl->GetNativeWindowHandle( actor );
169 Any Adaptor::GetGraphicsDisplay()
171 return mImpl->GetGraphicsDisplay();
174 void Adaptor::ReleaseSurfaceLock()
176 mImpl->ReleaseSurfaceLock();
179 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
181 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
184 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
186 mImpl->SetPreRenderCallback( callback );
189 Adaptor& Adaptor::Get()
191 return Internal::Adaptor::Adaptor::Get();
194 bool Adaptor::IsAvailable()
196 return Internal::Adaptor::Adaptor::IsAvailable();
199 void Adaptor::NotifySceneCreated()
201 mImpl->NotifySceneCreated();
204 void Adaptor::NotifyLanguageChanged()
206 mImpl->NotifyLanguageChanged();
209 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
211 mImpl->FeedTouchPoint(point, timeStamp);
214 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
216 mImpl->FeedWheelEvent(wheelEvent);
219 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
221 mImpl->FeedKeyEvent(keyEvent);
224 void Adaptor::SceneCreated()
226 mImpl->SceneCreated();
229 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
231 mImpl->SurfaceResizePrepare( surface, surfaceSize );
234 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
236 mImpl->SurfaceResizeComplete( surface, surfaceSize );
239 void Adaptor::RenderOnce()
244 const LogFactoryInterface& Adaptor::GetLogFactory()
246 return mImpl->GetLogFactory();
249 void Adaptor::RegisterProcessor( Integration::Processor& processor )
251 mImpl->RegisterProcessor( processor );
254 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
256 mImpl->UnregisterProcessor( processor );
259 Dali::WindowContainer Adaptor::GetWindows() const
261 return mImpl->GetWindows();
264 SceneHolderList Adaptor::GetSceneHolders() const
266 return mImpl->GetSceneHolders();
269 void Adaptor::OnWindowShown()
271 mImpl->OnWindowShown();
274 void Adaptor::OnWindowHidden()
276 mImpl->OnWindowHidden();