Fix header inclusion in an integration api header
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.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/public-api/adaptor-framework/window.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/actors/actor.h>
26 #include <dali/internal/adaptor/common/adaptor-impl.h>
27 #include <dali/internal/window-system/common/window-impl.h>
28 #include <dali/internal/window-system/common/orientation-impl.h>
29
30 namespace Dali
31 {
32
33 class DALI_INTERNAL DragAndDropDetector : public BaseHandle {}; // Empty class only required to compile Deprecated API GetDragAndDropDetector
34
35 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
36 {
37   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
38
39   Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
40   Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
41   Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
42
43   return Window(window);
44 }
45
46 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
47 {
48   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
49
50   Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
51   Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
52   Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, className, isTransparent );
53
54   return Window(window);
55 }
56
57 Window::Window()
58 {
59 }
60
61 Window::~Window()
62 {
63 }
64
65 Window::Window(const Window& handle)
66 : BaseHandle(handle)
67 {
68 }
69
70 Window& Window::operator=(const Window& rhs)
71 {
72   BaseHandle::operator=(rhs);
73   return *this;
74 }
75
76 void Window::Add( Dali::Actor actor )
77 {
78   GetImplementation( *this ).Add( actor );
79 }
80
81 void Window::Remove( Dali::Actor actor )
82 {
83   GetImplementation( *this ).Remove( actor );
84 }
85
86 void Window::SetBackgroundColor( const Vector4& color )
87 {
88   GetImplementation( *this ).SetBackgroundColor( color );
89 }
90
91 Vector4 Window::GetBackgroundColor() const
92 {
93   return GetImplementation( *this ).GetBackgroundColor();
94 }
95
96 Layer Window::GetRootLayer() const
97 {
98   return GetImplementation( *this ).GetRootLayer();
99 }
100
101 uint32_t Window::GetLayerCount() const
102 {
103   return GetImplementation( *this ).GetLayerCount();
104 }
105
106 Layer Window::GetLayer( uint32_t depth ) const
107 {
108   return GetImplementation( *this ).GetLayer( depth );
109 }
110
111 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
112 {
113   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
114
115   GetImplementation(*this).ShowIndicator( visibleMode );
116 }
117
118 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
119 {
120   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
121
122   return GetImplementation(*this).IndicatorVisibilityChangedSignal();
123 }
124
125 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
126 {
127   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
128
129   GetImplementation(*this).SetIndicatorBgOpacity( opacity );
130 }
131
132 void Window::RotateIndicator( WindowOrientation orientation )
133 {
134   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
135
136   GetImplementation(*this).RotateIndicator( orientation );
137 }
138
139 void Window::SetClass( std::string name, std::string klass )
140 {
141   GetImplementation(*this).SetClass( name, klass );
142 }
143
144 void Window::Raise()
145 {
146   GetImplementation(*this).Raise();
147 }
148
149 void Window::Lower()
150 {
151   GetImplementation(*this).Lower();
152 }
153
154 void Window::Activate()
155 {
156   GetImplementation(*this).Activate();
157 }
158
159 void Window::AddAvailableOrientation( WindowOrientation orientation )
160 {
161   GetImplementation(*this).AddAvailableOrientation( orientation );
162 }
163
164 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
165 {
166   GetImplementation(*this).RemoveAvailableOrientation( orientation );
167 }
168
169 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
170 {
171   GetImplementation(*this).SetPreferredOrientation( orientation );
172 }
173
174 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
175 {
176   return GetImplementation(*this).GetPreferredOrientation();
177 }
178
179 DragAndDropDetector Window::GetDragAndDropDetector() const
180 {
181   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
182   DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
183   return Dali::DragAndDropDetector();
184 }
185
186 Any Window::GetNativeHandle() const
187 {
188   return GetImplementation(*this).GetNativeHandle();
189 }
190
191 Window::FocusSignalType& Window::FocusChangedSignal()
192 {
193   return GetImplementation(*this).FocusChangedSignal();
194 }
195
196 void Window::SetAcceptFocus( bool accept )
197 {
198   GetImplementation(*this).SetAcceptFocus( accept );
199 }
200
201 bool Window::IsFocusAcceptable() const
202 {
203   return GetImplementation(*this).IsFocusAcceptable();
204 }
205
206 void Window::Show()
207 {
208   GetImplementation(*this).Show();
209 }
210
211 void Window::Hide()
212 {
213   GetImplementation(*this).Hide();
214 }
215
216 bool Window::IsVisible() const
217 {
218   return GetImplementation(*this).IsVisible();
219 }
220
221 unsigned int Window::GetSupportedAuxiliaryHintCount() const
222 {
223   return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
224 }
225
226 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
227 {
228   return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
229 }
230
231 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
232 {
233   return GetImplementation(*this).AddAuxiliaryHint( hint, value );
234 }
235
236 bool Window::RemoveAuxiliaryHint( unsigned int id )
237 {
238   return GetImplementation(*this).RemoveAuxiliaryHint( id );
239 }
240
241 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
242 {
243   return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
244 }
245
246 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
247 {
248   return GetImplementation(*this).GetAuxiliaryHintValue( id );
249 }
250
251 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
252 {
253   return GetImplementation(*this).GetAuxiliaryHintId( hint );
254 }
255
256 void Window::SetInputRegion( const Rect< int >& inputRegion )
257 {
258   return GetImplementation(*this).SetInputRegion( inputRegion );
259 }
260
261 void Window::SetType( Window::Type type )
262 {
263   GetImplementation(*this).SetType( type );
264 }
265
266 Window::Type Window::GetType() const
267 {
268   return GetImplementation(*this).GetType();
269 }
270
271 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
272 {
273   return GetImplementation(*this).SetNotificationLevel( level );
274 }
275
276 Window::NotificationLevel::Type Window::GetNotificationLevel() const
277 {
278   return GetImplementation(*this).GetNotificationLevel();
279 }
280
281 void Window::SetOpaqueState( bool opaque )
282 {
283   GetImplementation(*this).SetOpaqueState( opaque );
284 }
285
286 bool Window::IsOpaqueState() const
287 {
288   return GetImplementation(*this).IsOpaqueState();
289 }
290
291 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
292 {
293   return GetImplementation(*this).SetScreenOffMode(screenMode);
294 }
295
296 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
297 {
298   return GetImplementation(*this).GetScreenOffMode();
299 }
300
301 bool Window::SetBrightness( int brightness )
302 {
303   return GetImplementation(*this).SetBrightness( brightness );
304 }
305
306 int Window::GetBrightness() const
307 {
308   return GetImplementation(*this).GetBrightness();
309 }
310
311 Window::ResizedSignalType& Window::ResizedSignal()
312 {
313   return GetImplementation(*this).ResizedSignal();
314 }
315
316 void Window::SetSize( Window::WindowSize size )
317 {
318   GetImplementation(*this).SetSize( size );
319 }
320
321 Window::WindowSize Window::GetSize() const
322 {
323   return GetImplementation(*this).GetSize();
324 }
325
326 void Window::SetPosition( Window::WindowPosition position )
327 {
328   GetImplementation(*this).SetPosition( position );
329 }
330
331 Window::WindowPosition Window::GetPosition() const
332 {
333   return GetImplementation(*this).GetPosition();
334 }
335
336 void Window::SetTransparency( bool transparent )
337 {
338   GetImplementation(*this).SetTransparency( transparent );
339 }
340
341 Window::Window( Internal::Adaptor::Window* window )
342 : BaseHandle( window )
343 {
344 }
345
346 } // namespace Dali