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.h>
22 #include <dali/integration-api/debug.h>
25 #include <dali/devel-api/adaptor-framework/style-monitor.h>
26 #include <dali/integration-api/render-surface.h>
27 #include <dali/internal/adaptor/common/adaptor-impl.h>
28 #include <dali/internal/window-system/common/window-impl.h>
30 #ifdef DALI_ADAPTOR_COMPILATION
31 #include <dali/integration-api/scene-holder.h>
33 #include <dali/integration-api/adaptors/scene-holder.h>
39 Adaptor& Adaptor::New( Window window )
41 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
44 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
46 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
47 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
51 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
53 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
56 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
58 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
59 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
60 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, configuration, NULL );
64 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
66 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
69 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
71 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
75 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
77 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
80 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
82 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
83 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
102 void Adaptor::Resume()
112 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
114 return mImpl->AddIdle( callback, hasReturnValue, false );
117 bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
119 return mImpl->AddWindow( childWindow, childWindowName, childWindowClassName, childWindowMode );
122 void Adaptor::RemoveIdle( CallbackBase* callback )
124 mImpl->RemoveIdle( callback );
127 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
129 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
130 mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
133 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
135 mImpl->ReplaceSurface( window, surface );
138 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
140 return mImpl->ResizedSignal();
143 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
145 return mImpl->LanguageChangedSignal();
148 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
150 return mImpl->WindowCreatedSignal();
153 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
155 return mImpl->GetSurface();
158 Any Adaptor::GetNativeWindowHandle()
160 return mImpl->GetNativeWindowHandle();
163 Any Adaptor::GetNativeWindowHandle( Actor actor )
165 return mImpl->GetNativeWindowHandle( actor );
168 Any Adaptor::GetGraphicsDisplay()
170 return mImpl->GetGraphicsDisplay();
173 void Adaptor::ReleaseSurfaceLock()
175 mImpl->ReleaseSurfaceLock();
178 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
180 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
183 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
185 mImpl->SetPreRenderCallback( callback );
188 Adaptor& Adaptor::Get()
190 return Internal::Adaptor::Adaptor::Get();
193 bool Adaptor::IsAvailable()
195 return Internal::Adaptor::Adaptor::IsAvailable();
198 void Adaptor::NotifySceneCreated()
200 mImpl->NotifySceneCreated();
203 void Adaptor::NotifyLanguageChanged()
205 mImpl->NotifyLanguageChanged();
208 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
210 mImpl->FeedTouchPoint(point, timeStamp);
213 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
215 mImpl->FeedWheelEvent(wheelEvent);
218 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
220 mImpl->FeedKeyEvent(keyEvent);
223 void Adaptor::SceneCreated()
225 mImpl->SceneCreated();
228 void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
230 mImpl->SurfaceResizePrepare( surface, surfaceSize );
233 void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
235 mImpl->SurfaceResizeComplete( surface, surfaceSize );
238 void Adaptor::RenderOnce()
243 const LogFactoryInterface& Adaptor::GetLogFactory()
245 return mImpl->GetLogFactory();
248 void Adaptor::RegisterProcessor( Integration::Processor& processor )
250 mImpl->RegisterProcessor( processor );
253 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
255 mImpl->UnregisterProcessor( processor );
258 Dali::WindowContainer Adaptor::GetWindows() const
260 return mImpl->GetWindows();
263 void Adaptor::OnWindowShown()
265 mImpl->OnWindowShown();
268 void Adaptor::OnWindowHidden()
270 mImpl->OnWindowHidden();