1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
5 * Copyright (c) 2023 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::GetNativeWindowResourceId()
117 std::string GetNativeWindowResourceId() override;
120 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
122 EGLNativeWindowType CreateEglWindow(int width, int height) override;
125 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
127 void DestroyEglWindow() override;
130 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
132 void SetEglWindowRotation(int angle) override;
135 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
137 void SetEglWindowBufferTransform(int angle) override;
140 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
142 void SetEglWindowTransform(int angle) override;
145 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
147 void ResizeEglWindow(PositionSize positionSize) override;
150 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
152 bool IsEglWindowRotationSupported() override;
155 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
157 void Move(PositionSize positionSize) override;
160 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
162 void Resize(PositionSize positionSize) override;
165 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
167 void MoveResize(PositionSize positionSize) override;
170 * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
172 void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
177 void SetClass(const std::string& name, const std::string& className) override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
182 void Raise() override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
187 void Lower() override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
192 void Activate() override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
197 void Maximize(bool maximize) override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
202 bool IsMaximized() const override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
207 void SetMaximumSize(Dali::Window::WindowSize size) override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
212 void Minimize(bool minimize) override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
217 bool IsMinimized() const override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
222 void SetMimimumSize(Dali::Window::WindowSize size) override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
227 void SetAvailableAnlges(const std::vector<int>& angles) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
232 void SetPreferredAngle(int angle) override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
237 void SetAcceptFocus(bool accept) override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
242 void Show() override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
247 void Hide() override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
252 unsigned int GetSupportedAuxiliaryHintCount() const override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
257 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
262 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
267 bool RemoveAuxiliaryHint(unsigned int id) override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
272 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
277 std::string GetAuxiliaryHintValue(unsigned int id) const override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
282 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
287 void SetInputRegion(const Rect<int>& inputRegion) override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
292 void SetType(Dali::WindowType type) override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
297 Dali::WindowType GetType() const override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
302 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
307 Dali::WindowNotificationLevel GetNotificationLevel() const override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
312 void SetOpaqueState(bool opaque) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
317 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
322 WindowScreenOffMode GetScreenOffMode() const override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
327 Dali::WindowOperationResult SetBrightness(int brightness) override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
332 int GetBrightness() const override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
337 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
342 bool UngrabKey(Dali::KEY key) override;
345 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
347 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
350 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
352 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
355 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
357 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
360 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
362 int GetScreenRotationAngle() override;
365 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
367 void SetWindowRotationAngle(int degree) override;
370 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
372 void WindowRotationCompleted(int degree, int width, int height) override;
375 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
377 void SetTransparency(bool transparent) override;
380 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
382 int GetWindowRotationAngle() const override;
385 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
387 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
390 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
392 int CreateFrameRenderedSyncFence() override;
395 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
397 int CreateFramePresentedSyncFence() override;
400 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
402 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
405 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
407 void InitializeIme() override;
410 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
412 void ImeWindowReadyToRender() override;
415 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
417 void RequestMoveToServer() override;
420 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
422 void RequestResizeToServer(WindowResizeDirection direction) override;
425 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
427 void EnableFloatingMode(bool enable) override;
430 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
432 bool IsFloatingModeEnabled() const override;
435 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
437 void IncludeInputRegion(const Rect<int>& inputRegion) override;
440 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
442 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
445 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsLock()
447 bool PointerConstraintsLock() override;
450 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsUnlock()
452 bool PointerConstraintsUnlock() override;
455 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerRegionSet()
457 void LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height) override;
460 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerCursorPositionHintSet()
462 void LockedPointerCursorPositionHintSet(int32_t x, int32_t y) override;
465 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerWarp()
467 bool PointerWarp(int32_t x, int32_t y) override;
470 * @copydoc Dali::Internal::Adaptor::WindowBase::CursorVisibleSet()
472 void CursorVisibleSet(bool visible) override;
475 * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab()
477 bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override;
480 * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab()
482 bool KeyboardUnGrab() override;
486 * Second stage initialization
488 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
491 * @brief Get the surface id if the surface parameter is not empty
492 * @param surface Any containing a surface id, or can be empty
493 * @return surface id, or zero if surface is empty
495 uintptr_t GetSurfaceId(Any surface) const;
498 * @brief Create window
500 void CreateWinWindow(PositionSize positionSize, bool isTransparent);
503 * @brief Sets up an already created window.
505 void SetWinWindow(uintptr_t surfaceId);
509 WindowBaseWin(const WindowBaseWin&) = delete;
512 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
515 void EventEntry(TWinEventInfo* event);
518 WinWindowHandle mWin32Window; ///< Native window handle
519 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
520 bool mIsTransparent : 1; ///< Whether the window is transparent (32 bit or 24 bit)
521 bool mRotationAppSet : 1;
523 WindowsPlatform::WindowImpl mWindowImpl;
526 } // namespace Adaptor
528 } // namespace Internal
532 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H