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/accessibility-adaptor.h>
26 #include <dali/devel-api/adaptor-framework/style-monitor.h>
27 #include <dali/integration-api/render-surface.h>
28 #include <dali/internal/adaptor/common/adaptor-impl.h>
29 #include <dali/internal/window-system/common/window-impl.h>
31 #ifdef DALI_ADAPTOR_COMPILATION
32 #include <dali/integration-api/scene-holder.h>
34 #include <dali/integration-api/adaptors/scene-holder.h>
40 Adaptor& Adaptor::New( Window window )
42 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
45 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
47 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
48 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
52 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
54 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
57 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
59 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
60 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
61 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, configuration, NULL );
65 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
67 return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
70 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
72 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
76 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
78 return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
81 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
83 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
84 Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
103 void Adaptor::Resume()
113 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
115 return mImpl->AddIdle( callback, hasReturnValue, false );
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::GetGraphicsDisplay()
161 return mImpl->GetGraphicsDisplay();
164 void Adaptor::ReleaseSurfaceLock()
166 mImpl->ReleaseSurfaceLock();
169 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
171 mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
174 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
176 mImpl->SetPreRenderCallback( callback );
179 void Adaptor::SetUseHardwareVSync(bool useHardware)
181 mImpl->SetUseHardwareVSync( useHardware );
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::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();