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 if( Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() )
41 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
42 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, "", isTransparent );
44 return Window(window);
48 DALI_LOG_ERROR("This device can't support multiple windows.\n");
53 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
55 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
57 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
58 if( Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() )
60 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
61 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, className, isTransparent );
63 return Window(window);
67 DALI_LOG_ERROR("This device can't support multiple windows.\n");
80 Window::Window(const Window& handle)
85 Window& Window::operator=(const Window& rhs)
87 BaseHandle::operator=(rhs);
91 void Window::Add( Dali::Actor actor )
93 GetImplementation( *this ).Add( actor );
96 void Window::Remove( Dali::Actor actor )
98 GetImplementation( *this ).Remove( actor );
101 void Window::SetBackgroundColor( const Vector4& color )
103 GetImplementation( *this ).SetBackgroundColor( color );
106 Vector4 Window::GetBackgroundColor() const
108 return GetImplementation( *this ).GetBackgroundColor();
111 Layer Window::GetRootLayer() const
113 return GetImplementation( *this ).GetRootLayer();
116 uint32_t Window::GetLayerCount() const
118 return GetImplementation( *this ).GetLayerCount();
121 Layer Window::GetLayer( uint32_t depth ) const
123 return GetImplementation( *this ).GetLayer( depth );
126 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
128 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
130 GetImplementation(*this).ShowIndicator( visibleMode );
133 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
135 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
137 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
140 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
142 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
144 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
147 void Window::RotateIndicator( WindowOrientation orientation )
149 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
151 GetImplementation(*this).RotateIndicator( orientation );
154 void Window::SetClass( std::string name, std::string klass )
156 GetImplementation(*this).SetClass( name, klass );
161 GetImplementation(*this).Raise();
166 GetImplementation(*this).Lower();
169 void Window::Activate()
171 GetImplementation(*this).Activate();
174 void Window::AddAvailableOrientation( WindowOrientation orientation )
176 GetImplementation(*this).AddAvailableOrientation( orientation );
179 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
181 GetImplementation(*this).RemoveAvailableOrientation( orientation );
184 void Window::SetPreferredOrientation( WindowOrientation orientation )
186 GetImplementation(*this).SetPreferredOrientation( orientation );
189 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
191 return GetImplementation(*this).GetPreferredOrientation();
194 DragAndDropDetector Window::GetDragAndDropDetector() const
196 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
197 DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
198 return Dali::DragAndDropDetector();
201 Any Window::GetNativeHandle() const
203 return GetImplementation(*this).GetNativeHandle();
206 Window::FocusSignalType& Window::FocusChangedSignal()
208 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: FocusChangedSignal is deprecated and will be removed from next release.\n" );
209 return GetImplementation(*this).FocusChangedSignal();
212 Window::FocusChangeSignalType& Window::FocusChangeSignal()
214 return GetImplementation(*this).FocusChangeSignal();
217 void Window::SetAcceptFocus( bool accept )
219 GetImplementation(*this).SetAcceptFocus( accept );
222 bool Window::IsFocusAcceptable() const
224 return GetImplementation(*this).IsFocusAcceptable();
229 GetImplementation(*this).Show();
234 GetImplementation(*this).Hide();
237 bool Window::IsVisible() const
239 return GetImplementation(*this).IsVisible();
242 unsigned int Window::GetSupportedAuxiliaryHintCount() const
244 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
247 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
249 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
252 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
254 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
257 bool Window::RemoveAuxiliaryHint( unsigned int id )
259 return GetImplementation(*this).RemoveAuxiliaryHint( id );
262 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
264 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
267 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
269 return GetImplementation(*this).GetAuxiliaryHintValue( id );
272 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
274 return GetImplementation(*this).GetAuxiliaryHintId( hint );
277 void Window::SetInputRegion( const Rect< int >& inputRegion )
279 return GetImplementation(*this).SetInputRegion( inputRegion );
282 void Window::SetType( Window::Type type )
284 GetImplementation(*this).SetType( type );
287 Window::Type Window::GetType() const
289 return GetImplementation(*this).GetType();
292 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
294 return GetImplementation(*this).SetNotificationLevel( level );
297 Window::NotificationLevel::Type Window::GetNotificationLevel() const
299 return GetImplementation(*this).GetNotificationLevel();
302 void Window::SetOpaqueState( bool opaque )
304 GetImplementation(*this).SetOpaqueState( opaque );
307 bool Window::IsOpaqueState() const
309 return GetImplementation(*this).IsOpaqueState();
312 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
314 return GetImplementation(*this).SetScreenOffMode(screenMode);
317 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
319 return GetImplementation(*this).GetScreenOffMode();
322 bool Window::SetBrightness( int brightness )
324 return GetImplementation(*this).SetBrightness( brightness );
327 int Window::GetBrightness() const
329 return GetImplementation(*this).GetBrightness();
332 Window::ResizedSignalType& Window::ResizedSignal()
334 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" );
335 return GetImplementation(*this).ResizedSignal();
338 Window::ResizeSignalType& Window::ResizeSignal()
340 return GetImplementation(*this).ResizeSignal();
343 void Window::SetSize( Window::WindowSize size )
345 GetImplementation(*this).SetSize( size );
348 Window::WindowSize Window::GetSize() const
350 return GetImplementation(*this).GetSize();
353 void Window::SetPosition( Window::WindowPosition position )
355 GetImplementation(*this).SetPosition( position );
358 Window::WindowPosition Window::GetPosition() const
360 return GetImplementation(*this).GetPosition();
363 void Window::SetTransparency( bool transparent )
365 GetImplementation(*this).SetTransparency( transparent );
368 Window::Window( Internal::Adaptor::Window* window )
369 : BaseHandle( window )