1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
5 * Copyright (c) 2019 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/public-api/events/wheel-event.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/internal/window-system/common/damage-observer.h>
34 #include <dali/internal/window-system/common/rotation-event.h>
35 #include <dali/internal/graphics/gles/egl-implementation.h>
45 * 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;
74 typedef Signal< void ( Integration::Point&, uint32_t ) > TouchEventSignalType;
75 typedef Signal< void ( WheelEvent& ) > WheelEventSignalType;
76 typedef Signal< void( Integration::KeyEvent& ) > KeyEventSignalType;
79 typedef Signal< void ( void* ) > SelectionSignalType;
82 typedef Signal< void ( StyleChange::Type ) > StyleSignalType;
83 typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
86 * @brief Default constructor
93 virtual ~WindowBase();
98 * @brief Get the native window handle
99 * @return The native window handle
101 virtual Any GetNativeWindow() = 0;
104 * @brief Get the native window id
105 * @return The native window id
107 virtual int GetNativeWindowId() = 0;
110 * @brief Create the egl window
112 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
115 * @brief Destroy the egl window
117 virtual void DestroyEglWindow() = 0;
120 * @brief Set the egl window rotation
122 virtual void SetEglWindowRotation( int angle ) = 0;
125 * @brief Set the egl window buffer transform
127 virtual void SetEglWindowBufferTransform( int angle ) = 0;
130 * @brief Set the egl window transform
132 virtual void SetEglWindowTransform( int angle ) = 0;
135 * @brief Resize the egl window
137 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
140 * @brief Returns whether the egl window support rotation or not
142 virtual bool IsEglWindowRotationSupported() = 0;
145 * @brief Move the window
147 virtual void Move( Dali::PositionSize positionSize ) = 0;
150 * @brief Resize the window
152 virtual void Resize( Dali::PositionSize positionSize ) = 0;
155 * @brief Move and resize the window
157 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
160 * @copydoc Dali::Window::SetClass()
162 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
165 * @copydoc Dali::Window::Raise()
167 virtual void Raise() = 0;
170 * @copydoc Dali::Window::Lower()
172 virtual void Lower() = 0;
175 * @copydoc Dali::Window::Activate()
177 virtual void Activate() = 0;
180 * @copydoc Dali::Window::SetAvailableOrientations()
182 virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
185 * @copydoc Dali::Window::SetPreferredOrientation()
187 virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
190 * @copydoc Dali::Window::SetAcceptFocus()
192 virtual void SetAcceptFocus( bool accept ) = 0;
195 * @copydoc Dali::Window::Show()
197 virtual void Show() = 0;
200 * @copydoc Dali::Window::Hide()
202 virtual void Hide() = 0;
205 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
207 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
210 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
212 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
215 * @copydoc Dali::Window::AddAuxiliaryHint()
217 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
220 * @copydoc Dali::Window::RemoveAuxiliaryHint()
222 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
225 * @copydoc Dali::Window::SetAuxiliaryHintValue()
227 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
230 * @copydoc Dali::Window::GetAuxiliaryHintValue()
232 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
235 * @copydoc Dali::Window::GetAuxiliaryHintId()
237 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
240 * @copydoc Dali::Window::SetInputRegion()
242 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
245 * @copydoc Dali::Window::SetType()
247 virtual void SetType( Dali::Window::Type type ) = 0;
250 * @copydoc Dali::Window::SetNotificationLevel()
252 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
255 * @copydoc Dali::Window::GetNotificationLevel()
257 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
260 * @copydoc Dali::Window::SetOpaqueState()
262 virtual void SetOpaqueState( bool opaque ) = 0;
265 * @copydoc Dali::Window::SetScreenOffMode()
267 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
270 * @copydoc Dali::Window::GetScreenOffMode()
272 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
275 * @copydoc Dali::Window::SetBrightness()
277 virtual bool SetBrightness( int brightness ) = 0;
280 * @copydoc Dali::Window::GetBrightness()
282 virtual int GetBrightness() const = 0;
285 * @copydoc Dali::KeyGrab::GrabKey()
287 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
290 * @copydoc Dali::KeyGrab::UngrabKey()
292 virtual bool UngrabKey( Dali::KEY key ) = 0;
295 * @copydoc Dali::KeyGrab::GrabKeyList()
297 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
300 * @copydoc Dali::KeyGrab::UngrabKeyList()
302 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
306 * @param[out] dpiHorizontal set to the horizontal dpi
307 * @param[out] dpiVertical set to the vertical dpi
309 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
312 * @brief Get the screen rotation angle of the window
314 virtual int GetScreenRotationAngle() = 0;
317 * @brief Set the rotation angle of the window
319 virtual void SetWindowRotationAngle( int degree ) = 0;
322 * @brief Inform the window rotation is completed
324 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
327 * @copydoc Dali::Window::SetTransparency()
329 virtual void SetTransparency( bool transparent ) = 0;
332 * @copydoc Dali::Window::SetParent()
334 virtual void SetParent( WindowBase* parentWinBase ) = 0;
339 * @brief This signal is emitted when the window becomes iconified or deiconified.
341 IconifySignalType& IconifyChangedSignal();
344 * @brief This signal is emitted when the window focus is changed.
346 FocusSignalType& FocusChangedSignal();
349 * @brief This signal is emitted when the output is transformed.
351 OutputSignalType& OutputTransformedSignal();
354 * @brief This signal is emitted when the window receives a delete request.
356 DeleteSignalType& DeleteRequestSignal();
359 * @brief This signal is emitted when the window is damaged.
361 DamageSignalType& WindowDamagedSignal();
364 * @brief This signal is emitted when a rotation event is recevied.
366 RotationSignalType& RotationSignal();
369 * @brief This signal is emitted when a touch event is received.
371 TouchEventSignalType& TouchEventSignal();
374 * @brief This signal is emitted when a mouse wheel is received.
376 WheelEventSignalType& WheelEventSignal();
379 * @brief This signal is emitted when a key event is received.
381 KeyEventSignalType& KeyEventSignal();
384 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
386 SelectionSignalType& SelectionDataSendSignal();
389 * @brief This signal is emitted when the source window sends us about the selected content.
391 SelectionSignalType& SelectionDataReceivedSignal();
394 * @brief This signal is emitted when the style is changed.
396 StyleSignalType& StyleChangedSignal();
399 * @brief This signal is emitted when an accessibility event is received.
401 AccessibilitySignalType& AccessibilitySignal();
406 WindowBase(const WindowBase&) = delete;
409 WindowBase& operator=(const WindowBase& rhs) = delete;
413 IconifySignalType mIconifyChangedSignal;
414 FocusSignalType mFocusChangedSignal;
415 OutputSignalType mOutputTransformedSignal;
416 DeleteSignalType mDeleteRequestSignal;
417 DamageSignalType mWindowDamagedSignal;
418 RotationSignalType mRotationSignal;
419 TouchEventSignalType mTouchEventSignal;
420 WheelEventSignalType mWheelEventSignal;
421 KeyEventSignalType mKeyEventSignal;
422 SelectionSignalType mSelectionDataSendSignal;
423 SelectionSignalType mSelectionDataReceivedSignal;
424 StyleSignalType mStyleChangedSignal;
425 AccessibilitySignalType mAccessibilitySignal;
428 } // namespace Adaptor
430 } // namespace internal
434 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H