34a8fa9b0d3a15c9330c9013a184b80b5393ba29
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.cpp
1 /*
2  * Copyright (c) 2017 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::ShowIndicator( IndicatorVisibleMode visibleMode )
76 {
77   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
78
79   GetImplementation(*this).ShowIndicator( visibleMode );
80 }
81
82 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
83 {
84   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
85
86   return GetImplementation(*this).IndicatorVisibilityChangedSignal();
87 }
88
89 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
90 {
91   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
92
93   GetImplementation(*this).SetIndicatorBgOpacity( opacity );
94 }
95
96 void Window::RotateIndicator( WindowOrientation orientation )
97 {
98   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
99
100   GetImplementation(*this).RotateIndicator( orientation );
101 }
102
103 void Window::SetClass( std::string name, std::string klass )
104 {
105   GetImplementation(*this).SetClass( name, klass );
106 }
107
108 void Window::Raise()
109 {
110   GetImplementation(*this).Raise();
111 }
112
113 void Window::Lower()
114 {
115   GetImplementation(*this).Lower();
116 }
117
118 void Window::Activate()
119 {
120   GetImplementation(*this).Activate();
121 }
122
123 void Window::AddAvailableOrientation( WindowOrientation orientation )
124 {
125   GetImplementation(*this).AddAvailableOrientation( orientation );
126 }
127
128 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
129 {
130   GetImplementation(*this).RemoveAvailableOrientation( orientation );
131 }
132
133 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
134 {
135   GetImplementation(*this).SetPreferredOrientation( orientation );
136 }
137
138 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
139 {
140   return GetImplementation(*this).GetPreferredOrientation();
141 }
142
143 DragAndDropDetector Window::GetDragAndDropDetector() const
144 {
145   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
146   DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
147   return Dali::DragAndDropDetector();
148 }
149
150 Any Window::GetNativeHandle() const
151 {
152   return GetImplementation(*this).GetNativeHandle();
153 }
154
155 Window::FocusSignalType& Window::FocusChangedSignal()
156 {
157   return GetImplementation(*this).FocusChangedSignal();
158 }
159
160 void Window::SetAcceptFocus( bool accept )
161 {
162   GetImplementation(*this).SetAcceptFocus( accept );
163 }
164
165 bool Window::IsFocusAcceptable() const
166 {
167   return GetImplementation(*this).IsFocusAcceptable();
168 }
169
170 void Window::Show()
171 {
172   GetImplementation(*this).Show();
173 }
174
175 void Window::Hide()
176 {
177   GetImplementation(*this).Hide();
178 }
179
180 bool Window::IsVisible() const
181 {
182   return GetImplementation(*this).IsVisible();
183 }
184
185 unsigned int Window::GetSupportedAuxiliaryHintCount() const
186 {
187   return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
188 }
189
190 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
191 {
192   return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
193 }
194
195 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
196 {
197   return GetImplementation(*this).AddAuxiliaryHint( hint, value );
198 }
199
200 bool Window::RemoveAuxiliaryHint( unsigned int id )
201 {
202   return GetImplementation(*this).RemoveAuxiliaryHint( id );
203 }
204
205 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
206 {
207   return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
208 }
209
210 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
211 {
212   return GetImplementation(*this).GetAuxiliaryHintValue( id );
213 }
214
215 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
216 {
217   return GetImplementation(*this).GetAuxiliaryHintId( hint );
218 }
219
220 void Window::SetInputRegion( const Rect< int >& inputRegion )
221 {
222   return GetImplementation(*this).SetInputRegion( inputRegion );
223 }
224
225 void Window::SetType( Window::Type type )
226 {
227   GetImplementation(*this).SetType( type );
228 }
229
230 Window::Type Window::GetType() const
231 {
232   return GetImplementation(*this).GetType();
233 }
234
235 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
236 {
237   return GetImplementation(*this).SetNotificationLevel( level );
238 }
239
240 Window::NotificationLevel::Type Window::GetNotificationLevel() const
241 {
242   return GetImplementation(*this).GetNotificationLevel();
243 }
244
245 void Window::SetOpaqueState( bool opaque )
246 {
247   GetImplementation(*this).SetOpaqueState( opaque );
248 }
249
250 bool Window::IsOpaqueState() const
251 {
252   return GetImplementation(*this).IsOpaqueState();
253 }
254
255 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
256 {
257   return GetImplementation(*this).SetScreenOffMode(screenMode);
258 }
259
260 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
261 {
262   return GetImplementation(*this).GetScreenOffMode();
263 }
264
265 bool Window::SetBrightness( int brightness )
266 {
267   return GetImplementation(*this).SetBrightness( brightness );
268 }
269
270 int Window::GetBrightness() const
271 {
272   return GetImplementation(*this).GetBrightness();
273 }
274
275 Window::ResizedSignalType& Window::ResizedSignal()
276 {
277   return GetImplementation(*this).ResizedSignal();
278 }
279
280 void Window::SetSize( Window::WindowSize size )
281 {
282   GetImplementation(*this).SetSize( size );
283 }
284
285 Window::WindowSize Window::GetSize() const
286 {
287   return GetImplementation(*this).GetSize();
288 }
289
290 void Window::SetPosition( Window::WindowPosition position )
291 {
292   GetImplementation(*this).SetPosition( position );
293 }
294
295 Window::WindowPosition Window::GetPosition() const
296 {
297   return GetImplementation(*this).GetPosition();
298 }
299
300 void Window::SetTransparency( bool transparent )
301 {
302   GetImplementation(*this).SetTransparency( transparent );
303 }
304
305 Window::Window( Internal::Adaptor::Window* window )
306 : BaseHandle( window )
307 {
308 }
309
310 } // namespace Dali