[Tizen] Save and send the position of the focused actor
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-base.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
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>
25 #include <string>
26 #include <vector>
27 #include <cstdint>
28
29 // INTERNAL INCLUDES
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>
37
38 #ifdef DALI_ELDBUS_AVAILABLE
39 #include <Eldbus.h>
40 #endif
41
42 namespace Dali
43 {
44 namespace Internal
45 {
46 namespace Adaptor
47 {
48
49 /**
50  * WindowBase interface
51  */
52 class WindowBase
53 {
54 public:
55
56   /**
57    * @brief Struct used to retrieve accessibility information
58    */
59   struct AccessibilityInfo
60   {
61     int gestureValue;
62     int startX;
63     int startY;
64     int endX;
65     int endY;
66     int state;
67     int eventTime;
68     unsigned char quickpanelInfo; // to retrieve quick panel information for Accessibility
69     #ifdef DALI_ELDBUS_AVAILABLE
70     Eldbus_Proxy* proxy;
71     #endif // DALI_ELDBUS_AVAILABLE
72   };
73
74   // Window
75   typedef Signal< void ( bool ) > IconifySignalType;
76   typedef Signal< void ( bool ) > FocusSignalType;
77   typedef Signal< void ( ) > OutputSignalType;
78   typedef Signal< void ( ) > DeleteSignalType;
79   typedef Signal< void ( const DamageArea& ) > DamageSignalType;
80   typedef Signal< void ( const RotationEvent& ) > RotationSignalType;
81   typedef Signal< void ( DevelWindow::EffectState, DevelWindow::EffectType ) > TransitionEffectEventSignalType;
82   typedef Signal< void ( ) > KeyboardRepeatSettingsChangedSignalType;
83   typedef Signal< void ( ) > WindowRedrawRequestSignalType;
84
85   // Input events
86   typedef Signal< void ( Integration::Point&, uint32_t ) > TouchEventSignalType;
87   typedef Signal< void ( Integration::WheelEvent& ) > WheelEventSignalType;
88   typedef Signal< void( Integration::KeyEvent& ) > KeyEventSignalType;
89
90   // Clipboard
91   typedef Signal< void ( void* ) > SelectionSignalType;
92
93   // Accessibility
94   typedef Signal< void ( StyleChange::Type ) > StyleSignalType;
95   typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
96   typedef Signal< void ( const unsigned char& ) > QuickPanelSignalType;
97
98   /**
99    * @brief Default constructor
100    */
101   WindowBase();
102
103   /**
104    * @brief Destructor
105    */
106   virtual ~WindowBase();
107
108 public:
109
110   /**
111    * @brief Get the native window handle
112    * @return The native window handle
113    */
114   virtual Any GetNativeWindow() = 0;
115
116   /**
117    * @brief Get the native window id
118    * @return The native window id
119    */
120   virtual int GetNativeWindowId() = 0;
121
122   /**
123    * @brief Create the egl window
124    */
125   virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
126
127   /**
128    * @brief Destroy the egl window
129    */
130   virtual void DestroyEglWindow() = 0;
131
132   /**
133    * @brief Set the egl window rotation
134    */
135   virtual void SetEglWindowRotation( int angle ) = 0;
136
137   /**
138    * @brief Set the egl window buffer transform
139    */
140   virtual void SetEglWindowBufferTransform( int angle ) = 0;
141
142   /**
143    * @brief Set the egl window transform
144    */
145   virtual void SetEglWindowTransform( int angle ) = 0;
146
147   /**
148    * @brief Resize the egl window
149    */
150   virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
151
152   /**
153    * @brief Returns whether the egl window support rotation or not
154    */
155   virtual bool IsEglWindowRotationSupported() = 0;
156
157   /**
158    * @brief Move the window
159    */
160   virtual void Move( Dali::PositionSize positionSize ) = 0;
161
162   /**
163    * @brief Resize the window
164    */
165   virtual void Resize( Dali::PositionSize positionSize ) = 0;
166
167   /**
168    * @brief Move and resize the window
169    */
170   virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
171
172   /**
173    * @copydoc Dali::Window::SetClass()
174    */
175   virtual void SetClass( const std::string& name, const std::string& className ) = 0;
176
177   /**
178    * @copydoc Dali::Window::Raise()
179    */
180   virtual void Raise() = 0;
181
182   /**
183    * @copydoc Dali::Window::Lower()
184    */
185   virtual void Lower() = 0;
186
187   /**
188    * @copydoc Dali::Window::Activate()
189    */
190   virtual void Activate() = 0;
191
192   /**
193    * @copydoc Dali::Window::SetAvailableOrientations()
194    */
195   virtual void SetAvailableAnlges( const std::vector< int >& angles ) = 0;
196
197   /**
198    * @copydoc Dali::Window::SetPreferredOrientation()
199    */
200   virtual void SetPreferredAngle( int angle ) = 0;
201
202   /**
203    * @copydoc Dali::Window::SetAcceptFocus()
204    */
205   virtual void SetAcceptFocus( bool accept ) = 0;
206
207   /**
208    * @copydoc Dali::Window::Show()
209    */
210   virtual void Show() = 0;
211
212   /**
213    * @copydoc Dali::Window::Hide()
214    */
215   virtual void Hide() = 0;
216
217   /**
218    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
219    */
220   virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
221
222   /**
223    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
224    */
225   virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
226
227   /**
228    * @copydoc Dali::Window::AddAuxiliaryHint()
229    */
230   virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
231
232   /**
233    * @copydoc Dali::Window::RemoveAuxiliaryHint()
234    */
235   virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
236
237   /**
238    * @copydoc Dali::Window::SetAuxiliaryHintValue()
239    */
240   virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
241
242   /**
243    * @copydoc Dali::Window::GetAuxiliaryHintValue()
244    */
245   virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
246
247   /**
248    * @copydoc Dali::Window::GetAuxiliaryHintId()
249    */
250   virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
251
252   /**
253    * @copydoc Dali::Window::SetInputRegion()
254    */
255   virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
256
257   /**
258    * @copydoc Dali::Window::SetType()
259    */
260   virtual void SetType( Dali::Window::Type type ) = 0;
261
262   /**
263    * @copydoc Dali::Window::SetNotificationLevel()
264    */
265   virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
266
267   /**
268    * @copydoc Dali::Window::GetNotificationLevel()
269    */
270   virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
271
272   /**
273    * @copydoc Dali::Window::SetOpaqueState()
274    */
275   virtual void SetOpaqueState( bool opaque ) = 0;
276
277   /**
278    * @copydoc Dali::Window::SetScreenOffMode()
279    */
280   virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
281
282   /**
283    * @copydoc Dali::Window::GetScreenOffMode()
284    */
285   virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
286
287   /**
288    * @copydoc Dali::Window::SetBrightness()
289    */
290   virtual bool SetBrightness( int brightness ) = 0;
291
292   /**
293    * @copydoc Dali::Window::GetBrightness()
294    */
295   virtual int GetBrightness() const = 0;
296
297   /**
298    * @copydoc Dali::KeyGrab::GrabKey()
299    */
300   virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
301
302   /**
303    * @copydoc Dali::KeyGrab::UngrabKey()
304    */
305   virtual bool UngrabKey( Dali::KEY key ) = 0;
306
307   /**
308    * @copydoc Dali::KeyGrab::GrabKeyList()
309    */
310   virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
311
312   /**
313    * @copydoc Dali::KeyGrab::UngrabKeyList()
314    */
315   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
316
317   /**
318    * @brief Get DPI
319    * @param[out] dpiHorizontal set to the horizontal dpi
320    * @param[out] dpiVertical set to the vertical dpi
321    */
322   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
323
324   /**
325    * @brief Return the orientation of the surface.
326    * @return The orientation
327    */
328   virtual int GetOrientation() const = 0;
329
330   /**
331    * @brief Get the screen rotation angle of the window
332    */
333   virtual int GetScreenRotationAngle() = 0;
334
335   /**
336    * @brief Set the rotation angle of the window
337    */
338   virtual void SetWindowRotationAngle( int degree ) = 0;
339
340     /**
341    * @brief Get the rotation angle of the window
342    */
343   virtual int GetWindowRotationAngle() = 0;
344
345   /**
346    * @brief Inform the window rotation is completed
347    */
348   virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
349
350   /**
351    * @copydoc Dali::Window::SetTransparency()
352    */
353   virtual void SetTransparency( bool transparent ) = 0;
354
355   /**
356    * @copydoc Dali::Window::SetParent()
357    */
358   virtual void SetParent( WindowBase* parentWinBase ) = 0;
359
360   /**
361    * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
362    * @return The file descriptor that tells when it is rendered.
363    */
364   virtual int CreateFrameRenderedSyncFence() = 0;
365
366   /**
367    * @brief Create a sync fence that can tell the frame is presented by the display server.
368    * @return The file descriptor that tells when it is presented.
369    */
370   virtual int CreateFramePresentedSyncFence() = 0;
371
372   // Signals
373
374   /**
375    * @brief This signal is emitted when the window becomes iconified or deiconified.
376    */
377    IconifySignalType& IconifyChangedSignal();
378
379   /**
380    * @brief This signal is emitted when the window focus is changed.
381    */
382   FocusSignalType& FocusChangedSignal();
383
384   /**
385    * @brief This signal is emitted when the output is transformed.
386    */
387   OutputSignalType& OutputTransformedSignal();
388
389   /**
390    * @brief This signal is emitted when the window receives a delete request.
391    */
392   DeleteSignalType& DeleteRequestSignal();
393
394   /**
395    * @brief This signal is emitted when the window is damaged.
396    */
397   DamageSignalType& WindowDamagedSignal();
398
399   /**
400    * @brief This signal is emitted when a rotation event is recevied.
401    */
402   RotationSignalType& RotationSignal();
403
404   /**
405    * @brief This signal is emitted when a touch event is received.
406    */
407   TouchEventSignalType& TouchEventSignal();
408
409   /**
410    * @brief This signal is emitted when a mouse wheel is received.
411    */
412   WheelEventSignalType& WheelEventSignal();
413
414   /**
415    * @brief This signal is emitted when a key event is received.
416    */
417   KeyEventSignalType& KeyEventSignal();
418
419   /**
420    * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
421    */
422   SelectionSignalType& SelectionDataSendSignal();
423
424   /**
425    * @brief This signal is emitted when the source window sends us about the selected content.
426    */
427   SelectionSignalType& SelectionDataReceivedSignal();
428
429   /**
430    * @brief This signal is emitted when the style is changed.
431    */
432   StyleSignalType& StyleChangedSignal();
433
434   /**
435    * @brief This signal is emitted when an accessibility event is received.
436    */
437   AccessibilitySignalType& AccessibilitySignal();
438
439   /**
440    * @brief This signal is emitted when a quick panel event for accessibility is received.
441    */
442   QuickPanelSignalType& QuickPanelSignal();
443
444   /**
445    * @brief This signal is emitted when window's transition animation is started or ended.
446    */
447   TransitionEffectEventSignalType& TransitionEffectEventSignal();
448
449   /**
450    * @brief This signal is emitted when the keyboard repeat is changed.
451    */
452   KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
453
454   /**
455    * @brief This signal is emitted when the window redraw is requested.
456    */
457   WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
458
459 protected:
460
461   // Undefined
462   WindowBase(const WindowBase&) = delete;
463
464   // Undefined
465   WindowBase& operator=(const WindowBase& rhs) = delete;
466
467 protected:
468
469   IconifySignalType                       mIconifyChangedSignal;
470   FocusSignalType                         mFocusChangedSignal;
471   OutputSignalType                        mOutputTransformedSignal;
472   DeleteSignalType                        mDeleteRequestSignal;
473   DamageSignalType                        mWindowDamagedSignal;
474   RotationSignalType                      mRotationSignal;
475   TouchEventSignalType                    mTouchEventSignal;
476   WheelEventSignalType                    mWheelEventSignal;
477   KeyEventSignalType                      mKeyEventSignal;
478   SelectionSignalType                     mSelectionDataSendSignal;
479   SelectionSignalType                     mSelectionDataReceivedSignal;
480   StyleSignalType                         mStyleChangedSignal;
481   AccessibilitySignalType                 mAccessibilitySignal;
482   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
483   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
484   WindowRedrawRequestSignalType           mWindowRedrawRequestSignal;
485   QuickPanelSignalType                    mQuickPanelSignal;
486   AccessibilityInfo                       mAccessibilityInfo;
487 };
488
489 } // namespace Adaptor
490
491 } // namespace internal
492
493 } // namespace Dali
494
495 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H