Merge changes I88ded17f,I3960a370 into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-adaptor.cpp
1 /*
2  * Copyright (c) 2014 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/adaptors/adaptor.h>
20
21 #include <dali/public-api/object/base-object.h>
22 #include <dali/devel-api/adaptor-framework/render-surface.h>
23
24 namespace Dali
25 {
26
27 class EglInterface;
28 class DisplayConnection;
29 class ThreadSynchronizationInterface;
30
31 namespace Integration
32 {
33
34 class GlAbstraction;
35
36 } // namespace Integration
37
38 class TestRenderSurface : public RenderSurface
39 {
40 public:
41   virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
42
43   virtual void InitializeEgl( EglInterface& egl ) {}
44
45   virtual void CreateEglSurface( EglInterface& egl ) {}
46
47   virtual void DestroyEglSurface( EglInterface& egl ) {}
48
49   virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
50
51   virtual void MoveResize( Dali::PositionSize positionSize ) {}
52
53   virtual void SetViewMode( ViewMode viewMode ) {}
54
55   virtual void StartRender() {}
56
57   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
58
59   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
60
61   virtual void StopRender() {}
62
63   virtual void ReleaseLock() {}
64
65   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
66
67   virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
68 };
69
70 namespace Internal
71 {
72 namespace Adaptor
73 {
74
75 class Adaptor: public BaseObject
76 {
77 public:
78   static Dali::Adaptor& Get();
79   Adaptor();
80   ~Adaptor();
81
82 public:
83   static Dali::RenderSurface& GetSurface();
84   static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
85 };
86
87 Dali::Adaptor& Adaptor::Get()
88 {
89   Dali::Adaptor* adaptor = new Dali::Adaptor;
90   return *adaptor;
91 }
92
93 Dali::RenderSurface& Adaptor::GetSurface()
94 {
95   Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
96   return *renderSurface;
97 }
98
99 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
100 {
101   Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
102   return *signal;
103 }
104
105 }
106 }
107 }
108
109 namespace Dali
110 {
111
112 Adaptor& Adaptor::New( Window window )
113 {
114   return Internal::Adaptor::Adaptor::Get();
115 }
116
117 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
118 {
119   return Internal::Adaptor::Adaptor::Get();
120 }
121
122 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
123 {
124   return Internal::Adaptor::Adaptor::Get();
125 }
126
127 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
128 {
129   return Internal::Adaptor::Adaptor::Get();
130 }
131
132 Adaptor::~Adaptor()
133 {
134 }
135
136 void Adaptor::Start()
137 {
138 }
139
140 void Adaptor::Pause()
141 {
142 }
143
144 void Adaptor::Resume()
145 {
146 }
147
148 void Adaptor::Stop()
149 {
150 }
151
152 bool Adaptor::AddIdle( CallbackBase* callback )
153 {
154   return false;
155 }
156
157 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
158 {
159 }
160
161 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
162 {
163   return Internal::Adaptor::Adaptor::AdaptorSignal();
164 }
165
166 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
167 {
168   return Internal::Adaptor::Adaptor::AdaptorSignal();
169 }
170
171 RenderSurface& Adaptor::GetSurface()
172 {
173   return Internal::Adaptor::Adaptor::GetSurface();
174 }
175
176 Any Adaptor::GetNativeWindowHandle()
177 {
178   Any window;
179   return window;
180 }
181
182 void Adaptor::ReleaseSurfaceLock()
183 {
184 }
185
186 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
187 {
188 }
189
190 void Adaptor::SetUseHardwareVSync(bool useHardware)
191 {
192 }
193
194 Adaptor& Adaptor::Get()
195 {
196   return Internal::Adaptor::Adaptor::Get();
197 }
198
199 bool Adaptor::IsAvailable()
200 {
201   return false;
202 }
203
204 void Adaptor::NotifySceneCreated()
205 {
206 }
207
208 void Adaptor::NotifyLanguageChanged()
209 {
210 }
211
212 void Adaptor::SetMinimumPinchDistance(float distance)
213 {
214 }
215
216 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
217 {
218 }
219
220 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
221 {
222 }
223
224 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
225 {
226 }
227
228 void Adaptor::SceneCreated()
229 {
230 }
231
232 void Adaptor::SetViewMode( ViewMode mode )
233 {
234 }
235
236 void Adaptor::SetStereoBase(  float stereoBase )
237 {
238 }
239
240 Adaptor::Adaptor()
241 : mImpl( NULL )
242 {
243 }
244
245 } // namespace Dali