Add GlWindow
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / gl-window.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/devel-api/adaptor-framework/gl-window.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/adaptor-framework/window.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/internal/window-system/common/gl-window-impl.h>
27 #include <dali/internal/window-system/common/orientation-impl.h>
28
29 namespace Dali
30 {
31 GlWindow GlWindow::New()
32 {
33   PositionSize positionSize( 0, 0, 0, 0 );
34   return Dali::GlWindow::New( positionSize, "", "", false );
35 }
36 GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent )
37 {
38   GlWindow newWindow;
39   Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New( positionSize, name, className, isTransparent );
40   newWindow = GlWindow(window);
41
42   const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
43   if( isAdaptorAvailable )
44   {
45     Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
46     Dali::WindowContainer windows = adaptor.GetWindows();
47     if( !windows.empty() )
48     {
49       window->SetChild( windows[0] );
50     }
51   }
52   return newWindow;
53 }
54 GlWindow::GlWindow()
55 {
56 }
57 GlWindow::~GlWindow()
58 {
59 }
60
61 GlWindow::GlWindow(const GlWindow& handle) = default;
62
63 GlWindow& GlWindow::operator=(const GlWindow& rhs) = default;
64
65 GlWindow::GlWindow(GlWindow&& rhs) = default;
66
67 GlWindow& GlWindow::operator=(GlWindow&& rhs) = default;
68
69 void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion version )
70 {
71   GetImplementation(*this).SetEglConfig( depth, stencil, msaa, version );
72 }
73 void GlWindow::Raise()
74 {
75   GetImplementation(*this).Raise();
76 }
77 void GlWindow::Lower()
78 {
79   GetImplementation(*this).Lower();
80 }
81 void GlWindow::Activate()
82 {
83   GetImplementation(*this).Activate();
84 }
85 void GlWindow::Show()
86 {
87   GetImplementation(*this).Show();
88 }
89 void GlWindow::Hide()
90 {
91   GetImplementation(*this).Hide();
92 }
93 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
94 {
95   return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
96 }
97 std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const
98 {
99   return GetImplementation(*this).GetSupportedAuxiliaryHint( index );
100 }
101 unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value )
102 {
103   return GetImplementation(*this).AddAuxiliaryHint( hint, value );
104 }
105 bool GlWindow::RemoveAuxiliaryHint( unsigned int id )
106 {
107   return GetImplementation(*this).RemoveAuxiliaryHint( id );
108 }
109 bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
110 {
111   return GetImplementation(*this).SetAuxiliaryHintValue( id, value );
112 }
113 std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const
114 {
115   return GetImplementation(*this).GetAuxiliaryHintValue( id );
116 }
117 unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const
118 {
119   return GetImplementation(*this).GetAuxiliaryHintId( hint );
120 }
121 void GlWindow::SetInputRegion( const Rect< int >& inputRegion )
122 {
123   GetImplementation(*this).SetInputRegion( inputRegion );
124 }
125 void GlWindow::SetOpaqueState( bool opaque )
126 {
127   GetImplementation(*this).SetOpaqueState( opaque );
128 }
129 bool GlWindow::IsOpaqueState() const
130 {
131   return GetImplementation(*this).IsOpaqueState();
132 }
133 void GlWindow::SetPositionSize( PositionSize positionSize )
134 {
135   GetImplementation(*this).SetPositionSize( positionSize );
136 }
137 PositionSize GlWindow::GetPositionSize() const
138 {
139   return GetImplementation(*this).GetPositionSize();
140 }
141 Dali::GlWindow::GlWindowOrientation GlWindow::GetCurrentOrientation() const
142 {
143   return GetImplementation( *this ).GetCurrentOrientation();
144 }
145 void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations )
146 {
147   GetImplementation( *this ).SetAvailableOrientations( orientations );
148 }
149 void GlWindow::SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation )
150 {
151   GetImplementation(*this).SetPreferredOrientation( orientation );
152 }
153 void GlWindow::RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate )
154 {
155   GetImplementation(*this).RegisterGlCallback( glInit, glRenderFrame, glTerminate );
156 }
157 void GlWindow::RenderOnce()
158 {
159   GetImplementation(*this).RenderOnce();
160 }
161 GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
162 {
163   return GetImplementation(*this).FocusChangeSignal();
164 }
165 GlWindow::ResizeSignalType& GlWindow::ResizeSignal()
166 {
167   return GetImplementation(*this).ResizeSignal();
168 }
169 GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
170 {
171   return GetImplementation(*this).KeyEventSignal();
172 }
173 GlWindow::TouchEventSignalType& GlWindow::TouchedSignal()
174 {
175   return GetImplementation(*this).TouchedSignal();
176 }
177 GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
178 {
179   return GetImplementation(*this).VisibilityChangedSignal();
180 }
181 GlWindow::GlWindow( Internal::Adaptor::GlWindow* window )
182 : BaseHandle( window )
183 {
184 }
185
186 }// Dali