1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
5 * Copyright (c) 2018 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/public-api/adaptor-framework/window.h>
23 #include <dali/public-api/adaptor-framework/key-grab.h>
24 #include <dali/public-api/adaptor-framework/style-change.h>
25 #include <dali/internal/window-system/common/indicator-interface.h>
26 #include <dali/internal/window-system/common/damage-observer.h>
27 #include <dali/internal/window-system/common/rotation-observer.h>
28 #include <dali/internal/graphics/gles20/egl-implementation.h>
31 #include <dali/integration-api/events/key-event-integ.h>
32 #include <dali/integration-api/events/point.h>
33 #include <dali/public-api/events/wheel-event.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&, unsigned long ) > 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 typedef Signal< void ( ) > IndicatorSignalType;
89 * @brief Default constructor
96 virtual ~WindowBase();
101 * @brief Get the native window handle
102 * @return The native window handle
104 virtual Any GetNativeWindow() = 0;
107 * @brief Get the native window id
108 * @return The native window id
110 virtual int GetNativeWindowId() = 0;
113 * @brief Create the egl window
115 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
118 * @brief Destroy the egl window
120 virtual void DestroyEglWindow() = 0;
123 * @brief Set the egl window rotation
125 virtual void SetEglWindowRotation( int angle ) = 0;
128 * @brief Set the egl window buffer transform
130 virtual void SetEglWindowBufferTransform( int angle ) = 0;
133 * @brief Set the egl window transform
135 virtual void SetEglWindowTransform( int angle ) = 0;
138 * @brief Resize the egl window
140 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
143 * @brief Returns whether the egl window support rotation or not
145 virtual bool IsEglWindowRotationSupported() = 0;
148 * @brief Move the window
150 virtual void Move( Dali::PositionSize positionSize ) = 0;
153 * @brief Resize the window
155 virtual void Resize( Dali::PositionSize positionSize ) = 0;
158 * @brief Move and resize the window
160 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
163 * @copydoc Dali::Window::ShowIndicator()
165 virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) = 0;
168 * Set the indicator properties on the window
170 virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) = 0;
173 * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged()
175 virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) = 0;
178 * @copydoc Dali::Window::SetClass()
180 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
183 * @copydoc Dali::Window::Raise()
185 virtual void Raise() = 0;
188 * @copydoc Dali::Window::Lower()
190 virtual void Lower() = 0;
193 * @copydoc Dali::Window::Activate()
195 virtual void Activate() = 0;
198 * @copydoc Dali::Window::SetAvailableOrientations()
200 virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
203 * @copydoc Dali::Window::SetPreferredOrientation()
205 virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
208 * @copydoc Dali::Window::SetAcceptFocus()
210 virtual void SetAcceptFocus( bool accept ) = 0;
213 * @copydoc Dali::Window::Show()
215 virtual void Show() = 0;
218 * @copydoc Dali::Window::Hide()
220 virtual void Hide() = 0;
223 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
225 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
228 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
230 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
233 * @copydoc Dali::Window::AddAuxiliaryHint()
235 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
238 * @copydoc Dali::Window::RemoveAuxiliaryHint()
240 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
243 * @copydoc Dali::Window::SetAuxiliaryHintValue()
245 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
248 * @copydoc Dali::Window::GetAuxiliaryHintValue()
250 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
253 * @copydoc Dali::Window::GetAuxiliaryHintId()
255 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
258 * @copydoc Dali::Window::SetInputRegion()
260 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
263 * @copydoc Dali::Window::SetType()
265 virtual void SetType( Dali::Window::Type type ) = 0;
268 * @copydoc Dali::Window::SetNotificationLevel()
270 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
273 * @copydoc Dali::Window::GetNotificationLevel()
275 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
278 * @copydoc Dali::Window::SetOpaqueState()
280 virtual void SetOpaqueState( bool opaque ) = 0;
283 * @copydoc Dali::Window::SetScreenOffMode()
285 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
288 * @copydoc Dali::Window::GetScreenOffMode()
290 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
293 * @copydoc Dali::Window::SetBrightness()
295 virtual bool SetBrightness( int brightness ) = 0;
298 * @copydoc Dali::Window::GetBrightness()
300 virtual int GetBrightness() const = 0;
303 * @copydoc Dali::KeyGrab::GrabKey()
305 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
308 * @copydoc Dali::KeyGrab::UngrabKey()
310 virtual bool UngrabKey( Dali::KEY key ) = 0;
313 * @copydoc Dali::KeyGrab::GrabKeyList()
315 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
318 * @copydoc Dali::KeyGrab::UngrabKeyList()
320 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
324 * @param[out] dpiHorizontal set to the horizontal dpi
325 * @param[out] dpiVertical set to the vertical dpi
327 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
330 * @brief Set the stereoscopic 3D view mode
331 * @param[in] viewMode The new view mode
333 virtual void SetViewMode( ViewMode viewMode ) = 0;
336 * @brief Get the screen rotation angle of the window
338 virtual int GetScreenRotationAngle() = 0;
341 * @brief Set the rotation angle of the window
343 virtual void SetWindowRotationAngle( int degree ) = 0;
346 * @brief Inform the window rotation is completed
348 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
351 * @copydoc Dali::Window::SetTransparency()
353 virtual void SetTransparency( bool transparent ) = 0;
358 * @brief This signal is emitted when the window becomes iconified or deiconified.
360 IconifySignalType& IconifyChangedSignal();
363 * @brief This signal is emitted when the window focus is changed.
365 FocusSignalType& FocusChangedSignal();
368 * @brief This signal is emitted when the output is transformed.
370 OutputSignalType& OutputTransformedSignal();
373 * @brief This signal is emitted when the window receives a delete request.
375 DeleteSignalType& DeleteRequestSignal();
378 * @brief This signal is emitted when the window is damaged.
380 DamageSignalType& WindowDamagedSignal();
383 * @brief This signal is emitted when a rotation event is recevied.
385 RotationSignalType& RotationSignal();
388 * @brief This signal is emitted when a touch event is received.
390 TouchEventSignalType& TouchEventSignal();
393 * @brief This signal is emitted when a mouse wheel is received.
395 WheelEventSignalType& WheelEventSignal();
398 * @brief This signal is emitted when a key event is received.
400 KeyEventSignalType& KeyEventSignal();
403 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
405 SelectionSignalType& SelectionDataSendSignal();
408 * @brief This signal is emitted when the source window sends us about the selected content.
410 SelectionSignalType& SelectionDataReceivedSignal();
413 * @brief This signal is emitted when the style is changed.
415 StyleSignalType& StyleChangedSignal();
418 * @brief This signal is emitted when an accessibility event is received.
420 AccessibilitySignalType& AccessibilitySignal();
423 * @brief This signal is emitted when an indicator is flicked.
425 IndicatorSignalType& IndicatorFlickedSignal();
430 WindowBase(const WindowBase&) = delete;
433 WindowBase& operator=(const WindowBase& rhs) = delete;
437 IconifySignalType mIconifyChangedSignal;
438 FocusSignalType mFocusChangedSignal;
439 OutputSignalType mOutputTransformedSignal;
440 DeleteSignalType mDeleteRequestSignal;
441 DamageSignalType mWindowDamagedSignal;
442 RotationSignalType mRotationSignal;
443 TouchEventSignalType mTouchEventSignal;
444 WheelEventSignalType mWheelEventSignal;
445 KeyEventSignalType mKeyEventSignal;
446 SelectionSignalType mSelectionDataSendSignal;
447 SelectionSignalType mSelectionDataReceivedSignal;
448 StyleSignalType mStyleChangedSignal;
449 AccessibilitySignalType mAccessibilitySignal;
450 IndicatorSignalType mIndicatorFlickedSignal;
453 } // namespace Adaptor
455 } // namespace internal
459 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H