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