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 newWindow = GlWindow(window);
42 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
43 if( isAdaptorAvailable )
45 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
46 Dali::WindowContainer windows = adaptor.GetWindows();
47 if( !windows.empty() )
49 window->SetChild( windows[0] );
61 GlWindow::GlWindow(const GlWindow& handle) = default;
63 GlWindow& GlWindow::operator=(const GlWindow& rhs) = default;
65 GlWindow::GlWindow(GlWindow&& rhs) = default;
67 GlWindow& GlWindow::operator=(GlWindow&& rhs) = default;
69 void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion version )
71 GetImplementation(*this).SetEglConfig( depth, stencil, msaa, version );
73 void GlWindow::Raise()
75 GetImplementation(*this).Raise();
77 void GlWindow::Lower()
79 GetImplementation(*this).Lower();
81 void GlWindow::Activate()
83 GetImplementation(*this).Activate();
87 GetImplementation(*this).Show();
91 GetImplementation(*this).Hide();
93 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
95 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
97 std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const
99 return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
101 unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value )
103 return GetImplementation(*this).AddAuxiliaryHint( hint, value );
105 bool GlWindow::RemoveAuxiliaryHint( unsigned int id )
107 return GetImplementation(*this).RemoveAuxiliaryHint( id );
109 bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
111 return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
113 std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const
115 return GetImplementation(*this).GetAuxiliaryHintValue( id );
117 unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const
119 return GetImplementation(*this).GetAuxiliaryHintId( hint );
121 void GlWindow::SetInputRegion( const Rect< int >& inputRegion )
123 GetImplementation(*this).SetInputRegion( inputRegion );
125 void GlWindow::SetOpaqueState( bool opaque )
127 GetImplementation(*this).SetOpaqueState( opaque );
129 bool GlWindow::IsOpaqueState() const
131 return GetImplementation(*this).IsOpaqueState();
133 void GlWindow::SetPositionSize( PositionSize positionSize )
135 GetImplementation(*this).SetPositionSize( positionSize );
137 PositionSize GlWindow::GetPositionSize() const
139 return GetImplementation(*this).GetPositionSize();
141 Dali::GlWindow::GlWindowOrientation GlWindow::GetCurrentOrientation() const
143 return GetImplementation( *this ).GetCurrentOrientation();
145 void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations )
147 GetImplementation( *this ).SetAvailableOrientations( orientations );
149 void GlWindow::SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation )
151 GetImplementation(*this).SetPreferredOrientation( orientation );
153 void GlWindow::RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate )
155 GetImplementation(*this).RegisterGlCallback( glInit, glRenderFrame, glTerminate );
157 void GlWindow::RenderOnce()
159 GetImplementation(*this).RenderOnce();
161 GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
163 return GetImplementation(*this).FocusChangeSignal();
165 GlWindow::ResizeSignalType& GlWindow::ResizeSignal()
167 return GetImplementation(*this).ResizeSignal();
169 GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
171 return GetImplementation(*this).KeyEventSignal();
173 GlWindow::TouchEventSignalType& GlWindow::TouchedSignal()
175 return GetImplementation(*this).TouchedSignal();
177 GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
179 return GetImplementation(*this).VisibilityChangedSignal();
181 GlWindow::GlWindow( Internal::Adaptor::GlWindow* window )
182 : BaseHandle( window )