2 * Copyright (c) 2017 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::ShowIndicator( IndicatorVisibleMode visibleMode )
77 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
79 GetImplementation(*this).ShowIndicator( visibleMode );
82 Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
84 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
86 return GetImplementation(*this).IndicatorVisibilityChangedSignal();
89 void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
91 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
93 GetImplementation(*this).SetIndicatorBgOpacity( opacity );
96 void Window::RotateIndicator( WindowOrientation orientation )
98 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
100 GetImplementation(*this).RotateIndicator( orientation );
103 void Window::SetClass( std::string name, std::string klass )
105 GetImplementation(*this).SetClass( name, klass );
110 GetImplementation(*this).Raise();
115 GetImplementation(*this).Lower();
118 void Window::Activate()
120 GetImplementation(*this).Activate();
123 void Window::AddAvailableOrientation( WindowOrientation orientation )
125 GetImplementation(*this).AddAvailableOrientation( orientation );
128 void Window::RemoveAvailableOrientation( WindowOrientation orientation )
130 GetImplementation(*this).RemoveAvailableOrientation( orientation );
133 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
135 GetImplementation(*this).SetPreferredOrientation( orientation );
138 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
140 return GetImplementation(*this).GetPreferredOrientation();
143 DragAndDropDetector Window::GetDragAndDropDetector() const
145 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetDragAndDropDetector is deprecated and will be removed from the next release.\n" );
146 DALI_ASSERT_ALWAYS( &GetImplementation( *this ) == GetObjectPtr() && "Empty Handle" );
147 return Dali::DragAndDropDetector();
150 Any Window::GetNativeHandle() const
152 return GetImplementation(*this).GetNativeHandle();
155 Window::FocusSignalType& Window::FocusChangedSignal()
157 return GetImplementation(*this).FocusChangedSignal();
160 void Window::SetAcceptFocus( bool accept )
162 GetImplementation(*this).SetAcceptFocus( accept );
165 bool Window::IsFocusAcceptable() const
167 return GetImplementation(*this).IsFocusAcceptable();
172 GetImplementation(*this).Show();
177 GetImplementation(*this).Hide();
180 bool Window::IsVisible() const
182 return GetImplementation(*this).IsVisible();
185 unsigned int Window::GetSupportedAuxiliaryHintCount() const
187 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
190 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
192 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
195 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
197 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
200 bool Window::RemoveAuxiliaryHint( unsigned int id )
202 return GetImplementation(*this).RemoveAuxiliaryHint( id );
205 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
207 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
210 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
212 return GetImplementation(*this).GetAuxiliaryHintValue( id );
215 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
217 return GetImplementation(*this).GetAuxiliaryHintId( hint );
220 void Window::SetInputRegion( const Rect< int >& inputRegion )
222 return GetImplementation(*this).SetInputRegion( inputRegion );
225 void Window::SetType( Window::Type type )
227 GetImplementation(*this).SetType( type );
230 Window::Type Window::GetType() const
232 return GetImplementation(*this).GetType();
235 bool Window::SetNotificationLevel( Window::NotificationLevel::Type level )
237 return GetImplementation(*this).SetNotificationLevel( level );
240 Window::NotificationLevel::Type Window::GetNotificationLevel() const
242 return GetImplementation(*this).GetNotificationLevel();
245 void Window::SetOpaqueState( bool opaque )
247 GetImplementation(*this).SetOpaqueState( opaque );
250 bool Window::IsOpaqueState() const
252 return GetImplementation(*this).IsOpaqueState();
255 bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode)
257 return GetImplementation(*this).SetScreenOffMode(screenMode);
260 Window::ScreenOffMode::Type Window::GetScreenOffMode() const
262 return GetImplementation(*this).GetScreenOffMode();
265 bool Window::SetBrightness( int brightness )
267 return GetImplementation(*this).SetBrightness( brightness );
270 int Window::GetBrightness() const
272 return GetImplementation(*this).GetBrightness();
275 Window::ResizedSignalType& Window::ResizedSignal()
277 return GetImplementation(*this).ResizedSignal();
280 void Window::SetSize( Window::WindowSize size )
282 GetImplementation(*this).SetSize( size );
285 Window::WindowSize Window::GetSize() const
287 return GetImplementation(*this).GetSize();
290 void Window::SetPosition( Window::WindowPosition position )
292 GetImplementation(*this).SetPosition( position );
295 Window::WindowPosition Window::GetPosition() const
297 return GetImplementation(*this).GetPosition();
300 void Window::SetTransparency( bool transparent )
302 GetImplementation(*this).SetTransparency( transparent );
305 Window::Window( Internal::Adaptor::Window* window )
306 : BaseHandle( window )