2 * Copyright (c) 2021 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);
37 GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent)
40 Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New(positionSize, name, className, isTransparent);
41 newWindow = GlWindow(window);
43 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
44 if(isAdaptorAvailable)
46 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
47 Dali::WindowContainer windows = adaptor.GetWindows();
50 window->SetChild(windows[0]);
64 GlWindow::GlWindow(const GlWindow& handle) = default;
66 GlWindow& GlWindow::operator=(const GlWindow& rhs) = default;
68 GlWindow::GlWindow(GlWindow&& rhs) = default;
70 GlWindow& GlWindow::operator=(GlWindow&& rhs) = default;
72 void GlWindow::SetEglConfig(bool depth, bool stencil, int msaa, GlesVersion version)
74 GetImplementation(*this).SetEglConfig(depth, stencil, msaa, version);
77 void GlWindow::Raise()
79 GetImplementation(*this).Raise();
82 void GlWindow::Lower()
84 GetImplementation(*this).Lower();
87 void GlWindow::Activate()
89 GetImplementation(*this).Activate();
94 GetImplementation(*this).Show();
99 GetImplementation(*this).Hide();
102 unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
104 return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
107 std::string GlWindow::GetSupportedAuxiliaryHint(unsigned int index) const
109 return GetImplementation(*this).GetSupportedAuxiliaryHint(index);
112 unsigned int GlWindow::AddAuxiliaryHint(const std::string& hint, const std::string& value)
114 return GetImplementation(*this).AddAuxiliaryHint(hint, value);
117 bool GlWindow::RemoveAuxiliaryHint(unsigned int id)
119 return GetImplementation(*this).RemoveAuxiliaryHint(id);
122 bool GlWindow::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
124 return GetImplementation(*this).SetAuxiliaryHintValue(id, value);
127 std::string GlWindow::GetAuxiliaryHintValue(unsigned int id) const
129 return GetImplementation(*this).GetAuxiliaryHintValue(id);
132 unsigned int GlWindow::GetAuxiliaryHintId(const std::string& hint) const
134 return GetImplementation(*this).GetAuxiliaryHintId(hint);
137 void GlWindow::SetInputRegion(const Rect<int>& inputRegion)
139 GetImplementation(*this).SetInputRegion(inputRegion);
142 void GlWindow::SetOpaqueState(bool opaque)
144 GetImplementation(*this).SetOpaqueState(opaque);
147 bool GlWindow::IsOpaqueState() const
149 return GetImplementation(*this).IsOpaqueState();
152 void GlWindow::SetPositionSize(PositionSize positionSize)
154 GetImplementation(*this).SetPositionSize(positionSize);
157 PositionSize GlWindow::GetPositionSize() const
159 return GetImplementation(*this).GetPositionSize();
162 WindowOrientation GlWindow::GetCurrentOrientation() const
164 return GetImplementation(*this).GetCurrentOrientation();
167 void GlWindow::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
169 GetImplementation(*this).SetAvailableOrientations(orientations);
172 void GlWindow::SetPreferredOrientation(WindowOrientation orientation)
174 GetImplementation(*this).SetPreferredOrientation(orientation);
177 void GlWindow::RegisterGlCallback(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
179 GetImplementation(*this).RegisterGlCallback(initCallback, renderFrameCallback, terminateCallback);
182 void GlWindow::RenderOnce()
184 GetImplementation(*this).RenderOnce();
187 void GlWindow::SetRenderingMode(RenderingMode mode)
189 GetImplementation(*this).SetRenderingMode(mode);
192 GlWindow::RenderingMode GlWindow::GetRenderingMode() const
194 return GetImplementation(*this).GetRenderingMode();
197 GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
199 return GetImplementation(*this).FocusChangeSignal();
202 GlWindow::ResizeSignalType& GlWindow::ResizeSignal()
204 return GetImplementation(*this).ResizeSignal();
207 GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
209 return GetImplementation(*this).KeyEventSignal();
212 GlWindow::TouchEventSignalType& GlWindow::TouchedSignal()
214 return GetImplementation(*this).TouchedSignal();
217 GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
219 return GetImplementation(*this).VisibilityChangedSignal();
222 GlWindow::GlWindow(Internal::Adaptor::GlWindow* window)