2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/adaptor-framework/window.h>
22 #include <dali/integration-api/debug.h>
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>
32 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
34 return Dali::Window::New(posSize, name, "", isTransparent);
37 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
41 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
42 bool isNewWindowAllowed = true;
44 if (isAdaptorAvailable)
46 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
47 isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
50 if (isNewWindowAllowed)
52 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
54 Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
56 if (isAdaptorAvailable)
58 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
59 Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder, name, className, isTransparent);
61 newWindow = Window(window);
65 DALI_LOG_ERROR("This device can't support multiple windows.\n");
79 Window::Window(const Window& handle)
84 Window& Window::operator=(const Window& rhs)
86 BaseHandle::operator=(rhs);
90 void Window::Add( Dali::Actor actor )
92 GetImplementation( *this ).Add( actor );
95 void Window::Remove( Dali::Actor actor )
97 GetImplementation( *this ).Remove( actor );
100 void Window::SetBackgroundColor( const Vector4& color )
102 GetImplementation( *this ).SetBackgroundColor( color );
105 Vector4 Window::GetBackgroundColor() const
107 return GetImplementation( *this ).GetBackgroundColor();
110 Layer Window::GetRootLayer() const
112 return GetImplementation( *this ).GetRootLayer();
115 uint32_t Window::GetLayerCount() const
117 return GetImplementation( *this ).GetLayerCount();
120 Layer Window::GetLayer( uint32_t depth ) const
122 return GetImplementation( *this ).GetLayer( depth );
125 void Window::SetClass( std::string name, std::string klass )
127 GetImplementation(*this).SetClass( name, klass );
132 GetImplementation(*this).Raise();
137 GetImplementation(*this).Lower();
140 void Window::Activate()
142 GetImplementation(*this).Activate();
145 void Window::AddAvailableOrientation( WindowOrientation orientation )
147 GetImplementation(*this).AddAvailableOrientation( orientation );
150 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
152 GetImplementation(*this).RemoveAvailableOrientation( orientation );
155 void Window::SetPreferredOrientation( WindowOrientation orientation )
157 GetImplementation(*this).SetPreferredOrientation( orientation );
160 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
162 return GetImplementation(*this).GetPreferredOrientation();
165 Any Window::GetNativeHandle() const
167 return GetImplementation(*this).GetNativeHandle();
170 Window::FocusChangeSignalType& Window::FocusChangeSignal()
172 return GetImplementation(*this).FocusChangeSignal();
175 void Window::SetAcceptFocus( bool accept )
177 GetImplementation(*this).SetAcceptFocus( accept );
180 bool Window::IsFocusAcceptable() const
182 return GetImplementation(*this).IsFocusAcceptable();
187 GetImplementation(*this).Show();
192 GetImplementation(*this).Hide();
195 bool Window::IsVisible() const
197 return GetImplementation(*this).IsVisible();
200 unsigned int Window::GetSupportedAuxiliaryHintCount() const
202 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
205 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
207 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
210 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
212 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
215 bool Window::RemoveAuxiliaryHint( unsigned int id )
217 return GetImplementation(*this).RemoveAuxiliaryHint( id );
220 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
222 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
225 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
227 return GetImplementation(*this).GetAuxiliaryHintValue( id );
230 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
232 return GetImplementation(*this).GetAuxiliaryHintId( hint );
235 void Window::SetInputRegion( const Rect< int >& inputRegion )
237 return GetImplementation(*this).SetInputRegion( inputRegion );
240 void Window::SetType( Window::Type type )
242 GetImplementation(*this).SetType( type );
245 Window::Type Window::GetType() const
247 return GetImplementation(*this).GetType();
250 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
252 return GetImplementation(*this).SetNotificationLevel( level );
255 Window::NotificationLevel::Type Window::GetNotificationLevel() const
257 return GetImplementation(*this).GetNotificationLevel();
260 void Window::SetOpaqueState( bool opaque )
262 GetImplementation(*this).SetOpaqueState( opaque );
265 bool Window::IsOpaqueState() const
267 return GetImplementation(*this).IsOpaqueState();
270 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
272 return GetImplementation(*this).SetScreenOffMode(screenMode);
275 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
277 return GetImplementation(*this).GetScreenOffMode();
280 bool Window::SetBrightness( int brightness )
282 return GetImplementation(*this).SetBrightness( brightness );
285 int Window::GetBrightness() const
287 return GetImplementation(*this).GetBrightness();
290 Window::ResizedSignalType& Window::ResizedSignal()
292 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" );
293 return GetImplementation(*this).ResizedSignal();
296 Window::ResizeSignalType& Window::ResizeSignal()
298 return GetImplementation(*this).ResizeSignal();
301 void Window::SetSize( Window::WindowSize size )
303 GetImplementation(*this).SetSize( size );
306 Window::WindowSize Window::GetSize() const
308 return GetImplementation(*this).GetSize();
311 void Window::SetPosition( Window::WindowPosition position )
313 GetImplementation(*this).SetPosition( position );
316 Window::WindowPosition Window::GetPosition() const
318 return GetImplementation(*this).GetPosition();
321 void Window::SetTransparency( bool transparent )
323 GetImplementation(*this).SetTransparency( transparent );
326 Window::Window( Internal::Adaptor::Window* window )
327 : BaseHandle( window )