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/damage-observer.h>
26 #include <dali/internal/window-system/common/rotation-observer.h>
27 #include <dali/internal/graphics/gles/egl-implementation.h>
30 #include <dali/integration-api/events/key-event-integ.h>
31 #include <dali/integration-api/events/point.h>
32 #include <dali/public-api/events/wheel-event.h>
44 * WindowBase interface
51 * @brief Struct used to retrieve accessibility information
53 struct AccessibilityInfo
65 typedef Signal< void ( bool ) > IconifySignalType;
66 typedef Signal< void ( bool ) > FocusSignalType;
67 typedef Signal< void ( ) > OutputSignalType;
68 typedef Signal< void ( ) > DeleteSignalType;
69 typedef Signal< void ( const DamageArea& ) > DamageSignalType;
70 typedef Signal< void ( const RotationEvent& ) > RotationSignalType;
73 typedef Signal< void ( Integration::Point&, unsigned long ) > TouchEventSignalType;
74 typedef Signal< void ( WheelEvent& ) > WheelEventSignalType;
75 typedef Signal< void( Integration::KeyEvent& ) > KeyEventSignalType;
78 typedef Signal< void ( void* ) > SelectionSignalType;
81 typedef Signal< void ( StyleChange::Type ) > StyleSignalType;
82 typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
85 * @brief Default constructor
92 virtual ~WindowBase();
97 * @brief Get the native window handle
98 * @return The native window handle
100 virtual Any GetNativeWindow() = 0;
103 * @brief Get the native window id
104 * @return The native window id
106 virtual int GetNativeWindowId() = 0;
109 * @brief Create the egl window
111 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
114 * @brief Destroy the egl window
116 virtual void DestroyEglWindow() = 0;
119 * @brief Set the egl window rotation
121 virtual void SetEglWindowRotation( int angle ) = 0;
124 * @brief Set the egl window buffer transform
126 virtual void SetEglWindowBufferTransform( int angle ) = 0;
129 * @brief Set the egl window transform
131 virtual void SetEglWindowTransform( int angle ) = 0;
134 * @brief Resize the egl window
136 virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
139 * @brief Returns whether the egl window support rotation or not
141 virtual bool IsEglWindowRotationSupported() = 0;
144 * @brief Move the window
146 virtual void Move( Dali::PositionSize positionSize ) = 0;
149 * @brief Resize the window
151 virtual void Resize( Dali::PositionSize positionSize ) = 0;
154 * @brief Move and resize the window
156 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
159 * @copydoc Dali::Window::SetClass()
161 virtual void SetClass( const std::string& name, const std::string& className ) = 0;
164 * @copydoc Dali::Window::Raise()
166 virtual void Raise() = 0;
169 * @copydoc Dali::Window::Lower()
171 virtual void Lower() = 0;
174 * @copydoc Dali::Window::Activate()
176 virtual void Activate() = 0;
179 * @copydoc Dali::Window::SetAvailableOrientations()
181 virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
184 * @copydoc Dali::Window::SetPreferredOrientation()
186 virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
189 * @copydoc Dali::Window::SetAcceptFocus()
191 virtual void SetAcceptFocus( bool accept ) = 0;
194 * @copydoc Dali::Window::Show()
196 virtual void Show() = 0;
199 * @copydoc Dali::Window::Hide()
201 virtual void Hide() = 0;
204 * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
206 virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
209 * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
211 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
214 * @copydoc Dali::Window::AddAuxiliaryHint()
216 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
219 * @copydoc Dali::Window::RemoveAuxiliaryHint()
221 virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
224 * @copydoc Dali::Window::SetAuxiliaryHintValue()
226 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
229 * @copydoc Dali::Window::GetAuxiliaryHintValue()
231 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
234 * @copydoc Dali::Window::GetAuxiliaryHintId()
236 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
239 * @copydoc Dali::Window::SetInputRegion()
241 virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
244 * @copydoc Dali::Window::SetType()
246 virtual void SetType( Dali::Window::Type type ) = 0;
249 * @copydoc Dali::Window::SetNotificationLevel()
251 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
254 * @copydoc Dali::Window::GetNotificationLevel()
256 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
259 * @copydoc Dali::Window::SetOpaqueState()
261 virtual void SetOpaqueState( bool opaque ) = 0;
264 * @copydoc Dali::Window::SetScreenOffMode()
266 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
269 * @copydoc Dali::Window::GetScreenOffMode()
271 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
274 * @copydoc Dali::Window::SetBrightness()
276 virtual bool SetBrightness( int brightness ) = 0;
279 * @copydoc Dali::Window::GetBrightness()
281 virtual int GetBrightness() const = 0;
284 * @copydoc Dali::KeyGrab::GrabKey()
286 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
289 * @copydoc Dali::KeyGrab::UngrabKey()
291 virtual bool UngrabKey( Dali::KEY key ) = 0;
294 * @copydoc Dali::KeyGrab::GrabKeyList()
296 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
299 * @copydoc Dali::KeyGrab::UngrabKeyList()
301 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
305 * @param[out] dpiHorizontal set to the horizontal dpi
306 * @param[out] dpiVertical set to the vertical dpi
308 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
311 * @brief Get the screen rotation angle of the window
313 virtual int GetScreenRotationAngle() = 0;
316 * @brief Set the rotation angle of the window
318 virtual void SetWindowRotationAngle( int degree ) = 0;
321 * @brief Inform the window rotation is completed
323 virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
326 * @copydoc Dali::Window::SetTransparency()
328 virtual void SetTransparency( bool transparent ) = 0;
333 * @brief This signal is emitted when the window becomes iconified or deiconified.
335 IconifySignalType& IconifyChangedSignal();
338 * @brief This signal is emitted when the window focus is changed.
340 FocusSignalType& FocusChangedSignal();
343 * @brief This signal is emitted when the output is transformed.
345 OutputSignalType& OutputTransformedSignal();
348 * @brief This signal is emitted when the window receives a delete request.
350 DeleteSignalType& DeleteRequestSignal();
353 * @brief This signal is emitted when the window is damaged.
355 DamageSignalType& WindowDamagedSignal();
358 * @brief This signal is emitted when a rotation event is recevied.
360 RotationSignalType& RotationSignal();
363 * @brief This signal is emitted when a touch event is received.
365 TouchEventSignalType& TouchEventSignal();
368 * @brief This signal is emitted when a mouse wheel is received.
370 WheelEventSignalType& WheelEventSignal();
373 * @brief This signal is emitted when a key event is received.
375 KeyEventSignalType& KeyEventSignal();
378 * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
380 SelectionSignalType& SelectionDataSendSignal();
383 * @brief This signal is emitted when the source window sends us about the selected content.
385 SelectionSignalType& SelectionDataReceivedSignal();
388 * @brief This signal is emitted when the style is changed.
390 StyleSignalType& StyleChangedSignal();
393 * @brief This signal is emitted when an accessibility event is received.
395 AccessibilitySignalType& AccessibilitySignal();
400 WindowBase(const WindowBase&) = delete;
403 WindowBase& operator=(const WindowBase& rhs) = delete;
407 IconifySignalType mIconifyChangedSignal;
408 FocusSignalType mFocusChangedSignal;
409 OutputSignalType mOutputTransformedSignal;
410 DeleteSignalType mDeleteRequestSignal;
411 DamageSignalType mWindowDamagedSignal;
412 RotationSignalType mRotationSignal;
413 TouchEventSignalType mTouchEventSignal;
414 WheelEventSignalType mWheelEventSignal;
415 KeyEventSignalType mKeyEventSignal;
416 SelectionSignalType mSelectionDataSendSignal;
417 SelectionSignalType mSelectionDataReceivedSignal;
418 StyleSignalType mStyleChangedSignal;
419 AccessibilitySignalType mAccessibilitySignal;
422 } // namespace Adaptor
424 } // namespace internal
428 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H