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)> MaximizeSignalType;
68 typedef Signal<void(bool)> FocusSignalType;
69 typedef Signal<void()> OutputSignalType;
70 typedef Signal<void()> DeleteSignalType;
71 typedef Signal<void(const DamageArea&)> DamageSignalType;
72 typedef Signal<void(const RotationEvent&)> RotationSignalType;
73 typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
74 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
75 typedef Signal<void()> WindowRedrawRequestSignalType;
76 typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
77 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
80 typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
81 typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
82 typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
85 typedef Signal<void(void*)> SelectionSignalType;
88 typedef Signal<void(StyleChange::Type)> StyleSignalType;
91 * @brief Default constructor
98 virtual ~WindowBase();
102 * @brief Get the native window handle
103 * @return The native window handle
105 virtual Any GetNativeWindow() = 0;
108 * @brief Get the native window id
109 * @return The native window id
111 virtual int GetNativeWindowId() = 0;
114 * @brief Get the native window resource id assinged by window manager
115 * @return The native window resource id
117 virtual std::string GetNativeWindowResourceId() = 0;
120 * @brief Create the egl window
122 virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
125 * @brief Destroy the egl window
127 virtual void DestroyEglWindow() = 0;
130 * @brief Set the egl window rotation
132 virtual void SetEglWindowRotation(int angle) = 0;
135 * @brief Set the egl window buffer transform
137 virtual void SetEglWindowBufferTransform(int angle) = 0;
140 * @brief Set the egl window transform
142 virtual void SetEglWindowTransform(int angle) = 0;
145 * @brief Resize the egl window
147 virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
150 * @brief Returns whether the egl window support rotation or not
152 virtual bool IsEglWindowRotationSupported() = 0;
155 * @brief Move the window
157 virtual void Move(Dali::PositionSize positionSize) = 0;
160 * @brief Resize the window
162 virtual void Resize(Dali::PositionSize positionSize) = 0;
165 * @brief Move and resize the window
167 virtual void MoveResize(Dali::PositionSize positionSize) = 0;
170 * @copydoc Dali::Window::SetClass()
172 virtual void SetClass(const std::string& name, const std::string& className) = 0;
175 * @copydoc Dali::Window::Raise()
177 virtual void Raise() = 0;
180 * @copydoc Dali::Window::Lower()
182 virtual void Lower() = 0;
185 * @copydoc Dali::Window::Activate()
187 virtual void Activate() = 0;
190 * @copydoc Dali::DevelWindow::Maximize()
192 virtual void Maximize(bool maximize) = 0;
195 * @copydoc Dali::DevelWindow::IsMaximized()
197 virtual bool IsMaximized() const = 0;
200 * @copydoc Dali::DevelWindow::SetMaximumSize()
202 virtual void SetMaximumSize(Dali::Window::WindowSize size) = 0;
205 * @copydoc Dali::DevelWindow::Minimize()
207 virtual void Minimize(bool minimize) = 0;
210 * @copydoc Dali::DevelWindow::IsMinimized()
212 virtual bool IsMinimized() const = 0;
215 * @copydoc Dali::DevelWindow::SetMimimumSize()
217 virtual void SetMimimumSize(Dali::Window::WindowSize size) = 0;
220 * @copydoc Dali::Window::SetAvailableOrientations()
222 virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
225 * @copydoc Dali::Window::SetPreferredOrientation()
227 virtual void SetPreferredAngle(int angle) = 0;
230 * @copydoc Dali::Window::SetAcceptFocus()
232 virtual void SetAcceptFocus(bool accept) = 0;
235 * @copydoc Dali::Window::Show()
237 virtual void Show() = 0;
240 * @copydoc Dali::Window::Hide()
242 virtual void Hide() = 0;
245 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
247 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
250 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
252 virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
255 * @copydoc Dali::Window::AddAuxiliaryHint()
257 virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
260 * @copydoc Dali::Window::RemoveAuxiliaryHint()
262 virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
265 * @copydoc Dali::Window::SetAuxiliaryHintValue()
267 virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
270 * @copydoc Dali::Window::GetAuxiliaryHintValue()
272 virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
275 * @copydoc Dali::Window::GetAuxiliaryHintId()
277 virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
280 * @copydoc Dali::Window::SetInputRegion()
282 virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
285 * @copydoc Dali::Window::SetType()
287 virtual void SetType(Dali::WindowType type) = 0;
290 * @copydoc Dali::Window::GetType()
292 virtual Dali::WindowType GetType() const = 0;
295 * @copydoc Dali::Window::SetNotificationLevel()
297 virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
300 * @copydoc Dali::Window::GetNotificationLevel()
302 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
305 * @copydoc Dali::Window::SetOpaqueState()
307 virtual void SetOpaqueState(bool opaque) = 0;
310 * @copydoc Dali::Window::SetScreenOffMode()
312 virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
315 * @copydoc Dali::Window::GetScreenOffMode()
317 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
320 * @copydoc Dali::Window::SetBrightness()
322 virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
325 * @copydoc Dali::Window::GetBrightness()
327 virtual int GetBrightness() const = 0;
330 * @copydoc Dali::KeyGrab::GrabKey()
332 virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
335 * @copydoc Dali::KeyGrab::UngrabKey()
337 virtual bool UngrabKey(Dali::KEY key) = 0;
340 * @copydoc Dali::KeyGrab::GrabKeyList()
342 virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
345 * @copydoc Dali::KeyGrab::UngrabKeyList()
347 virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
351 * @param[out] dpiHorizontal set to the horizontal dpi
352 * @param[out] dpiVertical set to the vertical dpi
354 virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
357 * @brief Return the angle of the window's rotation.
358 * @return The window orientation
360 virtual int GetWindowRotationAngle() const = 0;
363 * @brief Get the angle of screen rotation for the window
364 * @return The screen orientation
366 virtual int GetScreenRotationAngle() = 0;
369 * @brief Set the screen rotation angle of the window
371 virtual void SetWindowRotationAngle(int degree) = 0;
374 * @brief Inform the window rotation is completed
376 virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
379 * @brief starts the window is moved by display server
381 virtual void RequestMoveToServer() = 0;
384 * @brief starts the window is resized by display server
386 * @param[in] direction It is direction of the started edge/side.
388 virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
391 * @brief Enables the floating mode of window.
393 * The floating mode is to support making partial size window easliy.
394 * It is useful to make popup style window
395 * and this window is always upper than the other normal window.
397 * A special display server(as a Tizen display server) supports this mode.
399 * @param[in] enable Enable floating mode or not.
401 virtual void EnableFloatingMode(bool enable) = 0;
404 * @brief Gets whether floating mode is enabled or not.
406 virtual bool IsFloatingModeEnabled() const = 0;
409 * @copydoc Dali::Window::SetTransparency()
411 virtual void SetTransparency(bool transparent) = 0;
414 * @copydoc Dali::Window::SetParent()
416 virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
419 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
420 * @return The file descriptor that tells when it is rendered.
422 virtual int CreateFrameRenderedSyncFence() = 0;
425 * @brief Create a sync fence that can tell the frame is presented by the display server.
426 * @return The file descriptor that tells when it is presented.
428 virtual int CreateFramePresentedSyncFence() = 0;
431 * @copydoc Dali::Window::SetPositionSizeWithAngle()
433 virtual void SetPositionSizeWithAngle(PositionSize positionSize, int angle) = 0;
436 * @brief Initialize for Ime window.
437 * It should be called when the window is only used for Ime keyboard window.
439 virtual void InitializeIme() = 0;
442 * @brief Send the signal to display server for Ime Window is ready to render.
443 * It is used for compositing by display server.
445 virtual void ImeWindowReadyToRender() = 0;
448 * @brief Includes input region.
449 * @param[in] inputRegion The added region to accept input events.
451 virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
454 * @brief Excludes input region.
455 * @param[in] inputRegion The subtracted region to except input events.
457 virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
462 * @brief This signal is emitted when the window becomes iconified or deiconified.
464 IconifySignalType& IconifyChangedSignal();
467 * @brief This signal is emitted when the window becomes maximized or unmaximized.
469 MaximizeSignalType& MaximizeChangedSignal();
472 * @brief This signal is emitted when the window focus is changed.
474 FocusSignalType& FocusChangedSignal();
477 * @brief This signal is emitted when the output is transformed.
479 OutputSignalType& OutputTransformedSignal();
482 * @brief This signal is emitted when the window receives a delete request.
484 DeleteSignalType& DeleteRequestSignal();
487 * @brief This signal is emitted when the window is damaged.
489 DamageSignalType& WindowDamagedSignal();
492 * @brief This signal is emitted when a rotation event is recevied.
494 RotationSignalType& RotationSignal();
497 * @brief This signal is emitted when a touch event is received.
499 TouchEventSignalType& TouchEventSignal();
502 * @brief This signal is emitted when a mouse wheel is received.
504 WheelEventSignalType& WheelEventSignal();
507 * @brief This signal is emitted when a key event is received.
509 KeyEventSignalType& KeyEventSignal();
512 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
514 SelectionSignalType& SelectionDataSendSignal();
517 * @brief This signal is emitted when the source window sends us about the selected content.
519 SelectionSignalType& SelectionDataReceivedSignal();
522 * @brief This signal is emitted when the style is changed.
524 StyleSignalType& StyleChangedSignal();
527 * @brief This signal is emitted when window's transition animation is started or ended.
529 TransitionEffectEventSignalType& TransitionEffectEventSignal();
532 * @brief This signal is emitted when the keyboard repeat is changed.
534 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
537 * @brief This signal is emitted when the window redraw is requested.
539 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
542 * @brief This signal is emitted when the window is resized or moved by display server.
544 UpdatePositionSizeType& UpdatePositionSizeSignal();
547 * @brief This signal is emitted when the window is received the auxiliary message from display server.
549 AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
553 WindowBase(const WindowBase&) = delete;
556 WindowBase& operator=(const WindowBase& rhs) = delete;
559 IconifySignalType mIconifyChangedSignal;
560 MaximizeSignalType mMaximizeChangedSignal;
561 FocusSignalType mFocusChangedSignal;
562 OutputSignalType mOutputTransformedSignal;
563 DeleteSignalType mDeleteRequestSignal;
564 DamageSignalType mWindowDamagedSignal;
565 RotationSignalType mRotationSignal;
566 TouchEventSignalType mTouchEventSignal;
567 WheelEventSignalType mWheelEventSignal;
568 KeyEventSignalType mKeyEventSignal;
569 SelectionSignalType mSelectionDataSendSignal;
570 SelectionSignalType mSelectionDataReceivedSignal;
571 StyleSignalType mStyleChangedSignal;
572 TransitionEffectEventSignalType mTransitionEffectEventSignal;
573 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
574 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
575 UpdatePositionSizeType mUpdatePositionSizeSignal;
576 AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
579 } // namespace Adaptor
581 } // namespace Internal
585 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H