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