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