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 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: FocusChangedSignal is deprecated and will be removed from next release.\n" );
193 return GetImplementation(*this).FocusChangedSignal();
196 Window::FocusChangeSignalType& Window::FocusChangeSignal()
198 return GetImplementation(*this).FocusChangeSignal();
201 void Window::SetAcceptFocus( bool accept )
203 GetImplementation(*this).SetAcceptFocus( accept );
206 bool Window::IsFocusAcceptable() const
208 return GetImplementation(*this).IsFocusAcceptable();
213 GetImplementation(*this).Show();
218 GetImplementation(*this).Hide();
221 bool Window::IsVisible() const
223 return GetImplementation(*this).IsVisible();
226 unsigned int Window::GetSupportedAuxiliaryHintCount() const
228 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
231 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
233 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
236 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
238 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
241 bool Window::RemoveAuxiliaryHint( unsigned int id )
243 return GetImplementation(*this).RemoveAuxiliaryHint( id );
246 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
248 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
251 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
253 return GetImplementation(*this).GetAuxiliaryHintValue( id );
256 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
258 return GetImplementation(*this).GetAuxiliaryHintId( hint );
261 void Window::SetInputRegion( const Rect< int >& inputRegion )
263 return GetImplementation(*this).SetInputRegion( inputRegion );
266 void Window::SetType( Window::Type type )
268 GetImplementation(*this).SetType( type );
271 Window::Type Window::GetType() const
273 return GetImplementation(*this).GetType();
276 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
278 return GetImplementation(*this).SetNotificationLevel( level );
281 Window::NotificationLevel::Type Window::GetNotificationLevel() const
283 return GetImplementation(*this).GetNotificationLevel();
286 void Window::SetOpaqueState( bool opaque )
288 GetImplementation(*this).SetOpaqueState( opaque );
291 bool Window::IsOpaqueState() const
293 return GetImplementation(*this).IsOpaqueState();
296 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
298 return GetImplementation(*this).SetScreenOffMode(screenMode);
301 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
303 return GetImplementation(*this).GetScreenOffMode();
306 bool Window::SetBrightness( int brightness )
308 return GetImplementation(*this).SetBrightness( brightness );
311 int Window::GetBrightness() const
313 return GetImplementation(*this).GetBrightness();
316 Window::ResizedSignalType& Window::ResizedSignal()
318 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" );
319 return GetImplementation(*this).ResizedSignal();
322 Window::ResizeSignalType& Window::ResizeSignal()
324 return GetImplementation(*this).ResizeSignal();
327 void Window::SetSize( Window::WindowSize size )
329 GetImplementation(*this).SetSize( size );
332 Window::WindowSize Window::GetSize() const
334 return GetImplementation(*this).GetSize();
337 void Window::SetPosition( Window::WindowPosition position )
339 GetImplementation(*this).SetPosition( position );
342 Window::WindowPosition Window::GetPosition() const
344 return GetImplementation(*this).GetPosition();
347 void Window::SetTransparency( bool transparent )
349 GetImplementation(*this).SetTransparency( transparent );
352 Window::Window( Internal::Adaptor::Window* window )
353 : BaseHandle( window )