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