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/adaptor/common/adaptor-impl.h>
27 #include <dali/internal/window-system/common/window-impl.h>
28 #include <dali/internal/window-system/common/orientation-impl.h>
33 class DALI_INTERNAL DragAndDropDetector : public BaseHandle {}; // Empty class only required to compile Deprecated API GetDragAndDropDetector
35 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
37 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
39 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
40 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
41 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
43 return Window(window);
46 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
48 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 );
54 return Window(window);
65 Window::Window(const Window& handle)
70 Window& Window::operator=(const Window& rhs)
72 BaseHandle::operator=(rhs);
76 void Window::Add( Dali::Actor actor )
78 GetImplementation( *this ).Add( actor );
81 void Window::Remove( Dali::Actor actor )
83 GetImplementation( *this ).Remove( actor );
86 void Window::SetBackgroundColor( const Vector4& color )
88 GetImplementation( *this ).SetBackgroundColor( color );
91 Vector4 Window::GetBackgroundColor() const
93 return GetImplementation( *this ).GetBackgroundColor();
96 Layer Window::GetRootLayer() const
98 return GetImplementation( *this ).GetRootLayer();
101 uint32_t Window::GetLayerCount() const
103 return GetImplementation( *this ).GetLayerCount();
106 Layer Window::GetLayer( uint32_t depth ) const
108 return GetImplementation( *this ).GetLayer( depth );
111 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
113 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
115 GetImplementation(*this).ShowIndicator( visibleMode );
118 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
120 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
122 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
125 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
127 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
129 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
132 void Window::RotateIndicator( WindowOrientation orientation )
134 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
136 GetImplementation(*this).RotateIndicator( orientation );
139 void Window::SetClass( std::string name, std::string klass )
141 GetImplementation(*this).SetClass( name, klass );
146 GetImplementation(*this).Raise();
151 GetImplementation(*this).Lower();
154 void Window::Activate()
156 GetImplementation(*this).Activate();
159 void Window::AddAvailableOrientation( WindowOrientation orientation )
161 GetImplementation(*this).AddAvailableOrientation( orientation );
164 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
166 GetImplementation(*this).RemoveAvailableOrientation( orientation );
169 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
171 GetImplementation(*this).SetPreferredOrientation( orientation );
174 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
176 return GetImplementation(*this).GetPreferredOrientation();
179 DragAndDropDetector Window::GetDragAndDropDetector() const
181 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
182 DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
183 return Dali::DragAndDropDetector();
186 Any Window::GetNativeHandle() const
188 return GetImplementation(*this).GetNativeHandle();
191 Window::FocusSignalType& Window::FocusChangedSignal()
193 return GetImplementation(*this).FocusChangedSignal();
196 void Window::SetAcceptFocus( bool accept )
198 GetImplementation(*this).SetAcceptFocus( accept );
201 bool Window::IsFocusAcceptable() const
203 return GetImplementation(*this).IsFocusAcceptable();
208 GetImplementation(*this).Show();
213 GetImplementation(*this).Hide();
216 bool Window::IsVisible() const
218 return GetImplementation(*this).IsVisible();
221 unsigned int Window::GetSupportedAuxiliaryHintCount() const
223 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
226 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
228 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
231 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
233 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
236 bool Window::RemoveAuxiliaryHint( unsigned int id )
238 return GetImplementation(*this).RemoveAuxiliaryHint( id );
241 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
243 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
246 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
248 return GetImplementation(*this).GetAuxiliaryHintValue( id );
251 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
253 return GetImplementation(*this).GetAuxiliaryHintId( hint );
256 void Window::SetInputRegion( const Rect< int >& inputRegion )
258 return GetImplementation(*this).SetInputRegion( inputRegion );
261 void Window::SetType( Window::Type type )
263 GetImplementation(*this).SetType( type );
266 Window::Type Window::GetType() const
268 return GetImplementation(*this).GetType();
271 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
273 return GetImplementation(*this).SetNotificationLevel( level );
276 Window::NotificationLevel::Type Window::GetNotificationLevel() const
278 return GetImplementation(*this).GetNotificationLevel();
281 void Window::SetOpaqueState( bool opaque )
283 GetImplementation(*this).SetOpaqueState( opaque );
286 bool Window::IsOpaqueState() const
288 return GetImplementation(*this).IsOpaqueState();
291 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
293 return GetImplementation(*this).SetScreenOffMode(screenMode);
296 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
298 return GetImplementation(*this).GetScreenOffMode();
301 bool Window::SetBrightness( int brightness )
303 return GetImplementation(*this).SetBrightness( brightness );
306 int Window::GetBrightness() const
308 return GetImplementation(*this).GetBrightness();
311 Window::ResizedSignalType& Window::ResizedSignal()
313 return GetImplementation(*this).ResizedSignal();
316 void Window::SetSize( Window::WindowSize size )
318 GetImplementation(*this).SetSize( size );
321 Window::WindowSize Window::GetSize() const
323 return GetImplementation(*this).GetSize();
326 void Window::SetPosition( Window::WindowPosition position )
328 GetImplementation(*this).SetPosition( position );
331 Window::WindowPosition Window::GetPosition() const
333 return GetImplementation(*this).GetPosition();
336 void Window::SetTransparency( bool transparent )
338 GetImplementation(*this).SetTransparency( transparent );
341 Window::Window( Internal::Adaptor::Window* window )
342 : BaseHandle( window )