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