1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_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/integration-api/events/key-event-integ.h>
23 #include <dali/integration-api/events/point.h>
24 #include <dali/integration-api/events/wheel-event-integ.h>
30 #include <dali/devel-api/adaptor-framework/window-devel.h>
31 #include <dali/internal/graphics/gles/egl-implementation.h>
32 #include <dali/internal/window-system/common/damage-observer.h>
33 #include <dali/internal/window-system/common/rotation-event.h>
34 #include <dali/public-api/adaptor-framework/key-grab.h>
35 #include <dali/public-api/adaptor-framework/style-change.h>
36 #include <dali/public-api/adaptor-framework/window-enumerations.h>
37 #include <dali/public-api/adaptor-framework/window.h>
46 * WindowBase interface
52 * @brief Struct used to retrieve accessibility information
54 struct AccessibilityInfo
66 typedef Signal<void(bool)> IconifySignalType;
67 typedef Signal<void(bool)> FocusSignalType;
68 typedef Signal<void()> OutputSignalType;
69 typedef Signal<void()> DeleteSignalType;
70 typedef Signal<void(const DamageArea&)> DamageSignalType;
71 typedef Signal<void(const RotationEvent&)> RotationSignalType;
72 typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
73 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
74 typedef Signal<void()> WindowRedrawRequestSignalType;
75 typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
76 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
79 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
80 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
81 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
84 typedef Signal<void(void*)> SelectionSignalType;
87 typedef Signal<void(StyleChange::Type)> StyleSignalType;
90 * @brief Default constructor
97 virtual ~WindowBase();
101 * @brief Get the native window handle
102 * @return The native window handle
104 virtual Any GetNativeWindow() = 0;
107 * @brief Get the native window id
108 * @return The native window id
110 virtual int GetNativeWindowId() = 0;
113 * @brief Get the native window resource id assinged by window manager
114 * @return The native window resource id
116 virtual std::string GetNativeWindowResourceId() = 0;
119 * @brief Create the egl window
121 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
124 * @brief Destroy the egl window
126 virtual void DestroyEglWindow() = 0;
129 * @brief Set the egl window rotation
131 virtual void SetEglWindowRotation(int angle) = 0;
134 * @brief Set the egl window buffer transform
136 virtual void SetEglWindowBufferTransform(int angle) = 0;
139 * @brief Set the egl window transform
141 virtual void SetEglWindowTransform(int angle) = 0;
144 * @brief Resize the egl window
146 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
149 * @brief Returns whether the egl window support rotation or not
151 virtual bool IsEglWindowRotationSupported() = 0;
154 * @brief Move the window
156 virtual void Move(Dali::PositionSize positionSize) = 0;
159 * @brief Resize the window
161 virtual void Resize(Dali::PositionSize positionSize) = 0;
164 * @brief Move and resize the window
166 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
169 * @copydoc Dali::Window::SetClass()
171 virtual void SetClass(const std::string& name, const std::string& className) = 0;
174 * @copydoc Dali::Window::Raise()
176 virtual void Raise() = 0;
179 * @copydoc Dali::Window::Lower()
181 virtual void Lower() = 0;
184 * @copydoc Dali::Window::Activate()
186 virtual void Activate() = 0;
189 * @copydoc Dali::DevelWindow::Maximize()
191 virtual void Maximize(bool maximize) = 0;
194 * @copydoc Dali::DevelWindow::IsMaximized()
196 virtual bool IsMaximized() const = 0;
199 * @copydoc Dali::DevelWindow::SetMaximumSize()
201 virtual void SetMaximumSize(Dali::Window::WindowSize size) = 0;
204 * @copydoc Dali::DevelWindow::Minimize()
206 virtual void Minimize(bool minimize) = 0;
209 * @copydoc Dali::DevelWindow::IsMinimized()
211 virtual bool IsMinimized() const = 0;
214 * @copydoc Dali::DevelWindow::SetMimimumSize()
216 virtual void SetMimimumSize(Dali::Window::WindowSize size) = 0;
219 * @copydoc Dali::Window::SetAvailableOrientations()
221 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
224 * @copydoc Dali::Window::SetPreferredOrientation()
226 virtual void SetPreferredAngle(int angle) = 0;
229 * @copydoc Dali::Window::SetAcceptFocus()
231 virtual void SetAcceptFocus(bool accept) = 0;
234 * @copydoc Dali::Window::Show()
236 virtual void Show() = 0;
239 * @copydoc Dali::Window::Hide()
241 virtual void Hide() = 0;
244 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
246 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
249 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
251 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
254 * @copydoc Dali::Window::AddAuxiliaryHint()
256 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
259 * @copydoc Dali::Window::RemoveAuxiliaryHint()
261 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
264 * @copydoc Dali::Window::SetAuxiliaryHintValue()
266 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
269 * @copydoc Dali::Window::GetAuxiliaryHintValue()
271 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
274 * @copydoc Dali::Window::GetAuxiliaryHintId()
276 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
279 * @copydoc Dali::Window::SetInputRegion()
281 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
284 * @copydoc Dali::Window::SetType()
286 virtual void SetType(Dali::WindowType type) = 0;
289 * @copydoc Dali::Window::GetType()
291 virtual Dali::WindowType GetType() const = 0;
294 * @copydoc Dali::Window::SetNotificationLevel()
296 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
299 * @copydoc Dali::Window::GetNotificationLevel()
301 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
304 * @copydoc Dali::Window::SetOpaqueState()
306 virtual void SetOpaqueState(bool opaque) = 0;
309 * @copydoc Dali::Window::SetScreenOffMode()
311 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
314 * @copydoc Dali::Window::GetScreenOffMode()
316 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
319 * @copydoc Dali::Window::SetBrightness()
321 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
324 * @copydoc Dali::Window::GetBrightness()
326 virtual int GetBrightness() const = 0;
329 * @copydoc Dali::KeyGrab::GrabKey()
331 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
334 * @copydoc Dali::KeyGrab::UngrabKey()
336 virtual bool UngrabKey(Dali::KEY key) = 0;
339 * @copydoc Dali::KeyGrab::GrabKeyList()
341 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
344 * @copydoc Dali::KeyGrab::UngrabKeyList()
346 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
350 * @param[out] dpiHorizontal set to the horizontal dpi
351 * @param[out] dpiVertical set to the vertical dpi
353 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
356 * @brief Return the angle of the window's rotation.
357 * @return The window orientation
359 virtual int GetWindowRotationAngle() const = 0;
362 * @brief Get the angle of screen rotation for the window
363 * @return The screen orientation
365 virtual int GetScreenRotationAngle() = 0;
368 * @brief Set the screen rotation angle of the window
370 virtual void SetWindowRotationAngle(int degree) = 0;
373 * @brief Inform the window rotation is completed
375 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
378 * @brief starts the window is moved by display server
380 virtual void RequestMoveToServer() = 0;
383 * @brief starts the window is resized by display server
385 * @param[in] direction It is direction of the started edge/side.
387 virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
390 * @brief Enables the floating mode of window.
392 * The floating mode is to support making partial size window easliy.
393 * It is useful to make popup style window
394 * and this window is always upper than the other normal window.
396 * A special display server(as a Tizen display server) supports this mode.
398 * @param[in] enable Enable floating mode or not.
400 virtual void EnableFloatingMode(bool enable) = 0;
403 * @brief Gets whether floating mode is enabled or not.
405 virtual bool IsFloatingModeEnabled() const = 0;
408 * @copydoc Dali::Window::SetTransparency()
410 virtual void SetTransparency(bool transparent) = 0;
413 * @copydoc Dali::Window::SetParent()
415 virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
418 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
419 * @return The file descriptor that tells when it is rendered.
421 virtual int CreateFrameRenderedSyncFence() = 0;
424 * @brief Create a sync fence that can tell the frame is presented by the display server.
425 * @return The file descriptor that tells when it is presented.
427 virtual int CreateFramePresentedSyncFence() = 0;
430 * @copydoc Dali::Window::SetPositionSizeWithAngle()
432 virtual void SetPositionSizeWithAngle(PositionSize positionSize, int angle) = 0;
435 * @brief Initialize for Ime window.
436 * It should be called when the window is only used for Ime keyboard window.
438 virtual void InitializeIme() = 0;
441 * @brief Send the signal to display server for Ime Window is ready to render.
442 * It is used for compositing by display server.
444 virtual void ImeWindowReadyToRender() = 0;
447 * @brief Includes input region.
448 * @param[in] inputRegion The added region to accept input events.
450 virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
453 * @brief Excludes input region.
454 * @param[in] inputRegion The subtracted region to except input events.
456 virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
461 * @brief This signal is emitted when the window becomes iconified or deiconified.
463 IconifySignalType& IconifyChangedSignal();
466 * @brief This signal is emitted when the window focus is changed.
468 FocusSignalType& FocusChangedSignal();
471 * @brief This signal is emitted when the output is transformed.
473 OutputSignalType& OutputTransformedSignal();
476 * @brief This signal is emitted when the window receives a delete request.
478 DeleteSignalType& DeleteRequestSignal();
481 * @brief This signal is emitted when the window is damaged.
483 DamageSignalType& WindowDamagedSignal();
486 * @brief This signal is emitted when a rotation event is recevied.
488 RotationSignalType& RotationSignal();
491 * @brief This signal is emitted when a touch event is received.
493 TouchEventSignalType& TouchEventSignal();
496 * @brief This signal is emitted when a mouse wheel is received.
498 WheelEventSignalType& WheelEventSignal();
501 * @brief This signal is emitted when a key event is received.
503 KeyEventSignalType& KeyEventSignal();
506 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
508 SelectionSignalType& SelectionDataSendSignal();
511 * @brief This signal is emitted when the source window sends us about the selected content.
513 SelectionSignalType& SelectionDataReceivedSignal();
516 * @brief This signal is emitted when the style is changed.
518 StyleSignalType& StyleChangedSignal();
521 * @brief This signal is emitted when window's transition animation is started or ended.
523 TransitionEffectEventSignalType& TransitionEffectEventSignal();
526 * @brief This signal is emitted when the keyboard repeat is changed.
528 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
531 * @brief This signal is emitted when the window redraw is requested.
533 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
536 * @brief This signal is emitted when the window is resized or moved by display server.
538 UpdatePositionSizeType& UpdatePositionSizeSignal();
541 * @brief This signal is emitted when the window is received the auxiliary message from display server.
543 AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
547 WindowBase(const WindowBase&) = delete;
550 WindowBase& operator=(const WindowBase& rhs) = delete;
553 IconifySignalType mIconifyChangedSignal;
554 FocusSignalType mFocusChangedSignal;
555 OutputSignalType mOutputTransformedSignal;
556 DeleteSignalType mDeleteRequestSignal;
557 DamageSignalType mWindowDamagedSignal;
558 RotationSignalType mRotationSignal;
559 TouchEventSignalType mTouchEventSignal;
560 WheelEventSignalType mWheelEventSignal;
561 KeyEventSignalType mKeyEventSignal;
562 SelectionSignalType mSelectionDataSendSignal;
563 SelectionSignalType mSelectionDataReceivedSignal;
564 StyleSignalType mStyleChangedSignal;
565 TransitionEffectEventSignalType mTransitionEffectEventSignal;
566 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
567 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
568 UpdatePositionSizeType mUpdatePositionSizeSignal;
569 AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
572 } // namespace Adaptor
574 } // namespace Internal
578 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H