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