1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_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/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;
77 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
78 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
79 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
82 typedef Signal<void(void*)> SelectionSignalType;
85 typedef Signal<void(StyleChange::Type)> StyleSignalType;
86 typedef Signal<void(const AccessibilityInfo&)> AccessibilitySignalType;
89 * @brief Default constructor
96 virtual ~WindowBase();
100 * @brief Get the native window handle
101 * @return The native window handle
103 virtual Any GetNativeWindow() = 0;
106 * @brief Get the native window id
107 * @return The native window id
109 virtual int GetNativeWindowId() = 0;
112 * @brief Create the egl window
114 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
117 * @brief Destroy the egl window
119 virtual void DestroyEglWindow() = 0;
122 * @brief Set the egl window rotation
124 virtual void SetEglWindowRotation(int angle) = 0;
127 * @brief Set the egl window buffer transform
129 virtual void SetEglWindowBufferTransform(int angle) = 0;
132 * @brief Set the egl window transform
134 virtual void SetEglWindowTransform(int angle) = 0;
137 * @brief Resize the egl window
139 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
142 * @brief Returns whether the egl window support rotation or not
144 virtual bool IsEglWindowRotationSupported() = 0;
147 * @brief Move the window
149 virtual void Move(Dali::PositionSize positionSize) = 0;
152 * @brief Resize the window
154 virtual void Resize(Dali::PositionSize positionSize) = 0;
157 * @brief Move and resize the window
159 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
162 * @copydoc Dali::Window::SetClass()
164 virtual void SetClass(const std::string& name, const std::string& className) = 0;
167 * @copydoc Dali::Window::Raise()
169 virtual void Raise() = 0;
172 * @copydoc Dali::Window::Lower()
174 virtual void Lower() = 0;
177 * @copydoc Dali::Window::Activate()
179 virtual void Activate() = 0;
182 * @copydoc Dali::Window::SetAvailableOrientations()
184 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
187 * @copydoc Dali::Window::SetPreferredOrientation()
189 virtual void SetPreferredAngle(int angle) = 0;
192 * @copydoc Dali::Window::SetAcceptFocus()
194 virtual void SetAcceptFocus(bool accept) = 0;
197 * @copydoc Dali::Window::Show()
199 virtual void Show() = 0;
202 * @copydoc Dali::Window::Hide()
204 virtual void Hide() = 0;
207 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
209 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
212 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
214 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
217 * @copydoc Dali::Window::AddAuxiliaryHint()
219 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
222 * @copydoc Dali::Window::RemoveAuxiliaryHint()
224 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
227 * @copydoc Dali::Window::SetAuxiliaryHintValue()
229 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
232 * @copydoc Dali::Window::GetAuxiliaryHintValue()
234 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
237 * @copydoc Dali::Window::GetAuxiliaryHintId()
239 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
242 * @copydoc Dali::Window::SetInputRegion()
244 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
247 * @copydoc Dali::Window::SetType()
249 virtual void SetType(Dali::WindowType type) = 0;
252 * @copydoc Dali::Window::SetNotificationLevel()
254 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
257 * @copydoc Dali::Window::GetNotificationLevel()
259 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
262 * @copydoc Dali::Window::SetOpaqueState()
264 virtual void SetOpaqueState(bool opaque) = 0;
267 * @copydoc Dali::Window::SetScreenOffMode()
269 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
272 * @copydoc Dali::Window::GetScreenOffMode()
274 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
277 * @copydoc Dali::Window::SetBrightness()
279 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
282 * @copydoc Dali::Window::GetBrightness()
284 virtual int GetBrightness() const = 0;
287 * @copydoc Dali::KeyGrab::GrabKey()
289 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
292 * @copydoc Dali::KeyGrab::UngrabKey()
294 virtual bool UngrabKey(Dali::KEY key) = 0;
297 * @copydoc Dali::KeyGrab::GrabKeyList()
299 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
302 * @copydoc Dali::KeyGrab::UngrabKeyList()
304 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
308 * @param[out] dpiHorizontal set to the horizontal dpi
309 * @param[out] dpiVertical set to the vertical dpi
311 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
314 * @brief Return the orientation of the surface.
315 * @return The orientation
317 virtual int GetOrientation() const = 0;
320 * @brief Get the screen rotation angle of the window
322 virtual int GetScreenRotationAngle() = 0;
325 * @brief Set the rotation angle of the window
327 virtual void SetWindowRotationAngle(int degree) = 0;
330 * @brief Inform the window rotation is completed
332 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
335 * @copydoc Dali::Window::SetTransparency()
337 virtual void SetTransparency(bool transparent) = 0;
340 * @copydoc Dali::Window::SetParent()
342 virtual void SetParent(WindowBase* parentWinBase) = 0;
345 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
346 * @return The file descriptor that tells when it is rendered.
348 virtual int CreateFrameRenderedSyncFence() = 0;
351 * @brief Create a sync fence that can tell the frame is presented by the display server.
352 * @return The file descriptor that tells when it is presented.
354 virtual int CreateFramePresentedSyncFence() = 0;
359 * @brief This signal is emitted when the window becomes iconified or deiconified.
361 IconifySignalType& IconifyChangedSignal();
364 * @brief This signal is emitted when the window focus is changed.
366 FocusSignalType& FocusChangedSignal();
369 * @brief This signal is emitted when the output is transformed.
371 OutputSignalType& OutputTransformedSignal();
374 * @brief This signal is emitted when the window receives a delete request.
376 DeleteSignalType& DeleteRequestSignal();
379 * @brief This signal is emitted when the window is damaged.
381 DamageSignalType& WindowDamagedSignal();
384 * @brief This signal is emitted when a rotation event is recevied.
386 RotationSignalType& RotationSignal();
389 * @brief This signal is emitted when a touch event is received.
391 TouchEventSignalType& TouchEventSignal();
394 * @brief This signal is emitted when a mouse wheel is received.
396 WheelEventSignalType& WheelEventSignal();
399 * @brief This signal is emitted when a key event is received.
401 KeyEventSignalType& KeyEventSignal();
404 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
406 SelectionSignalType& SelectionDataSendSignal();
409 * @brief This signal is emitted when the source window sends us about the selected content.
411 SelectionSignalType& SelectionDataReceivedSignal();
414 * @brief This signal is emitted when the style is changed.
416 StyleSignalType& StyleChangedSignal();
419 * @brief This signal is emitted when an accessibility event is received.
421 AccessibilitySignalType& AccessibilitySignal();
424 * @brief This signal is emitted when window's transition animation is started or ended.
426 TransitionEffectEventSignalType& TransitionEffectEventSignal();
429 * @brief This signal is emitted when the keyboard repeat is changed.
431 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
434 * @brief This signal is emitted when the window redraw is requested.
436 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
440 WindowBase(const WindowBase&) = delete;
443 WindowBase& operator=(const WindowBase& rhs) = delete;
446 IconifySignalType mIconifyChangedSignal;
447 FocusSignalType mFocusChangedSignal;
448 OutputSignalType mOutputTransformedSignal;
449 DeleteSignalType mDeleteRequestSignal;
450 DamageSignalType mWindowDamagedSignal;
451 RotationSignalType mRotationSignal;
452 TouchEventSignalType mTouchEventSignal;
453 WheelEventSignalType mWheelEventSignal;
454 KeyEventSignalType mKeyEventSignal;
455 SelectionSignalType mSelectionDataSendSignal;
456 SelectionSignalType mSelectionDataReceivedSignal;
457 StyleSignalType mStyleChangedSignal;
458 AccessibilitySignalType mAccessibilitySignal;
459 TransitionEffectEventSignalType mTransitionEffectEventSignal;
460 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
461 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
464 } // namespace Adaptor
466 } // namespace Internal
470 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H