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
67 typedef Signal< void ( bool ) > IconifySignalType;
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 ( DevelWindow::EffectState, DevelWindow::EffectType ) > TransitionEffectEventSignalType;
74 typedef Signal< void ( ) > KeyboardRepeatSettingsChangedSignalType;
75 typedef Signal< void ( ) > WindowRedrawRequestSignalType;
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();
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 Create the egl window
116 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
119 * @brief Destroy the egl window
121 virtual void DestroyEglWindow() = 0;
124 * @brief Set the egl window rotation
126 virtual void SetEglWindowRotation( int angle ) = 0;
129 * @brief Set the egl window buffer transform
131 virtual void SetEglWindowBufferTransform( int angle ) = 0;
134 * @brief Set the egl window transform
136 virtual void SetEglWindowTransform( int angle ) = 0;
139 * @brief Resize the egl window
141 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
144 * @brief Returns whether the egl window support rotation or not
146 virtual bool IsEglWindowRotationSupported() = 0;
149 * @brief Move the window
151 virtual void Move( Dali::PositionSize positionSize ) = 0;
154 * @brief Resize the window
156 virtual void Resize( Dali::PositionSize positionSize ) = 0;
159 * @brief Move and resize the window
161 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
164 * @copydoc Dali::Window::SetClass()
166 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
169 * @copydoc Dali::Window::Raise()
171 virtual void Raise() = 0;
174 * @copydoc Dali::Window::Lower()
176 virtual void Lower() = 0;
179 * @copydoc Dali::Window::Activate()
181 virtual void Activate() = 0;
184 * @copydoc Dali::Window::SetAvailableOrientations()
186 virtual void SetAvailableAnlges( const std::vector< int >& angles ) = 0;
189 * @copydoc Dali::Window::SetPreferredOrientation()
191 virtual void SetPreferredAngle( int angle ) = 0;
194 * @copydoc Dali::Window::SetAcceptFocus()
196 virtual void SetAcceptFocus( bool accept ) = 0;
199 * @copydoc Dali::Window::Show()
201 virtual void Show() = 0;
204 * @copydoc Dali::Window::Hide()
206 virtual void Hide() = 0;
209 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
211 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
214 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
216 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
219 * @copydoc Dali::Window::AddAuxiliaryHint()
221 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
224 * @copydoc Dali::Window::RemoveAuxiliaryHint()
226 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
229 * @copydoc Dali::Window::SetAuxiliaryHintValue()
231 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
234 * @copydoc Dali::Window::GetAuxiliaryHintValue()
236 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
239 * @copydoc Dali::Window::GetAuxiliaryHintId()
241 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
244 * @copydoc Dali::Window::SetInputRegion()
246 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
249 * @copydoc Dali::Window::SetType()
251 virtual void SetType( Dali::Window::Type type ) = 0;
254 * @copydoc Dali::Window::SetNotificationLevel()
256 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
259 * @copydoc Dali::Window::GetNotificationLevel()
261 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
264 * @copydoc Dali::Window::SetOpaqueState()
266 virtual void SetOpaqueState( bool opaque ) = 0;
269 * @copydoc Dali::Window::SetScreenOffMode()
271 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
274 * @copydoc Dali::Window::GetScreenOffMode()
276 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
279 * @copydoc Dali::Window::SetBrightness()
281 virtual bool SetBrightness( int brightness ) = 0;
284 * @copydoc Dali::Window::GetBrightness()
286 virtual int GetBrightness() const = 0;
289 * @copydoc Dali::KeyGrab::GrabKey()
291 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
294 * @copydoc Dali::KeyGrab::UngrabKey()
296 virtual bool UngrabKey( Dali::KEY key ) = 0;
299 * @copydoc Dali::KeyGrab::GrabKeyList()
301 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
304 * @copydoc Dali::KeyGrab::UngrabKeyList()
306 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
310 * @param[out] dpiHorizontal set to the horizontal dpi
311 * @param[out] dpiVertical set to the vertical dpi
313 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
316 * @brief Return the orientation of the surface.
317 * @return The orientation
319 virtual int GetOrientation() const = 0;
322 * @brief Get the screen rotation angle of the window
324 virtual int GetScreenRotationAngle() = 0;
327 * @brief Set the rotation angle of the window
329 virtual void SetWindowRotationAngle( int degree ) = 0;
332 * @brief Get the rotation angle of the window
334 virtual int GetWindowRotationAngle() = 0;
337 * @brief Inform the window rotation is completed
339 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
342 * @copydoc Dali::Window::SetTransparency()
344 virtual void SetTransparency( bool transparent ) = 0;
347 * @copydoc Dali::Window::SetParent()
349 virtual void SetParent( WindowBase* parentWinBase ) = 0;
352 * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
353 * @return The file descriptor that tells when it is rendered.
355 virtual int CreateFrameRenderedSyncFence() = 0;
358 * @brief Create a sync fence that can tell the frame is presented by the display server.
359 * @return The file descriptor that tells when it is presented.
361 virtual int CreateFramePresentedSyncFence() = 0;
366 * @brief This signal is emitted when the window becomes iconified or deiconified.
368 IconifySignalType& IconifyChangedSignal();
371 * @brief This signal is emitted when the window focus is changed.
373 FocusSignalType& FocusChangedSignal();
376 * @brief This signal is emitted when the output is transformed.
378 OutputSignalType& OutputTransformedSignal();
381 * @brief This signal is emitted when the window receives a delete request.
383 DeleteSignalType& DeleteRequestSignal();
386 * @brief This signal is emitted when the window is damaged.
388 DamageSignalType& WindowDamagedSignal();
391 * @brief This signal is emitted when a rotation event is recevied.
393 RotationSignalType& RotationSignal();
396 * @brief This signal is emitted when a touch event is received.
398 TouchEventSignalType& TouchEventSignal();
401 * @brief This signal is emitted when a mouse wheel is received.
403 WheelEventSignalType& WheelEventSignal();
406 * @brief This signal is emitted when a key event is received.
408 KeyEventSignalType& KeyEventSignal();
411 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
413 SelectionSignalType& SelectionDataSendSignal();
416 * @brief This signal is emitted when the source window sends us about the selected content.
418 SelectionSignalType& SelectionDataReceivedSignal();
421 * @brief This signal is emitted when the style is changed.
423 StyleSignalType& StyleChangedSignal();
426 * @brief This signal is emitted when an accessibility event is received.
428 AccessibilitySignalType& AccessibilitySignal();
431 * @brief This signal is emitted when window's transition animation is started or ended.
433 TransitionEffectEventSignalType& TransitionEffectEventSignal();
436 * @brief This signal is emitted when the keyboard repeat is changed.
438 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
441 * @brief This signal is emitted when the window redraw is requested.
443 WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
448 WindowBase(const WindowBase&) = delete;
451 WindowBase& operator=(const WindowBase& rhs) = delete;
455 IconifySignalType mIconifyChangedSignal;
456 FocusSignalType mFocusChangedSignal;
457 OutputSignalType mOutputTransformedSignal;
458 DeleteSignalType mDeleteRequestSignal;
459 DamageSignalType mWindowDamagedSignal;
460 RotationSignalType mRotationSignal;
461 TouchEventSignalType mTouchEventSignal;
462 WheelEventSignalType mWheelEventSignal;
463 KeyEventSignalType mKeyEventSignal;
464 SelectionSignalType mSelectionDataSendSignal;
465 SelectionSignalType mSelectionDataReceivedSignal;
466 StyleSignalType mStyleChangedSignal;
467 AccessibilitySignalType mAccessibilitySignal;
468 TransitionEffectEventSignalType mTransitionEffectEventSignal;
469 KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
470 WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
473 } // namespace Adaptor
475 } // namespace internal
479 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H