[Tizen] Add screen and client rotation itself function
[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) 2019 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/public-api/events/wheel-event.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/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>
36
37 namespace Dali
38 {
39 namespace Internal
40 {
41 namespace Adaptor
42 {
43
44 /**
45  * WindowBase interface
46  */
47 class WindowBase
48 {
49 public:
50
51   /**
52    * @brief Struct used to retrieve accessibility information
53    */
54   struct AccessibilityInfo
55   {
56     int gestureValue;
57     int startX;
58     int startY;
59     int endX;
60     int endY;
61     int state;
62     int eventTime;
63   };
64
65   // Window
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;
72
73   // Input events
74   typedef Signal< void ( Integration::Point&, uint32_t ) > TouchEventSignalType;
75   typedef Signal< void ( WheelEvent& ) > WheelEventSignalType;
76   typedef Signal< void( Integration::KeyEvent& ) > KeyEventSignalType;
77
78   // Clipboard
79   typedef Signal< void ( void* ) > SelectionSignalType;
80
81   // Accessibility
82   typedef Signal< void ( StyleChange::Type ) > StyleSignalType;
83   typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
84
85   /**
86    * @brief Default constructor
87    */
88   WindowBase();
89
90   /**
91    * @brief Destructor
92    */
93   virtual ~WindowBase();
94
95 public:
96
97   /**
98    * @brief Get the native window handle
99    * @return The native window handle
100    */
101   virtual Any GetNativeWindow() = 0;
102
103   /**
104    * @brief Get the native window id
105    * @return The native window id
106    */
107   virtual int GetNativeWindowId() = 0;
108
109   /**
110    * @brief Create the egl window
111    */
112   virtual EGLNativeWindowType CreateEglWindow( int width, int height ) = 0;
113
114   /**
115    * @brief Destroy the egl window
116    */
117   virtual void DestroyEglWindow() = 0;
118
119   /**
120    * @brief Set the egl window rotation
121    */
122   virtual void SetEglWindowRotation( int angle ) = 0;
123
124   /**
125    * @brief Set the egl window buffer transform
126    */
127   virtual void SetEglWindowBufferTransform( int angle ) = 0;
128
129   /**
130    * @brief Set the egl window transform
131    */
132   virtual void SetEglWindowTransform( int angle ) = 0;
133
134   /**
135    * @brief Resize the egl window
136    */
137   virtual void ResizeEglWindow( Dali::PositionSize positionSize ) = 0;
138
139   /**
140    * @brief Returns whether the egl window support rotation or not
141    */
142   virtual bool IsEglWindowRotationSupported() = 0;
143
144   /**
145    * @brief Move the window
146    */
147   virtual void Move( Dali::PositionSize positionSize ) = 0;
148
149   /**
150    * @brief Resize the window
151    */
152   virtual void Resize( Dali::PositionSize positionSize ) = 0;
153
154   /**
155    * @brief Move and resize the window
156    */
157   virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
158
159   /**
160    * @copydoc Dali::Window::SetClass()
161    */
162   virtual void SetClass( const std::string& name, const std::string& className ) = 0;
163
164   /**
165    * @copydoc Dali::Window::Raise()
166    */
167   virtual void Raise() = 0;
168
169   /**
170    * @copydoc Dali::Window::Lower()
171    */
172   virtual void Lower() = 0;
173
174   /**
175    * @copydoc Dali::Window::Activate()
176    */
177   virtual void Activate() = 0;
178
179   /**
180    * @copydoc Dali::Window::SetAvailableOrientations()
181    */
182   virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
183
184   /**
185    * @copydoc Dali::Window::SetPreferredOrientation()
186    */
187   virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
188
189   /**
190    * @copydoc Dali::Window::SetAcceptFocus()
191    */
192   virtual void SetAcceptFocus( bool accept ) = 0;
193
194   /**
195    * @copydoc Dali::Window::Show()
196    */
197   virtual void Show() = 0;
198
199   /**
200    * @copydoc Dali::Window::Hide()
201    */
202   virtual void Hide() = 0;
203
204   /**
205    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
206    */
207   virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
208
209   /**
210    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
211    */
212   virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
213
214   /**
215    * @copydoc Dali::Window::AddAuxiliaryHint()
216    */
217   virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
218
219   /**
220    * @copydoc Dali::Window::RemoveAuxiliaryHint()
221    */
222   virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
223
224   /**
225    * @copydoc Dali::Window::SetAuxiliaryHintValue()
226    */
227   virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
228
229   /**
230    * @copydoc Dali::Window::GetAuxiliaryHintValue()
231    */
232   virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
233
234   /**
235    * @copydoc Dali::Window::GetAuxiliaryHintId()
236    */
237   virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
238
239   /**
240    * @copydoc Dali::Window::SetInputRegion()
241    */
242   virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
243
244   /**
245    * @copydoc Dali::Window::SetType()
246    */
247   virtual void SetType( Dali::Window::Type type ) = 0;
248
249   /**
250    * @copydoc Dali::Window::SetNotificationLevel()
251    */
252   virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
253
254   /**
255    * @copydoc Dali::Window::GetNotificationLevel()
256    */
257   virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
258
259   /**
260    * @copydoc Dali::Window::SetOpaqueState()
261    */
262   virtual void SetOpaqueState( bool opaque ) = 0;
263
264   /**
265    * @copydoc Dali::Window::SetScreenOffMode()
266    */
267   virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
268
269   /**
270    * @copydoc Dali::Window::GetScreenOffMode()
271    */
272   virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
273
274   /**
275    * @copydoc Dali::Window::SetBrightness()
276    */
277   virtual bool SetBrightness( int brightness ) = 0;
278
279   /**
280    * @copydoc Dali::Window::GetBrightness()
281    */
282   virtual int GetBrightness() const = 0;
283
284   /**
285    * @copydoc Dali::KeyGrab::GrabKey()
286    */
287   virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
288
289   /**
290    * @copydoc Dali::KeyGrab::UngrabKey()
291    */
292   virtual bool UngrabKey( Dali::KEY key ) = 0;
293
294   /**
295    * @copydoc Dali::KeyGrab::GrabKeyList()
296    */
297   virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
298
299   /**
300    * @copydoc Dali::KeyGrab::UngrabKeyList()
301    */
302   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
303
304   /**
305    * @brief Get DPI
306    * @param[out] dpiHorizontal set to the horizontal dpi
307    * @param[out] dpiVertical set to the vertical dpi
308    */
309   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
310
311   /**
312    * @brief Return the orientation of the surface.
313    * @return The orientation
314    */
315   virtual int GetOrientation() const = 0;
316
317   /**
318    * @brief Get the screen rotation angle of the window
319    */
320   virtual int GetScreenRotationAngle() = 0;
321
322   /**
323    * @brief Set the rotation angle of the window
324    */
325   virtual void SetWindowRotationAngle( int degree ) = 0;
326
327     /**
328    * @brief Get the rotation angle of the window
329    */
330   virtual int GetWindowRotationAngle() = 0;
331
332   /**
333    * @brief Inform the window rotation is completed
334    */
335   virtual void WindowRotationCompleted( int degree, int width, int height ) = 0;
336
337   /**
338    * @copydoc Dali::Window::SetTransparency()
339    */
340   virtual void SetTransparency( bool transparent ) = 0;
341
342   /**
343    * @copydoc Dali::Window::SetParent()
344    */
345   virtual void SetParent( WindowBase* parentWinBase ) = 0;
346
347   // Signals
348
349   /**
350    * @brief This signal is emitted when the window becomes iconified or deiconified.
351    */
352    IconifySignalType& IconifyChangedSignal();
353
354   /**
355    * @brief This signal is emitted when the window focus is changed.
356    */
357   FocusSignalType& FocusChangedSignal();
358
359   /**
360    * @brief This signal is emitted when the output is transformed.
361    */
362   OutputSignalType& OutputTransformedSignal();
363
364   /**
365    * @brief This signal is emitted when the window receives a delete request.
366    */
367   DeleteSignalType& DeleteRequestSignal();
368
369   /**
370    * @brief This signal is emitted when the window is damaged.
371    */
372   DamageSignalType& WindowDamagedSignal();
373
374   /**
375    * @brief This signal is emitted when a rotation event is recevied.
376    */
377   RotationSignalType& RotationSignal();
378
379   /**
380    * @brief This signal is emitted when a touch event is received.
381    */
382   TouchEventSignalType& TouchEventSignal();
383
384   /**
385    * @brief This signal is emitted when a mouse wheel is received.
386    */
387   WheelEventSignalType& WheelEventSignal();
388
389   /**
390    * @brief This signal is emitted when a key event is received.
391    */
392   KeyEventSignalType& KeyEventSignal();
393
394   /**
395    * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
396    */
397   SelectionSignalType& SelectionDataSendSignal();
398
399   /**
400    * @brief This signal is emitted when the source window sends us about the selected content.
401    */
402   SelectionSignalType& SelectionDataReceivedSignal();
403
404   /**
405    * @brief This signal is emitted when the style is changed.
406    */
407   StyleSignalType& StyleChangedSignal();
408
409   /**
410    * @brief This signal is emitted when an accessibility event is received.
411    */
412   AccessibilitySignalType& AccessibilitySignal();
413
414 protected:
415
416   // Undefined
417   WindowBase(const WindowBase&) = delete;
418
419   // Undefined
420   WindowBase& operator=(const WindowBase& rhs) = delete;
421
422 protected:
423
424   IconifySignalType                    mIconifyChangedSignal;
425   FocusSignalType                      mFocusChangedSignal;
426   OutputSignalType                     mOutputTransformedSignal;
427   DeleteSignalType                     mDeleteRequestSignal;
428   DamageSignalType                     mWindowDamagedSignal;
429   RotationSignalType                   mRotationSignal;
430   TouchEventSignalType                 mTouchEventSignal;
431   WheelEventSignalType                 mWheelEventSignal;
432   KeyEventSignalType                   mKeyEventSignal;
433   SelectionSignalType                  mSelectionDataSendSignal;
434   SelectionSignalType                  mSelectionDataReceivedSignal;
435   StyleSignalType                      mStyleChangedSignal;
436   AccessibilitySignalType              mAccessibilitySignal;
437 };
438
439 } // namespace Adaptor
440
441 } // namespace internal
442
443 } // namespace Dali
444
445 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H