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);
37 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
38 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
39 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, "", isTransparent );
40 if( !Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() )
42 DALI_LOG_ERROR("This device can't support multiple windows.\n");
44 return Window(window);
47 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
49 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
50 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
51 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
52 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, className, isTransparent );
53 if( !Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() )
55 DALI_LOG_ERROR("This device can't support multiple windows.\n");
57 return Window(window);
68 Window::Window(const Window& handle)
73 Window& Window::operator=(const Window& rhs)
75 BaseHandle::operator=(rhs);
79 void Window::Add( Dali::Actor actor )
81 GetImplementation( *this ).Add( actor );
84 void Window::Remove( Dali::Actor actor )
86 GetImplementation( *this ).Remove( actor );
89 void Window::SetBackgroundColor( const Vector4& color )
91 GetImplementation( *this ).SetBackgroundColor( color );
94 Vector4 Window::GetBackgroundColor() const
96 return GetImplementation( *this ).GetBackgroundColor();
99 Layer Window::GetRootLayer() const
101 return GetImplementation( *this ).GetRootLayer();
104 uint32_t Window::GetLayerCount() const
106 return GetImplementation( *this ).GetLayerCount();
109 Layer Window::GetLayer( uint32_t depth ) const
111 return GetImplementation( *this ).GetLayer( depth );
114 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
116 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
118 GetImplementation(*this).ShowIndicator( visibleMode );
121 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
123 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
125 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
128 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
130 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
132 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
135 void Window::RotateIndicator( WindowOrientation orientation )
137 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
139 GetImplementation(*this).RotateIndicator( orientation );
142 void Window::SetClass( std::string name, std::string klass )
144 GetImplementation(*this).SetClass( name, klass );
149 GetImplementation(*this).Raise();
154 GetImplementation(*this).Lower();
157 void Window::Activate()
159 GetImplementation(*this).Activate();
162 void Window::AddAvailableOrientation( WindowOrientation orientation )
164 GetImplementation(*this).AddAvailableOrientation( orientation );
167 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
169 GetImplementation(*this).RemoveAvailableOrientation( orientation );
172 void Window::SetPreferredOrientation( WindowOrientation orientation )
174 GetImplementation(*this).SetPreferredOrientation( orientation );
177 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
179 return GetImplementation(*this).GetPreferredOrientation();
182 DragAndDropDetector Window::GetDragAndDropDetector() const
184 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
185 DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
186 return Dali::DragAndDropDetector();
189 Any Window::GetNativeHandle() const
191 return GetImplementation(*this).GetNativeHandle();
194 Window::FocusSignalType& Window::FocusChangedSignal()
196 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: FocusChangedSignal is deprecated and will be removed from next release.\n" );
197 return GetImplementation(*this).FocusChangedSignal();
200 Window::FocusChangeSignalType& Window::FocusChangeSignal()
202 return GetImplementation(*this).FocusChangeSignal();
205 void Window::SetAcceptFocus( bool accept )
207 GetImplementation(*this).SetAcceptFocus( accept );
210 bool Window::IsFocusAcceptable() const
212 return GetImplementation(*this).IsFocusAcceptable();
217 GetImplementation(*this).Show();
222 GetImplementation(*this).Hide();
225 bool Window::IsVisible() const
227 return GetImplementation(*this).IsVisible();
230 unsigned int Window::GetSupportedAuxiliaryHintCount() const
232 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
235 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
237 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
240 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
242 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
245 bool Window::RemoveAuxiliaryHint( unsigned int id )
247 return GetImplementation(*this).RemoveAuxiliaryHint( id );
250 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
252 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
255 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
257 return GetImplementation(*this).GetAuxiliaryHintValue( id );
260 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
262 return GetImplementation(*this).GetAuxiliaryHintId( hint );
265 void Window::SetInputRegion( const Rect< int >& inputRegion )
267 return GetImplementation(*this).SetInputRegion( inputRegion );
270 void Window::SetType( Window::Type type )
272 GetImplementation(*this).SetType( type );
275 Window::Type Window::GetType() const
277 return GetImplementation(*this).GetType();
280 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
282 return GetImplementation(*this).SetNotificationLevel( level );
285 Window::NotificationLevel::Type Window::GetNotificationLevel() const
287 return GetImplementation(*this).GetNotificationLevel();
290 void Window::SetOpaqueState( bool opaque )
292 GetImplementation(*this).SetOpaqueState( opaque );
295 bool Window::IsOpaqueState() const
297 return GetImplementation(*this).IsOpaqueState();
300 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
302 return GetImplementation(*this).SetScreenOffMode(screenMode);
305 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
307 return GetImplementation(*this).GetScreenOffMode();
310 bool Window::SetBrightness( int brightness )
312 return GetImplementation(*this).SetBrightness( brightness );
315 int Window::GetBrightness() const
317 return GetImplementation(*this).GetBrightness();
320 Window::ResizedSignalType& Window::ResizedSignal()
322 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" );
323 return GetImplementation(*this).ResizedSignal();
326 Window::ResizeSignalType& Window::ResizeSignal()
328 return GetImplementation(*this).ResizeSignal();
331 void Window::SetSize( Window::WindowSize size )
333 GetImplementation(*this).SetSize( size );
336 Window::WindowSize Window::GetSize() const
338 return GetImplementation(*this).GetSize();
341 void Window::SetPosition( Window::WindowPosition position )
343 GetImplementation(*this).SetPosition( position );
346 Window::WindowPosition Window::GetPosition() const
348 return GetImplementation(*this).GetPosition();
351 void Window::SetTransparency( bool transparent )
353 GetImplementation(*this).SetTransparency( transparent );
356 Window::Window( Internal::Adaptor::Window* window )
357 : BaseHandle( window )