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>
32 GlWindow GlWindow::New()
34 PositionSize positionSize( 0, 0, 0, 0 );
35 return Dali::GlWindow::New( positionSize, "", "", false );
38 GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent )
41 Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New( positionSize, name, className, isTransparent );
42 newWindow = GlWindow(window);
44 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
45 if( isAdaptorAvailable )
47 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
48 Dali::WindowContainer windows = adaptor.GetWindows();
49 if( !windows.empty() )
51 window->SetChild( windows[0] );
65 GlWindow::GlWindow(const GlWindow& handle) = default;
67 GlWindow& GlWindow::operator=(const GlWindow& rhs) = default;
69 GlWindow::GlWindow(GlWindow&& rhs) = default;
71 GlWindow& GlWindow::operator=(GlWindow&& rhs) = default;
73 void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion version )
75 GetImplementation(*this).SetEglConfig( depth, stencil, msaa, version );
78 void GlWindow::Raise()
80 GetImplementation(*this).Raise();
83 void GlWindow::Lower()
85 GetImplementation(*this).Lower();
88 void GlWindow::Activate()
90 GetImplementation(*this).Activate();
95 GetImplementation(*this).Show();
100 GetImplementation(*this).Hide();
103 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
105 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
108 std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const
110 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
113 unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value )
115 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
118 bool GlWindow::RemoveAuxiliaryHint( unsigned int id )
120 return GetImplementation(*this).RemoveAuxiliaryHint( id );
123 bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
125 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
128 std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const
130 return GetImplementation(*this).GetAuxiliaryHintValue( id );
133 unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const
135 return GetImplementation(*this).GetAuxiliaryHintId( hint );
138 void GlWindow::SetInputRegion( const Rect< int >& inputRegion )
140 GetImplementation(*this).SetInputRegion( inputRegion );
143 void GlWindow::SetOpaqueState( bool opaque )
145 GetImplementation(*this).SetOpaqueState( opaque );
148 bool GlWindow::IsOpaqueState() const
150 return GetImplementation(*this).IsOpaqueState();
153 void GlWindow::SetPositionSize( PositionSize positionSize )
155 GetImplementation(*this).SetPositionSize( positionSize );
158 PositionSize GlWindow::GetPositionSize() const
160 return GetImplementation(*this).GetPositionSize();
163 WindowOrientation GlWindow::GetCurrentOrientation() const
165 return GetImplementation( *this ).GetCurrentOrientation();
168 void GlWindow::SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations )
170 GetImplementation( *this ).SetAvailableOrientations( orientations );
173 void GlWindow::SetPreferredOrientation( WindowOrientation orientation )
175 GetImplementation(*this).SetPreferredOrientation( orientation );
178 void GlWindow::RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback )
180 GetImplementation(*this).RegisterGlCallback( initCallback, renderFrameCallback, terminateCallback );
183 void GlWindow::RenderOnce()
185 GetImplementation(*this).RenderOnce();
188 void GlWindow::SetRenderingMode( RenderingMode mode )
190 GetImplementation(*this).SetRenderingMode( mode );
193 GlWindow::RenderingMode GlWindow::GetRenderingMode() const
195 return GetImplementation(*this).GetRenderingMode();
198 GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
200 return GetImplementation(*this).FocusChangeSignal();
203 GlWindow::ResizeSignalType& GlWindow::ResizeSignal()
205 return GetImplementation(*this).ResizeSignal();
208 GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
210 return GetImplementation(*this).KeyEventSignal();
213 GlWindow::TouchEventSignalType& GlWindow::TouchedSignal()
215 return GetImplementation(*this).TouchedSignal();
218 GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
220 return GetImplementation(*this).VisibilityChangedSignal();
223 GlWindow::GlWindow( Internal::Adaptor::GlWindow* window )
224 : BaseHandle( window )