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;
75 typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
78 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
79 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
80 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
83 typedef Signal<void(void*)> SelectionSignalType;
86 typedef Signal<void(StyleChange::Type)> StyleSignalType;
87 typedef Signal<void(const AccessibilityInfo&)> AccessibilitySignalType;
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 Create the egl window
115 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
118 * @brief Destroy the egl window
120 virtual void DestroyEglWindow() = 0;
123 * @brief Set the egl window rotation
125 virtual void SetEglWindowRotation(int angle) = 0;
128 * @brief Set the egl window buffer transform
130 virtual void SetEglWindowBufferTransform(int angle) = 0;
133 * @brief Set the egl window transform
135 virtual void SetEglWindowTransform(int angle) = 0;
138 * @brief Resize the egl window
140 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
143 * @brief Returns whether the egl window support rotation or not
145 virtual bool IsEglWindowRotationSupported() = 0;
148 * @brief Move the window
150 virtual void Move(Dali::PositionSize positionSize) = 0;
153 * @brief Resize the window
155 virtual void Resize(Dali::PositionSize positionSize) = 0;
158 * @brief Move and resize the window
160 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
163 * @copydoc Dali::Window::SetClass()
165 virtual void SetClass(const std::string& name, const std::string& className) = 0;
168 * @copydoc Dali::Window::Raise()
170 virtual void Raise() = 0;
173 * @copydoc Dali::Window::Lower()
175 virtual void Lower() = 0;
178 * @copydoc Dali::Window::Activate()
180 virtual void Activate() = 0;
183 * @copydoc Dali::Window::SetAvailableOrientations()
185 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
188 * @copydoc Dali::Window::SetPreferredOrientation()
190 virtual void SetPreferredAngle(int angle) = 0;
193 * @copydoc Dali::Window::SetAcceptFocus()
195 virtual void SetAcceptFocus(bool accept) = 0;
198 * @copydoc Dali::Window::Show()
200 virtual void Show() = 0;
203 * @copydoc Dali::Window::Hide()
205 virtual void Hide() = 0;
208 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
210 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
213 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
215 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
218 * @copydoc Dali::Window::AddAuxiliaryHint()
220 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
223 * @copydoc Dali::Window::RemoveAuxiliaryHint()
225 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
228 * @copydoc Dali::Window::SetAuxiliaryHintValue()
230 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
233 * @copydoc Dali::Window::GetAuxiliaryHintValue()
235 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
238 * @copydoc Dali::Window::GetAuxiliaryHintId()
240 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
243 * @copydoc Dali::Window::SetInputRegion()
245 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
248 * @copydoc Dali::Window::SetType()
250 virtual void SetType(Dali::WindowType type) = 0;
253 * @copydoc Dali::Window::SetNotificationLevel()
255 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
258 * @copydoc Dali::Window::GetNotificationLevel()
260 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
263 * @copydoc Dali::Window::SetOpaqueState()
265 virtual void SetOpaqueState(bool opaque) = 0;
268 * @copydoc Dali::Window::SetScreenOffMode()
270 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
273 * @copydoc Dali::Window::GetScreenOffMode()
275 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
278 * @copydoc Dali::Window::SetBrightness()
280 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
283 * @copydoc Dali::Window::GetBrightness()
285 virtual int GetBrightness() const = 0;
288 * @copydoc Dali::KeyGrab::GrabKey()
290 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
293 * @copydoc Dali::KeyGrab::UngrabKey()
295 virtual bool UngrabKey(Dali::KEY key) = 0;
298 * @copydoc Dali::KeyGrab::GrabKeyList()
300 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
303 * @copydoc Dali::KeyGrab::UngrabKeyList()
305 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
309 * @param[out] dpiHorizontal set to the horizontal dpi
310 * @param[out] dpiVertical set to the vertical dpi
312 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
315 * @brief Return the orientation of the surface.
316 * @return The orientation
318 virtual int GetOrientation() const = 0;
321 * @brief Get the screen rotation angle of the window
323 virtual int GetScreenRotationAngle() = 0;
326 * @brief Set the rotation angle of the window
328 virtual void SetWindowRotationAngle(int degree) = 0;
331 * @brief Inform the window rotation is completed
333 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
336 * @copydoc Dali::Window::SetTransparency()
338 virtual void SetTransparency(bool transparent) = 0;
341 * @copydoc Dali::Window::SetParent()
343 virtual void SetParent(WindowBase* parentWinBase) = 0;
346 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
347 * @return The file descriptor that tells when it is rendered.
349 virtual int CreateFrameRenderedSyncFence() = 0;
352 * @brief Create a sync fence that can tell the frame is presented by the display server.
353 * @return The file descriptor that tells when it is presented.
355 virtual int CreateFramePresentedSyncFence() = 0;
360 * @brief This signal is emitted when the window becomes iconified or deiconified.
362 IconifySignalType& IconifyChangedSignal();
365 * @brief This signal is emitted when the window focus is changed.
367 FocusSignalType& FocusChangedSignal();
370 * @brief This signal is emitted when the output is transformed.
372 OutputSignalType& OutputTransformedSignal();
375 * @brief This signal is emitted when the window receives a delete request.
377 DeleteSignalType& DeleteRequestSignal();
380 * @brief This signal is emitted when the window is damaged.
382 DamageSignalType& WindowDamagedSignal();
385 * @brief This signal is emitted when a rotation event is recevied.
387 RotationSignalType& RotationSignal();
390 * @brief This signal is emitted when a touch event is received.
392 TouchEventSignalType& TouchEventSignal();
395 * @brief This signal is emitted when a mouse wheel is received.
397 WheelEventSignalType& WheelEventSignal();
400 * @brief This signal is emitted when a key event is received.
402 KeyEventSignalType& KeyEventSignal();
405 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
407 SelectionSignalType& SelectionDataSendSignal();
410 * @brief This signal is emitted when the source window sends us about the selected content.
412 SelectionSignalType& SelectionDataReceivedSignal();
415 * @brief This signal is emitted when the style is changed.
417 StyleSignalType& StyleChangedSignal();
420 * @brief This signal is emitted when an accessibility event is received.
422 AccessibilitySignalType& AccessibilitySignal();
425 * @brief This signal is emitted when window's transition animation is started or ended.
427 TransitionEffectEventSignalType& TransitionEffectEventSignal();
430 * @brief This signal is emitted when the keyboard repeat is changed.
432 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
435 * @brief This signal is emitted when the window redraw is requested.
437 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
440 * @brief This signal is emitted when the window is resized or moved by display server.
442 UpdatePositionSizeType& UpdatePositionSizeSignal();
446 WindowBase(const WindowBase&) = delete;
449 WindowBase& operator=(const WindowBase& rhs) = delete;
452 IconifySignalType mIconifyChangedSignal;
453 FocusSignalType mFocusChangedSignal;
454 OutputSignalType mOutputTransformedSignal;
455 DeleteSignalType mDeleteRequestSignal;
456 DamageSignalType mWindowDamagedSignal;
457 RotationSignalType mRotationSignal;
458 TouchEventSignalType mTouchEventSignal;
459 WheelEventSignalType mWheelEventSignal;
460 KeyEventSignalType mKeyEventSignal;
461 SelectionSignalType mSelectionDataSendSignal;
462 SelectionSignalType mSelectionDataReceivedSignal;
463 StyleSignalType mStyleChangedSignal;
464 AccessibilitySignalType mAccessibilitySignal;
465 TransitionEffectEventSignalType mTransitionEffectEventSignal;
466 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
467 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
468 UpdatePositionSizeType mUpdatePositionSizeSignal;
472 } // namespace Adaptor
474 } // namespace Internal
478 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H