1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
5 * Copyright (c) 2022 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::SetClass()
172 void SetClass(const std::string& name, const std::string& className) override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
177 void Raise() override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
182 void Lower() override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
187 void Activate() override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
192 void Maximize(bool maximize) override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
197 bool IsMaximized() const override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
202 void SetMaximumSize(Dali::Window::WindowSize size) override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
207 void Minimize(bool minimize) override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
212 bool IsMinimized() const override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
217 void SetMimimumSize(Dali::Window::WindowSize size) override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
222 void SetAvailableAnlges(const std::vector<int>& angles) override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
227 void SetPreferredAngle(int angle) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
232 void SetAcceptFocus(bool accept) override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
237 void Show() override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
242 void Hide() override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
247 unsigned int GetSupportedAuxiliaryHintCount() const override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
252 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
257 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
262 bool RemoveAuxiliaryHint(unsigned int id) override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
267 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
272 std::string GetAuxiliaryHintValue(unsigned int id) const override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
277 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
282 void SetInputRegion(const Rect<int>& inputRegion) override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
287 void SetType(Dali::WindowType type) override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
292 Dali::WindowType GetType() const override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
297 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
302 Dali::WindowNotificationLevel GetNotificationLevel() const override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
307 void SetOpaqueState(bool opaque) override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
312 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
317 WindowScreenOffMode GetScreenOffMode() const override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
322 Dali::WindowOperationResult SetBrightness(int brightness) override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
327 int GetBrightness() const override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
332 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
337 bool UngrabKey(Dali::KEY key) override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
342 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
345 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
347 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
350 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
352 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
355 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
357 int GetScreenRotationAngle() override;
360 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
362 void SetWindowRotationAngle(int degree) override;
365 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
367 void WindowRotationCompleted(int degree, int width, int height) override;
370 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
372 void SetTransparency(bool transparent) override;
375 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
377 int GetWindowRotationAngle() const override;
380 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
382 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
385 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
387 int CreateFrameRenderedSyncFence() override;
390 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
392 int CreateFramePresentedSyncFence() override;
395 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
397 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
400 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
402 void InitializeIme() override;
405 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
407 void ImeWindowReadyToRender() override;
410 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
412 void RequestMoveToServer() override;
415 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
417 void RequestResizeToServer(WindowResizeDirection direction) override;
420 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
422 void EnableFloatingMode(bool enable) override;
425 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
427 bool IsFloatingModeEnabled() const override;
430 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
432 void IncludeInputRegion(const Rect<int>& inputRegion) override;
435 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
437 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
441 * Second stage initialization
443 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
446 * @brief Get the surface id if the surface parameter is not empty
447 * @param surface Any containing a surface id, or can be empty
448 * @return surface id, or zero if surface is empty
450 uintptr_t GetSurfaceId(Any surface) const;
453 * @brief Create window
455 void CreateWinWindow(PositionSize positionSize, bool isTransparent);
458 * @brief Sets up an already created window.
460 void SetWinWindow(uintptr_t surfaceId);
464 WindowBaseWin(const WindowBaseWin&) = delete;
467 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
470 void EventEntry(TWinEventInfo* event);
473 WinWindowHandle mWin32Window; ///< Native window handle
474 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
475 bool mIsTransparent : 1; ///< Whether the window is transparent (32 bit or 24 bit)
476 bool mRotationAppSet : 1;
478 WindowsPlatform::WindowImpl mWindowImpl;
481 } // namespace Adaptor
483 } // namespace Internal
487 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H