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/public-api/actors/actor.h>
23 #include <dali/internal/window-system/common/window-impl.h>
24 #include <dali/internal/window-system/common/orientation-impl.h>
29 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
31 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
33 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
34 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
35 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
37 return Window(window);
40 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
42 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
44 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
45 Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
46 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, className, isTransparent );
48 return Window(window);
59 Window::Window(const Window& handle)
64 Window& Window::operator=(const Window& rhs)
66 BaseHandle::operator=(rhs);
70 void Window::Add( Dali::Actor actor )
72 GetImplementation( *this ).Add( actor );
75 void Window::Remove( Dali::Actor actor )
77 GetImplementation( *this ).Remove( actor );
80 void Window::SetBackgroundColor( const Vector4& color )
82 GetImplementation( *this ).SetBackgroundColor( color );
85 Vector4 Window::GetBackgroundColor() const
87 return GetImplementation( *this ).GetBackgroundColor();
90 Layer Window::GetRootLayer() const
92 return GetImplementation( *this ).GetRootLayer();
95 uint32_t Window::GetLayerCount() const
97 return GetImplementation( *this ).GetLayerCount();
100 Layer Window::GetLayer( uint32_t depth ) const
102 return GetImplementation( *this ).GetLayer( depth );
105 void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
107 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
109 GetImplementation(*this).ShowIndicator( visibleMode );
112 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
114 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
116 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
119 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
121 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
123 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
126 void Window::RotateIndicator( WindowOrientation orientation )
128 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
130 GetImplementation(*this).RotateIndicator( orientation );
133 void Window::SetClass( std::string name, std::string klass )
135 GetImplementation(*this).SetClass( name, klass );
140 GetImplementation(*this).Raise();
145 GetImplementation(*this).Lower();
148 void Window::Activate()
150 GetImplementation(*this).Activate();
153 void Window::AddAvailableOrientation( WindowOrientation orientation )
155 GetImplementation(*this).AddAvailableOrientation( orientation );
158 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
160 GetImplementation(*this).RemoveAvailableOrientation( orientation );
163 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
165 GetImplementation(*this).SetPreferredOrientation( orientation );
168 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
170 return GetImplementation(*this).GetPreferredOrientation();
173 DragAndDropDetector Window::GetDragAndDropDetector() const
175 return GetImplementation(*this).GetDragAndDropDetector();
178 Any Window::GetNativeHandle() const
180 return GetImplementation(*this).GetNativeHandle();
183 Window::FocusSignalType& Window::FocusChangedSignal()
185 return GetImplementation(*this).FocusChangedSignal();
188 void Window::SetAcceptFocus( bool accept )
190 GetImplementation(*this).SetAcceptFocus( accept );
193 bool Window::IsFocusAcceptable() const
195 return GetImplementation(*this).IsFocusAcceptable();
200 GetImplementation(*this).Show();
205 GetImplementation(*this).Hide();
208 bool Window::IsVisible() const
210 return GetImplementation(*this).IsVisible();
213 unsigned int Window::GetSupportedAuxiliaryHintCount() const
215 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
218 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
220 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
223 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
225 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
228 bool Window::RemoveAuxiliaryHint( unsigned int id )
230 return GetImplementation(*this).RemoveAuxiliaryHint( id );
233 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
235 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
238 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
240 return GetImplementation(*this).GetAuxiliaryHintValue( id );
243 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
245 return GetImplementation(*this).GetAuxiliaryHintId( hint );
248 void Window::SetInputRegion( const Rect< int >& inputRegion )
250 return GetImplementation(*this).SetInputRegion( inputRegion );
253 void Window::SetType( Window::Type type )
255 GetImplementation(*this).SetType( type );
258 Window::Type Window::GetType() const
260 return GetImplementation(*this).GetType();
263 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
265 return GetImplementation(*this).SetNotificationLevel( level );
268 Window::NotificationLevel::Type Window::GetNotificationLevel() const
270 return GetImplementation(*this).GetNotificationLevel();
273 void Window::SetOpaqueState( bool opaque )
275 GetImplementation(*this).SetOpaqueState( opaque );
278 bool Window::IsOpaqueState() const
280 return GetImplementation(*this).IsOpaqueState();
283 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
285 return GetImplementation(*this).SetScreenOffMode(screenMode);
288 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
290 return GetImplementation(*this).GetScreenOffMode();
293 bool Window::SetBrightness( int brightness )
295 return GetImplementation(*this).SetBrightness( brightness );
298 int Window::GetBrightness() const
300 return GetImplementation(*this).GetBrightness();
303 Window::ResizedSignalType& Window::ResizedSignal()
305 return GetImplementation(*this).ResizedSignal();
308 void Window::SetSize( Window::WindowSize size )
310 GetImplementation(*this).SetSize( size );
313 Window::WindowSize Window::GetSize() const
315 return GetImplementation(*this).GetSize();
318 void Window::SetPosition( Window::WindowPosition position )
320 GetImplementation(*this).SetPosition( position );
323 Window::WindowPosition Window::GetPosition() const
325 return GetImplementation(*this).GetPosition();
328 void Window::SetTransparency( bool transparent )
330 GetImplementation(*this).SetTransparency( transparent );
333 Window::Window( Internal::Adaptor::Window* window )
334 : BaseHandle( window )