Merge "Add descriptions and example codes" 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) 2016 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
23 #include <toolkit-adaptor-impl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30 namespace Adaptor
31 {
32
33 bool Adaptor::mAvailable = false;
34 Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
35
36 Dali::Adaptor& Adaptor::Get()
37 {
38   Dali::Adaptor* adaptor = new Dali::Adaptor;
39   Adaptor::mAvailable = true;
40   return *adaptor;
41 }
42
43 Dali::RenderSurface& Adaptor::GetSurface()
44 {
45   Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
46   return *renderSurface;
47 }
48
49 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
50 {
51   Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
52   return *signal;
53 }
54
55 } // namespace Adaptor
56 } // namespace Internal
57
58 Adaptor& Adaptor::New( Window window )
59 {
60   return Internal::Adaptor::Adaptor::Get();
61 }
62
63 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
64 {
65   return Internal::Adaptor::Adaptor::Get();
66 }
67
68 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
69 {
70   return Internal::Adaptor::Adaptor::Get();
71 }
72
73 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
74 {
75   return Internal::Adaptor::Adaptor::Get();
76 }
77
78 Adaptor::~Adaptor()
79 {
80 }
81
82 void Adaptor::Start()
83 {
84 }
85
86 void Adaptor::Pause()
87 {
88 }
89
90 void Adaptor::Resume()
91 {
92 }
93
94 void Adaptor::Stop()
95 {
96 }
97
98 bool Adaptor::AddIdle( CallbackBase* callback )
99 {
100   const bool isAvailable = IsAvailable();
101
102   if( isAvailable )
103   {
104     Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback );
105   }
106
107   return isAvailable;
108 }
109
110 void Adaptor::RemoveIdle( CallbackBase* callback )
111 {
112   const bool isAvailable = IsAvailable();
113
114   if( isAvailable )
115   {
116     for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
117            endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
118          it != endIt;
119          ++it )
120     {
121       if( callback == *it )
122       {
123         Internal::Adaptor::Adaptor::mCallbacks.Remove( it );
124         return;
125       }
126     }
127   }
128 }
129
130 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
131 {
132 }
133
134 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
135 {
136   return Internal::Adaptor::Adaptor::AdaptorSignal();
137 }
138
139 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
140 {
141   return Internal::Adaptor::Adaptor::AdaptorSignal();
142 }
143
144 RenderSurface& Adaptor::GetSurface()
145 {
146   return Internal::Adaptor::Adaptor::GetSurface();
147 }
148
149 Any Adaptor::GetNativeWindowHandle()
150 {
151   Any window;
152   return window;
153 }
154
155 void Adaptor::ReleaseSurfaceLock()
156 {
157 }
158
159 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
160 {
161 }
162
163 void Adaptor::SetUseHardwareVSync(bool useHardware)
164 {
165 }
166
167 Adaptor& Adaptor::Get()
168 {
169   return Internal::Adaptor::Adaptor::Get();
170 }
171
172 bool Adaptor::IsAvailable()
173 {
174   return Internal::Adaptor::Adaptor::mAvailable;
175 }
176
177 void Adaptor::NotifySceneCreated()
178 {
179 }
180
181 void Adaptor::NotifyLanguageChanged()
182 {
183 }
184
185 void Adaptor::SetMinimumPinchDistance(float distance)
186 {
187 }
188
189 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
190 {
191 }
192
193 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
194 {
195 }
196
197 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
198 {
199 }
200
201 void Adaptor::SceneCreated()
202 {
203 }
204
205 void Adaptor::SetViewMode( ViewMode mode )
206 {
207 }
208
209 void Adaptor::SetStereoBase(  float stereoBase )
210 {
211 }
212
213 Adaptor::Adaptor()
214 : mImpl( NULL )
215 {
216 }
217
218 } // namespace Dali