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