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/devel-api/adaptor-framework/window-devel.h>
34 #include <dali/internal/window-system/common/damage-observer.h>
35 #include <dali/internal/window-system/common/rotation-event.h>
36 #include <dali/internal/graphics/gles/egl-implementation.h>
46 * WindowBase interface
53 * @brief Struct used to retrieve accessibility information
55 struct AccessibilityInfo
64 unsigned char quickpanelInfo; // to retrieve quick panel information for Accessibility
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 ( DevelWindow::EffectState, DevelWindow::EffectType ) > 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;
89 typedef Signal< void ( const unsigned char& ) > QuickPanelSignalType;
92 * @brief Default constructor
99 virtual ~WindowBase();
104 * @brief Get the native window handle
105 * @return The native window handle
107 virtual Any GetNativeWindow() = 0;
110 * @brief Get the native window id
111 * @return The native window id
113 virtual int GetNativeWindowId() = 0;
116 * @brief Create the egl window
118 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
121 * @brief Destroy the egl window
123 virtual void DestroyEglWindow() = 0;
126 * @brief Set the egl window rotation
128 virtual void SetEglWindowRotation( int angle ) = 0;
131 * @brief Set the egl window buffer transform
133 virtual void SetEglWindowBufferTransform( int angle ) = 0;
136 * @brief Set the egl window transform
138 virtual void SetEglWindowTransform( int angle ) = 0;
141 * @brief Resize the egl window
143 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
146 * @brief Returns whether the egl window support rotation or not
148 virtual bool IsEglWindowRotationSupported() = 0;
151 * @brief Move the window
153 virtual void Move( Dali::PositionSize positionSize ) = 0;
156 * @brief Resize the window
158 virtual void Resize( Dali::PositionSize positionSize ) = 0;
161 * @brief Move and resize the window
163 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
166 * @copydoc Dali::Window::SetClass()
168 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
171 * @copydoc Dali::Window::Raise()
173 virtual void Raise() = 0;
176 * @copydoc Dali::Window::Lower()
178 virtual void Lower() = 0;
181 * @copydoc Dali::Window::Activate()
183 virtual void Activate() = 0;
186 * @copydoc Dali::Window::SetAvailableOrientations()
188 virtual void SetAvailableAnlges( const std::vector< int >& angles ) = 0;
191 * @copydoc Dali::Window::SetPreferredOrientation()
193 virtual void SetPreferredAngle( int angle ) = 0;
196 * @copydoc Dali::Window::SetAcceptFocus()
198 virtual void SetAcceptFocus( bool accept ) = 0;
201 * @copydoc Dali::Window::Show()
203 virtual void Show() = 0;
206 * @copydoc Dali::Window::Hide()
208 virtual void Hide() = 0;
211 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
213 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
216 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
218 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
221 * @copydoc Dali::Window::AddAuxiliaryHint()
223 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
226 * @copydoc Dali::Window::RemoveAuxiliaryHint()
228 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
231 * @copydoc Dali::Window::SetAuxiliaryHintValue()
233 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
236 * @copydoc Dali::Window::GetAuxiliaryHintValue()
238 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
241 * @copydoc Dali::Window::GetAuxiliaryHintId()
243 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
246 * @copydoc Dali::Window::SetInputRegion()
248 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
251 * @copydoc Dali::Window::SetType()
253 virtual void SetType( Dali::Window::Type type ) = 0;
256 * @copydoc Dali::Window::SetNotificationLevel()
258 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
261 * @copydoc Dali::Window::GetNotificationLevel()
263 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
266 * @copydoc Dali::Window::SetOpaqueState()
268 virtual void SetOpaqueState( bool opaque ) = 0;
271 * @copydoc Dali::Window::SetScreenOffMode()
273 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
276 * @copydoc Dali::Window::GetScreenOffMode()
278 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
281 * @copydoc Dali::Window::SetBrightness()
283 virtual bool SetBrightness( int brightness ) = 0;
286 * @copydoc Dali::Window::GetBrightness()
288 virtual int GetBrightness() const = 0;
291 * @copydoc Dali::KeyGrab::GrabKey()
293 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
296 * @copydoc Dali::KeyGrab::UngrabKey()
298 virtual bool UngrabKey( Dali::KEY key ) = 0;
301 * @copydoc Dali::KeyGrab::GrabKeyList()
303 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
306 * @copydoc Dali::KeyGrab::UngrabKeyList()
308 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
312 * @param[out] dpiHorizontal set to the horizontal dpi
313 * @param[out] dpiVertical set to the vertical dpi
315 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
318 * @brief Return the orientation of the surface.
319 * @return The orientation
321 virtual int GetOrientation() const = 0;
324 * @brief Get the screen rotation angle of the window
326 virtual int GetScreenRotationAngle() = 0;
329 * @brief Set the rotation angle of the window
331 virtual void SetWindowRotationAngle( int degree ) = 0;
334 * @brief Get the rotation angle of the window
336 virtual int GetWindowRotationAngle() = 0;
339 * @brief Inform the window rotation is completed
341 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
344 * @copydoc Dali::Window::SetTransparency()
346 virtual void SetTransparency( bool transparent ) = 0;
349 * @copydoc Dali::Window::SetParent()
351 virtual void SetParent( WindowBase* parentWinBase ) = 0;
354 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
355 * @return The file descriptor that tells when it is rendered.
357 virtual int CreateFrameRenderedSyncFence() = 0;
360 * @brief Create a sync fence that can tell the frame is presented by the display server.
361 * @return The file descriptor that tells when it is presented.
363 virtual int CreateFramePresentedSyncFence() = 0;
368 * @brief This signal is emitted when the window becomes iconified or deiconified.
370 IconifySignalType& IconifyChangedSignal();
373 * @brief This signal is emitted when the window focus is changed.
375 FocusSignalType& FocusChangedSignal();
378 * @brief This signal is emitted when the output is transformed.
380 OutputSignalType& OutputTransformedSignal();
383 * @brief This signal is emitted when the window receives a delete request.
385 DeleteSignalType& DeleteRequestSignal();
388 * @brief This signal is emitted when the window is damaged.
390 DamageSignalType& WindowDamagedSignal();
393 * @brief This signal is emitted when a rotation event is recevied.
395 RotationSignalType& RotationSignal();
398 * @brief This signal is emitted when a touch event is received.
400 TouchEventSignalType& TouchEventSignal();
403 * @brief This signal is emitted when a mouse wheel is received.
405 WheelEventSignalType& WheelEventSignal();
408 * @brief This signal is emitted when a key event is received.
410 KeyEventSignalType& KeyEventSignal();
413 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
415 SelectionSignalType& SelectionDataSendSignal();
418 * @brief This signal is emitted when the source window sends us about the selected content.
420 SelectionSignalType& SelectionDataReceivedSignal();
423 * @brief This signal is emitted when the style is changed.
425 StyleSignalType& StyleChangedSignal();
428 * @brief This signal is emitted when an accessibility event is received.
430 AccessibilitySignalType& AccessibilitySignal();
433 * @brief This signal is emitted when a quick panel event for accessibility is received.
435 QuickPanelSignalType& QuickPanelSignal();
438 * @brief This signal is emitted when window's transition animation is started or ended.
440 TransitionEffectEventSignalType& TransitionEffectEventSignal();
443 * @brief This signal is emitted when the keyboard repeat is changed.
445 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
448 * @brief This signal is emitted when the window redraw is requested.
450 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
455 WindowBase(const WindowBase&) = delete;
458 WindowBase& operator=(const WindowBase& rhs) = delete;
462 IconifySignalType mIconifyChangedSignal;
463 FocusSignalType mFocusChangedSignal;
464 OutputSignalType mOutputTransformedSignal;
465 DeleteSignalType mDeleteRequestSignal;
466 DamageSignalType mWindowDamagedSignal;
467 RotationSignalType mRotationSignal;
468 TouchEventSignalType mTouchEventSignal;
469 WheelEventSignalType mWheelEventSignal;
470 KeyEventSignalType mKeyEventSignal;
471 SelectionSignalType mSelectionDataSendSignal;
472 SelectionSignalType mSelectionDataReceivedSignal;
473 StyleSignalType mStyleChangedSignal;
474 AccessibilitySignalType mAccessibilitySignal;
475 TransitionEffectEventSignalType mTransitionEffectEventSignal;
476 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
477 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
478 QuickPanelSignalType mQuickPanelSignal;
481 } // namespace Adaptor
483 } // namespace internal
487 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H