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