Gesture event refactor
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/adaptor.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
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>
30
31 #ifdef DALI_ADAPTOR_COMPILATION
32 #include <dali/integration-api/scene-holder.h>
33 #else
34 #include <dali/integration-api/adaptors/scene-holder.h>
35 #endif
36
37 namespace Dali
38 {
39
40 Adaptor& Adaptor::New( Window window )
41 {
42   return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
43 }
44
45 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
46 {
47   Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
48   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
49   return *adaptor;
50 }
51
52 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
53 {
54   return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
55 }
56
57 Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
58 {
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 );
62   return *adaptor;
63 }
64
65 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
66 {
67   return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
68 }
69
70 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
71 {
72   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
73   return *adaptor;
74 }
75
76 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
77 {
78   return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
79 }
80
81 Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
82 {
83   Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
84   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
85   return *adaptor;
86 }
87
88 Adaptor::~Adaptor()
89 {
90   delete mImpl;
91 }
92
93 void Adaptor::Start()
94 {
95   mImpl->Start();
96 }
97
98 void Adaptor::Pause()
99 {
100   mImpl->Pause();
101 }
102
103 void Adaptor::Resume()
104 {
105   mImpl->Resume();
106 }
107
108 void Adaptor::Stop()
109 {
110   mImpl->Stop();
111 }
112
113 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
114 {
115   return mImpl->AddIdle( callback, hasReturnValue, false );
116 }
117
118 void Adaptor::RemoveIdle( CallbackBase* callback )
119 {
120   mImpl->RemoveIdle( callback );
121 }
122
123 void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
124 {
125   Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
126   mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
127 }
128
129 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
130 {
131   mImpl->ReplaceSurface( window, surface );
132 }
133
134 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
135 {
136   return mImpl->ResizedSignal();
137 }
138
139 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
140 {
141   return mImpl->LanguageChangedSignal();
142 }
143
144 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
145 {
146   return mImpl->GetSurface();
147 }
148
149 Any Adaptor::GetNativeWindowHandle()
150 {
151   return mImpl->GetNativeWindowHandle();
152 }
153
154 Any Adaptor::GetGraphicsDisplay()
155 {
156   return mImpl->GetGraphicsDisplay();
157 }
158
159 void Adaptor::ReleaseSurfaceLock()
160 {
161   mImpl->ReleaseSurfaceLock();
162 }
163
164 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
165 {
166   mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
167 }
168
169 void Adaptor::SetPreRenderCallback( CallbackBase* callback )
170 {
171   mImpl->SetPreRenderCallback( callback );
172 }
173
174 void Adaptor::SetUseHardwareVSync(bool useHardware)
175 {
176   mImpl->SetUseHardwareVSync( useHardware );
177 }
178
179 Adaptor& Adaptor::Get()
180 {
181   return Internal::Adaptor::Adaptor::Get();
182 }
183
184 bool Adaptor::IsAvailable()
185 {
186   return Internal::Adaptor::Adaptor::IsAvailable();
187 }
188
189 void Adaptor::NotifySceneCreated()
190 {
191   mImpl->NotifySceneCreated();
192 }
193
194 void Adaptor::NotifyLanguageChanged()
195 {
196   mImpl->NotifyLanguageChanged();
197 }
198
199 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
200 {
201   mImpl->FeedTouchPoint(point, timeStamp);
202 }
203
204 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
205 {
206   mImpl->FeedWheelEvent(wheelEvent);
207 }
208
209 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
210 {
211   mImpl->FeedKeyEvent(keyEvent);
212 }
213
214 void Adaptor::SceneCreated()
215 {
216   mImpl->SceneCreated();
217 }
218
219 void Adaptor::RenderOnce()
220 {
221   mImpl->RenderOnce();
222 }
223
224 const LogFactoryInterface& Adaptor::GetLogFactory()
225 {
226   return mImpl->GetLogFactory();
227 }
228
229 void Adaptor::RegisterProcessor( Integration::Processor& processor )
230 {
231   mImpl->RegisterProcessor( processor );
232 }
233
234 void Adaptor::UnregisterProcessor( Integration::Processor& processor )
235 {
236   mImpl->UnregisterProcessor( processor );
237 }
238
239 Adaptor::Adaptor()
240 : mImpl( NULL )
241 {
242 }
243
244 } // namespace Dali