1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/internal/window-system/common/window-base.h>
23 #include <dali/internal/window-system/windows/event-system-win.h>
24 #include <dali/internal/window-system/windows/platform-implement-win.h>
33 class WindowRenderSurface;
34 class WindowRenderSurfaceWin;
37 * WindowBaseWin class provides an WindowBase Win32 implementation.
39 class WindowBaseWin : public WindowBase
45 WindowBaseWin(PositionSize positionSize, Any surface, bool isTransparent);
50 virtual ~WindowBaseWin();
54 * Called when the window receives a delete request
56 void OnDeleteRequest();
59 * @brief Called when the window gains focus.
61 void OnFocusIn(int type, TWinEventInfo* event);
64 * @brief Called when the window loses focus.
66 void OnFocusOut(int type, TWinEventInfo* event);
69 * @brief Called when the window is damaged.
71 void OnWindowDamaged(int type, TWinEventInfo* event);
74 * @brief Called when a touch down is received.
76 void OnMouseButtonDown(int type, TWinEventInfo* event);
79 * @brief Called when a touch up is received.
81 void OnMouseButtonUp(int type, TWinEventInfo* event);
84 * @brief Called when a touch motion is received.
86 void OnMouseButtonMove(int type, TWinEventInfo* event);
89 * @brief Called when a mouse wheel is received.
91 void OnMouseWheel(int type, TWinEventInfo* event);
94 * @brief Called when a key down is received.
96 void OnKeyDown(int type, TWinEventInfo* event);
99 * @brief Called when a key up is received.
101 void OnKeyUp(int type, TWinEventInfo* event);
105 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
107 Any GetNativeWindow() override;
110 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
112 int GetNativeWindowId() override;
115 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
117 EGLNativeWindowType CreateEglWindow(int width, int height) override;
120 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
122 void DestroyEglWindow() override;
125 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
127 void SetEglWindowRotation(int angle) override;
130 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
132 void SetEglWindowBufferTransform(int angle) override;
135 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
137 void SetEglWindowTransform(int angle) override;
140 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
142 void ResizeEglWindow(PositionSize positionSize) override;
145 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
147 bool IsEglWindowRotationSupported() override;
150 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
152 void Move(PositionSize positionSize) override;
155 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
157 void Resize(PositionSize positionSize) override;
160 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
162 void MoveResize(PositionSize positionSize) override;
165 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
167 void SetClass(const std::string& name, const std::string& className) override;
170 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
172 void Raise() override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
177 void Lower() override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
182 void Activate() override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
187 void SetAvailableAnlges(const std::vector<int>& angles) override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
192 void SetPreferredAngle(int angle) override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
197 void SetAcceptFocus(bool accept) override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
202 void Show() override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
207 void Hide() override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
212 unsigned int GetSupportedAuxiliaryHintCount() const override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
217 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
222 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
227 bool RemoveAuxiliaryHint(unsigned int id) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
232 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
237 std::string GetAuxiliaryHintValue(unsigned int id) const override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
242 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
247 void SetInputRegion(const Rect<int>& inputRegion) override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
252 void SetType(Dali::WindowType type) override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
257 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
262 Dali::WindowNotificationLevel GetNotificationLevel() const override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
267 void SetOpaqueState(bool opaque) override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
272 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
277 WindowScreenOffMode GetScreenOffMode() const override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
282 Dali::WindowOperationResult SetBrightness(int brightness) override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
287 int GetBrightness() const override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
292 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
297 bool UngrabKey(Dali::KEY key) override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
302 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
307 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
312 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
317 int GetScreenRotationAngle() override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
322 void SetWindowRotationAngle(int degree) override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
327 void WindowRotationCompleted(int degree, int width, int height) override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
332 void SetTransparency(bool transparent) override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
337 int GetOrientation() const override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
342 void SetParent(WindowBase* parentWinBase) override;
345 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
347 int CreateFrameRenderedSyncFence() override;
350 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
352 int CreateFramePresentedSyncFence() override;
356 * Second stage initialization
358 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
361 * @brief Get the surface id if the surface parameter is not empty
362 * @param surface Any containing a surface id, or can be empty
363 * @return surface id, or zero if surface is empty
365 uintptr_t GetSurfaceId(Any surface) const;
368 * @brief Create window
370 void CreateWinWindow(PositionSize positionSize, bool isTransparent);
373 * @brief Sets up an already created window.
375 void SetWinWindow(uintptr_t surfaceId);
379 WindowBaseWin(const WindowBaseWin&) = delete;
382 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
385 void EventEntry(TWinEventInfo* event);
388 WinWindowHandle mWin32Window; ///< Native window handle
389 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
390 bool mIsTransparent : 1; ///< Whether the window is transparent (32 bit or 24 bit)
391 bool mRotationAppSet : 1;
393 WindowsPlatform::WindowImpl mWindowImpl;
396 } // namespace Adaptor
398 } // namespace Internal
402 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H