1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
5 * Copyright (c) 2020 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/public-api/adaptor-framework/window.h>
31 #include <dali/public-api/adaptor-framework/key-grab.h>
32 #include <dali/public-api/adaptor-framework/style-change.h>
33 #include <dali/public-api/adaptor-framework/window-enumerations.h>
34 #include <dali/devel-api/adaptor-framework/window-devel.h>
35 #include <dali/internal/window-system/common/damage-observer.h>
36 #include <dali/internal/window-system/common/rotation-event.h>
37 #include <dali/internal/graphics/gles/egl-implementation.h>
47 * WindowBase interface
54 * @brief Struct used to retrieve accessibility information
56 struct AccessibilityInfo
68 typedef Signal< void ( bool ) > IconifySignalType;
69 typedef Signal< void ( bool ) > FocusSignalType;
70 typedef Signal< void ( ) > OutputSignalType;
71 typedef Signal< void ( ) > DeleteSignalType;
72 typedef Signal< void ( const DamageArea& ) > DamageSignalType;
73 typedef Signal< void ( const RotationEvent& ) > RotationSignalType;
74 typedef Signal< void ( WindowEffectState, WindowEffectType ) > TransitionEffectEventSignalType;
75 typedef Signal< void ( ) > KeyboardRepeatSettingsChangedSignalType;
76 typedef Signal< void ( ) > WindowRedrawRequestSignalType;
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;
88 typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
91 * @brief Default constructor
98 virtual ~WindowBase();
103 * @brief Get the native window handle
104 * @return The native window handle
106 virtual Any GetNativeWindow() = 0;
109 * @brief Get the native window id
110 * @return The native window id
112 virtual int GetNativeWindowId() = 0;
115 * @brief Create the egl window
117 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
120 * @brief Destroy the egl window
122 virtual void DestroyEglWindow() = 0;
125 * @brief Set the egl window rotation
127 virtual void SetEglWindowRotation( int angle ) = 0;
130 * @brief Set the egl window buffer transform
132 virtual void SetEglWindowBufferTransform( int angle ) = 0;
135 * @brief Set the egl window transform
137 virtual void SetEglWindowTransform( int angle ) = 0;
140 * @brief Resize the egl window
142 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
145 * @brief Returns whether the egl window support rotation or not
147 virtual bool IsEglWindowRotationSupported() = 0;
150 * @brief Move the window
152 virtual void Move( Dali::PositionSize positionSize ) = 0;
155 * @brief Resize the window
157 virtual void Resize( Dali::PositionSize positionSize ) = 0;
160 * @brief Move and resize the window
162 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
165 * @copydoc Dali::Window::SetClass()
167 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
170 * @copydoc Dali::Window::Raise()
172 virtual void Raise() = 0;
175 * @copydoc Dali::Window::Lower()
177 virtual void Lower() = 0;
180 * @copydoc Dali::Window::Activate()
182 virtual void Activate() = 0;
185 * @copydoc Dali::Window::SetAvailableOrientations()
187 virtual void SetAvailableAnlges( const std::vector< int >& angles ) = 0;
190 * @copydoc Dali::Window::SetPreferredOrientation()
192 virtual void SetPreferredAngle( int angle ) = 0;
195 * @copydoc Dali::Window::SetAcceptFocus()
197 virtual void SetAcceptFocus( bool accept ) = 0;
200 * @copydoc Dali::Window::Show()
202 virtual void Show() = 0;
205 * @copydoc Dali::Window::Hide()
207 virtual void Hide() = 0;
210 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
212 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
215 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
217 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
220 * @copydoc Dali::Window::AddAuxiliaryHint()
222 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
225 * @copydoc Dali::Window::RemoveAuxiliaryHint()
227 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
230 * @copydoc Dali::Window::SetAuxiliaryHintValue()
232 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
235 * @copydoc Dali::Window::GetAuxiliaryHintValue()
237 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
240 * @copydoc Dali::Window::GetAuxiliaryHintId()
242 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
245 * @copydoc Dali::Window::SetInputRegion()
247 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
250 * @copydoc Dali::Window::SetType()
252 virtual void SetType( Dali::WindowType type ) = 0;
255 * @copydoc Dali::Window::SetNotificationLevel()
257 virtual bool SetNotificationLevel( Dali::WindowNotificationLevel level ) = 0;
260 * @copydoc Dali::Window::GetNotificationLevel()
262 virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
265 * @copydoc Dali::Window::SetOpaqueState()
267 virtual void SetOpaqueState( bool opaque ) = 0;
270 * @copydoc Dali::Window::SetScreenOffMode()
272 virtual bool SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
275 * @copydoc Dali::Window::GetScreenOffMode()
277 virtual WindowScreenOffMode GetScreenOffMode() const = 0;
280 * @copydoc Dali::Window::SetBrightness()
282 virtual bool SetBrightness( int brightness ) = 0;
285 * @copydoc Dali::Window::GetBrightness()
287 virtual int GetBrightness() const = 0;
290 * @copydoc Dali::KeyGrab::GrabKey()
292 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
295 * @copydoc Dali::KeyGrab::UngrabKey()
297 virtual bool UngrabKey( Dali::KEY key ) = 0;
300 * @copydoc Dali::KeyGrab::GrabKeyList()
302 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
305 * @copydoc Dali::KeyGrab::UngrabKeyList()
307 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
311 * @param[out] dpiHorizontal set to the horizontal dpi
312 * @param[out] dpiVertical set to the vertical dpi
314 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
317 * @brief Get the screen rotation angle of the window
319 virtual int GetScreenRotationAngle() = 0;
322 * @brief Set the rotation angle of the window
324 virtual void SetWindowRotationAngle( int degree ) = 0;
327 * @brief Inform the window rotation is completed
329 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
332 * @copydoc Dali::Window::SetTransparency()
334 virtual void SetTransparency( bool transparent ) = 0;
337 * @copydoc Dali::Window::SetParent()
339 virtual void SetParent( WindowBase* parentWinBase ) = 0;
342 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
343 * @return The file descriptor that tells when it is rendered.
345 virtual int CreateFrameRenderedSyncFence() = 0;
348 * @brief Create a sync fence that can tell the frame is presented by the display server.
349 * @return The file descriptor that tells when it is presented.
351 virtual int CreateFramePresentedSyncFence() = 0;
356 * @brief This signal is emitted when the window becomes iconified or deiconified.
358 IconifySignalType& IconifyChangedSignal();
361 * @brief This signal is emitted when the window focus is changed.
363 FocusSignalType& FocusChangedSignal();
366 * @brief This signal is emitted when the output is transformed.
368 OutputSignalType& OutputTransformedSignal();
371 * @brief This signal is emitted when the window receives a delete request.
373 DeleteSignalType& DeleteRequestSignal();
376 * @brief This signal is emitted when the window is damaged.
378 DamageSignalType& WindowDamagedSignal();
381 * @brief This signal is emitted when a rotation event is recevied.
383 RotationSignalType& RotationSignal();
386 * @brief This signal is emitted when a touch event is received.
388 TouchEventSignalType& TouchEventSignal();
391 * @brief This signal is emitted when a mouse wheel is received.
393 WheelEventSignalType& WheelEventSignal();
396 * @brief This signal is emitted when a key event is received.
398 KeyEventSignalType& KeyEventSignal();
401 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
403 SelectionSignalType& SelectionDataSendSignal();
406 * @brief This signal is emitted when the source window sends us about the selected content.
408 SelectionSignalType& SelectionDataReceivedSignal();
411 * @brief This signal is emitted when the style is changed.
413 StyleSignalType& StyleChangedSignal();
416 * @brief This signal is emitted when an accessibility event is received.
418 AccessibilitySignalType& AccessibilitySignal();
421 * @brief This signal is emitted when window's transition animation is started or ended.
423 TransitionEffectEventSignalType& TransitionEffectEventSignal();
426 * @brief This signal is emitted when the keyboard repeat is changed.
428 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
431 * @brief This signal is emitted when the window redraw is requested.
433 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
438 WindowBase(const WindowBase&) = delete;
441 WindowBase& operator=(const WindowBase& rhs) = delete;
445 IconifySignalType mIconifyChangedSignal;
446 FocusSignalType mFocusChangedSignal;
447 OutputSignalType mOutputTransformedSignal;
448 DeleteSignalType mDeleteRequestSignal;
449 DamageSignalType mWindowDamagedSignal;
450 RotationSignalType mRotationSignal;
451 TouchEventSignalType mTouchEventSignal;
452 WheelEventSignalType mWheelEventSignal;
453 KeyEventSignalType mKeyEventSignal;
454 SelectionSignalType mSelectionDataSendSignal;
455 SelectionSignalType mSelectionDataReceivedSignal;
456 StyleSignalType mStyleChangedSignal;
457 AccessibilitySignalType mAccessibilitySignal;
458 TransitionEffectEventSignalType mTransitionEffectEventSignal;
459 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
460 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
463 } // namespace Adaptor
465 } // namespace internal
469 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H