2 * Copyright (c) 2019 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 class DALI_INTERNAL DragAndDropDetector : public BaseHandle {}; // Empty class only required to compile Deprecated API GetDragAndDropDetector
34 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
36 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
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 );
42 return Window(window);
45 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
47 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
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 );
53 return Window(window);
64 Window::Window(const Window& handle)
69 Window& Window::operator=(const Window& rhs)
71 BaseHandle::operator=(rhs);
75 void Window::Add( Dali::Actor actor )
77 GetImplementation( *this ).Add( actor );
80 void Window::Remove( Dali::Actor actor )
82 GetImplementation( *this ).Remove( actor );
85 void Window::SetBackgroundColor( const Vector4& color )
87 GetImplementation( *this ).SetBackgroundColor( color );
90 Vector4 Window::GetBackgroundColor() const
92 return GetImplementation( *this ).GetBackgroundColor();
95 Layer Window::GetRootLayer() const
97 return GetImplementation( *this ).GetRootLayer();
100 uint32_t Window::GetLayerCount() const
102 return GetImplementation( *this ).GetLayerCount();
105 Layer Window::GetLayer( uint32_t depth ) const
107 return GetImplementation( *this ).GetLayer( depth );
110 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
112 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
114 GetImplementation(*this).ShowIndicator( visibleMode );
117 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
119 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
121 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
124 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
126 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
128 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
131 void Window::RotateIndicator( WindowOrientation orientation )
133 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
135 GetImplementation(*this).RotateIndicator( orientation );
138 void Window::SetClass( std::string name, std::string klass )
140 GetImplementation(*this).SetClass( name, klass );
145 GetImplementation(*this).Raise();
150 GetImplementation(*this).Lower();
153 void Window::Activate()
155 GetImplementation(*this).Activate();
158 void Window::AddAvailableOrientation( WindowOrientation orientation )
160 GetImplementation(*this).AddAvailableOrientation( orientation );
163 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
165 GetImplementation(*this).RemoveAvailableOrientation( orientation );
168 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
170 GetImplementation(*this).SetPreferredOrientation( orientation );
173 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
175 return GetImplementation(*this).GetPreferredOrientation();
178 DragAndDropDetector Window::GetDragAndDropDetector() const
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();
185 Any Window::GetNativeHandle() const
187 return GetImplementation(*this).GetNativeHandle();
190 Window::FocusSignalType& Window::FocusChangedSignal()
192 return GetImplementation(*this).FocusChangedSignal();
195 void Window::SetAcceptFocus( bool accept )
197 GetImplementation(*this).SetAcceptFocus( accept );
200 bool Window::IsFocusAcceptable() const
202 return GetImplementation(*this).IsFocusAcceptable();
207 GetImplementation(*this).Show();
212 GetImplementation(*this).Hide();
215 bool Window::IsVisible() const
217 return GetImplementation(*this).IsVisible();
220 unsigned int Window::GetSupportedAuxiliaryHintCount() const
222 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
225 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
227 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
230 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
232 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
235 bool Window::RemoveAuxiliaryHint( unsigned int id )
237 return GetImplementation(*this).RemoveAuxiliaryHint( id );
240 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
242 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
245 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
247 return GetImplementation(*this).GetAuxiliaryHintValue( id );
250 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
252 return GetImplementation(*this).GetAuxiliaryHintId( hint );
255 void Window::SetInputRegion( const Rect< int >& inputRegion )
257 return GetImplementation(*this).SetInputRegion( inputRegion );
260 void Window::SetType( Window::Type type )
262 GetImplementation(*this).SetType( type );
265 Window::Type Window::GetType() const
267 return GetImplementation(*this).GetType();
270 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
272 return GetImplementation(*this).SetNotificationLevel( level );
275 Window::NotificationLevel::Type Window::GetNotificationLevel() const
277 return GetImplementation(*this).GetNotificationLevel();
280 void Window::SetOpaqueState( bool opaque )
282 GetImplementation(*this).SetOpaqueState( opaque );
285 bool Window::IsOpaqueState() const
287 return GetImplementation(*this).IsOpaqueState();
290 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
292 return GetImplementation(*this).SetScreenOffMode(screenMode);
295 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
297 return GetImplementation(*this).GetScreenOffMode();
300 bool Window::SetBrightness( int brightness )
302 return GetImplementation(*this).SetBrightness( brightness );
305 int Window::GetBrightness() const
307 return GetImplementation(*this).GetBrightness();
310 Window::ResizedSignalType& Window::ResizedSignal()
312 return GetImplementation(*this).ResizedSignal();
315 void Window::SetSize( Window::WindowSize size )
317 GetImplementation(*this).SetSize( size );
320 Window::WindowSize Window::GetSize() const
322 return GetImplementation(*this).GetSize();
325 void Window::SetPosition( Window::WindowPosition position )
327 GetImplementation(*this).SetPosition( position );
330 Window::WindowPosition Window::GetPosition() const
332 return GetImplementation(*this).GetPosition();
335 void Window::SetTransparency( bool transparent )
337 GetImplementation(*this).SetTransparency( transparent );
340 Window::Window( Internal::Adaptor::Window* window )
341 : BaseHandle( window )