2 * Copyright (c) 2020 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/devel-api/adaptor-framework/gl-window.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/adaptor-framework/window.h>
26 #include <dali/internal/window-system/common/gl-window-impl.h>
27 #include <dali/internal/window-system/common/orientation-impl.h>
31 GlWindow GlWindow::New()
33 PositionSize positionSize( 0, 0, 0, 0 );
34 return Dali::GlWindow::New( positionSize, "", "", false );
36 GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent )
39 Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New( positionSize, name, className, isTransparent );
40 if( window == nullptr )
42 DALI_LOG_ERROR("Fail to create gl-window-impl\n");
46 newWindow = GlWindow(window);
48 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
49 if( isAdaptorAvailable )
51 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
52 Dali::WindowContainer windows = adaptor.GetWindows();
53 if( !windows.empty() )
55 window->SetChild( windows[0] );
66 GlWindow::GlWindow(const GlWindow& handle)
70 GlWindow& GlWindow::operator=(const GlWindow& rhs)
72 BaseHandle::operator=(rhs);
75 void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion version )
77 GetImplementation(*this).SetEglConfig( depth, stencil, msaa, version );
79 void GlWindow::Raise()
81 GetImplementation(*this).Raise();
83 void GlWindow::Lower()
85 GetImplementation(*this).Lower();
87 void GlWindow::Activate()
89 GetImplementation(*this).Activate();
93 GetImplementation(*this).Show();
97 GetImplementation(*this).Hide();
99 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
101 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
103 std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const
105 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
107 unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value )
109 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
111 bool GlWindow::RemoveAuxiliaryHint( unsigned int id )
113 return GetImplementation(*this).RemoveAuxiliaryHint( id );
115 bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
117 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
119 std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const
121 return GetImplementation(*this).GetAuxiliaryHintValue( id );
123 unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const
125 return GetImplementation(*this).GetAuxiliaryHintId( hint );
127 void GlWindow::SetInputRegion( const Rect< int >& inputRegion )
129 GetImplementation(*this).SetInputRegion( inputRegion );
131 void GlWindow::SetOpaqueState( bool opaque )
133 GetImplementation(*this).SetOpaqueState( opaque );
135 bool GlWindow::IsOpaqueState() const
137 return GetImplementation(*this).IsOpaqueState();
139 void GlWindow::SetPositionSize( PositionSize positionSize )
141 GetImplementation(*this).SetPositionSize( positionSize );
143 PositionSize GlWindow::GetPositionSize() const
145 return GetImplementation(*this).GetPositionSize();
147 Dali::GlWindow::GlWindowOrientation GlWindow::GetCurrentOrientation() const
149 return GetImplementation( *this ).GetCurrentOrientation();
151 void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations )
153 GetImplementation( *this ).SetAvailableOrientations( orientations );
155 void GlWindow::SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation )
157 GetImplementation(*this).SetPreferredOrientation( orientation );
159 void GlWindow::RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate )
161 GetImplementation(*this).RegisterGlCallback( glInit, glRenderFrame, glTerminate );
163 void GlWindow::RenderOnce()
165 GetImplementation(*this).RenderOnce();
167 GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
169 return GetImplementation(*this).FocusChangeSignal();
171 GlWindow::ResizedSignalType& GlWindow::ResizedSignal()
173 return GetImplementation(*this).ResizedSignal();
175 GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
177 return GetImplementation(*this).KeyEventSignal();
179 GlWindow::TouchSignalType& GlWindow::TouchSignal()
181 return GetImplementation(*this).TouchSignal();
183 GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
185 return GetImplementation(*this).VisibilityChangedSignal();
187 GlWindow::GlWindow( Internal::Adaptor::GlWindow* window )
188 : BaseHandle( window )