Revert "[Tizen] Modify DALI_KEY_H"
[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   return GetImplementation(*this).FocusChangedSignal();
193 }
194
195 void Window::SetAcceptFocus( bool accept )
196 {
197   GetImplementation(*this).SetAcceptFocus( accept );
198 }
199
200 bool Window::IsFocusAcceptable() const
201 {
202   return GetImplementation(*this).IsFocusAcceptable();
203 }
204
205 void Window::Show()
206 {
207   GetImplementation(*this).Show();
208 }
209
210 void Window::Hide()
211 {
212   GetImplementation(*this).Hide();
213 }
214
215 bool Window::IsVisible() const
216 {
217   return GetImplementation(*this).IsVisible();
218 }
219
220 unsigned int Window::GetSupportedAuxiliaryHintCount() const
221 {
222   return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
223 }
224
225 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
226 {
227   return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
228 }
229
230 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
231 {
232   return GetImplementation(*this).AddAuxiliaryHint( hint, value );
233 }
234
235 bool Window::RemoveAuxiliaryHint( unsigned int id )
236 {
237   return GetImplementation(*this).RemoveAuxiliaryHint( id );
238 }
239
240 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
241 {
242   return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
243 }
244
245 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
246 {
247   return GetImplementation(*this).GetAuxiliaryHintValue( id );
248 }
249
250 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
251 {
252   return GetImplementation(*this).GetAuxiliaryHintId( hint );
253 }
254
255 void Window::SetInputRegion( const Rect< int >& inputRegion )
256 {
257   return GetImplementation(*this).SetInputRegion( inputRegion );
258 }
259
260 void Window::SetType( Window::Type type )
261 {
262   GetImplementation(*this).SetType( type );
263 }
264
265 Window::Type Window::GetType() const
266 {
267   return GetImplementation(*this).GetType();
268 }
269
270 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
271 {
272   return GetImplementation(*this).SetNotificationLevel( level );
273 }
274
275 Window::NotificationLevel::Type Window::GetNotificationLevel() const
276 {
277   return GetImplementation(*this).GetNotificationLevel();
278 }
279
280 void Window::SetOpaqueState( bool opaque )
281 {
282   GetImplementation(*this).SetOpaqueState( opaque );
283 }
284
285 bool Window::IsOpaqueState() const
286 {
287   return GetImplementation(*this).IsOpaqueState();
288 }
289
290 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
291 {
292   return GetImplementation(*this).SetScreenOffMode(screenMode);
293 }
294
295 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
296 {
297   return GetImplementation(*this).GetScreenOffMode();
298 }
299
300 bool Window::SetBrightness( int brightness )
301 {
302   return GetImplementation(*this).SetBrightness( brightness );
303 }
304
305 int Window::GetBrightness() const
306 {
307   return GetImplementation(*this).GetBrightness();
308 }
309
310 Window::ResizedSignalType& Window::ResizedSignal()
311 {
312   return GetImplementation(*this).ResizedSignal();
313 }
314
315 void Window::SetSize( Window::WindowSize size )
316 {
317   GetImplementation(*this).SetSize( size );
318 }
319
320 Window::WindowSize Window::GetSize() const
321 {
322   return GetImplementation(*this).GetSize();
323 }
324
325 void Window::SetPosition( Window::WindowPosition position )
326 {
327   GetImplementation(*this).SetPosition( position );
328 }
329
330 Window::WindowPosition Window::GetPosition() const
331 {
332   return GetImplementation(*this).GetPosition();
333 }
334
335 void Window::SetTransparency( bool transparent )
336 {
337   GetImplementation(*this).SetTransparency( transparent );
338 }
339
340 Window::Window( Internal::Adaptor::Window* window )
341 : BaseHandle( window )
342 {
343 }
344
345 } // namespace Dali