2 * Copyright (c) 2017 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>
21 #include <dali/public-api/object/base-object.h>
23 #include <toolkit-adaptor-impl.h>
24 #include <dali/integration-api/debug.h>
25 #include <test-application.h>
35 bool Adaptor::mAvailable = false;
36 Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
38 Dali::Adaptor& Adaptor::Get()
40 Dali::Adaptor* adaptor = new Dali::Adaptor;
41 Adaptor::mAvailable = true;
45 Dali::RenderSurface& Adaptor::GetSurface()
47 Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
48 return *renderSurface;
51 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
53 Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
57 } // namespace Adaptor
58 } // namespace Internal
60 Adaptor& Adaptor::New( Window window )
62 return Internal::Adaptor::Adaptor::Get();
65 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
67 return Internal::Adaptor::Adaptor::Get();
70 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
72 return Internal::Adaptor::Adaptor::Get();
75 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
77 return Internal::Adaptor::Adaptor::Get();
92 void Adaptor::Resume()
100 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
102 const bool isAvailable = IsAvailable();
106 Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback );
112 void Adaptor::RemoveIdle( CallbackBase* callback )
114 const bool isAvailable = IsAvailable();
118 for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
119 endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
123 if( callback == *it )
125 Internal::Adaptor::Adaptor::mCallbacks.Remove( it );
132 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
136 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
138 return Internal::Adaptor::Adaptor::AdaptorSignal();
141 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
143 return Internal::Adaptor::Adaptor::AdaptorSignal();
146 RenderSurface& Adaptor::GetSurface()
148 return Internal::Adaptor::Adaptor::GetSurface();
151 Any Adaptor::GetNativeWindowHandle()
157 void Adaptor::ReleaseSurfaceLock()
161 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
165 void Adaptor::SetUseHardwareVSync(bool useHardware)
169 Adaptor& Adaptor::Get()
171 return Internal::Adaptor::Adaptor::Get();
174 bool Adaptor::IsAvailable()
176 return Internal::Adaptor::Adaptor::mAvailable;
179 void Adaptor::NotifySceneCreated()
183 void Adaptor::NotifyLanguageChanged()
187 void Adaptor::SetMinimumPinchDistance(float distance)
191 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
195 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
199 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
203 void Adaptor::SceneCreated()
207 class LogFactory : public LogFactoryInterface
210 virtual void InstallLogFunction() const
212 Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
213 Dali::Integration::Log::InstallLogFunction(logFunction);
219 virtual ~LogFactory()
224 LogFactory* gLogFactory = NULL;
225 const LogFactoryInterface& Adaptor::GetLogFactory()
227 if( gLogFactory == NULL )
229 gLogFactory = new LogFactory;