[Tizen] Add IsFloatingModeEnabled api in devel window
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / window-devel.h
1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
3
4 /*
5  * Copyright (c) 2023 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 <memory>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/mouse-in-out-event.h>
26 #include <dali/public-api/adaptor-framework/window-enumerations.h>
27 #include <dali/public-api/adaptor-framework/window.h>
28 #include <dali/public-api/common/vector-wrapper.h>
29
30 namespace Dali
31 {
32 class KeyEvent;
33 class TouchEvent;
34 class WheelEvent;
35 class RenderTaskList;
36 struct TouchPoint;
37
38 namespace DevelWindow
39 {
40 typedef Signal<void()>                                                               EventProcessingFinishedSignalType;       ///< Event Processing finished signal type
41 typedef Signal<void(const KeyEvent&)>                                                KeyEventSignalType;                      ///< Key event signal type
42 typedef Signal<void(const TouchEvent&)>                                              TouchEventSignalType;                    ///< Touch signal type
43 typedef Signal<void(const WheelEvent&)>                                              WheelEventSignalType;                    ///< Wheel signal type
44 typedef Signal<void(Window, bool)>                                                   VisibilityChangedSignalType;             ///< Visibility changed signal type
45 typedef Signal<void(Window, WindowEffectState, WindowEffectType)>                    TransitionEffectEventSignalType;         ///< Effect signal type and state
46 typedef Signal<void()>                                                               KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
47 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;              ///< Auxiliary message signal type
48 typedef Signal<void(Window, bool)>                                                   AccessibilityHighlightSignalType;        ///< Accessibility Highlight signal type
49 typedef Signal<bool(const KeyEvent&)>                                                InterceptKeyEventSignalType;             ///< Intercept Key event signal type
50 typedef Signal<void(Window, Dali::Window::WindowPosition)>                           MovedSignalType;                         ///< Window Moved signal type
51 typedef Signal<void(Window, Dali::WindowOrientation)>                                OrientationChangedSignalType;            ///< Window orientation changed signal type
52 typedef Signal<void(Window, const Dali::DevelWindow::MouseInOutEvent&)>              MouseInOutEventSignalType;               ///< MouseInOutEvent signal type
53 typedef Signal<void(Window, Dali::Window::WindowPosition)>                           MoveCompletedSignalType;                 ///< Window Moved by Server signal type
54 typedef Signal<void(Window, Dali::Window::WindowSize)>                               ResizeCompletedSignalType;               ///< Window Resized by Server signal type
55
56 /**
57  * @brief Creates an initialized handle to a new Window.
58  *
59  * @param[in] surface Can be a window or pixmap.
60  * @param[in] windowPosition The position and size of the Window
61  * @param[in] name The Window title
62  * @param[in] isTransparent Whether Window is transparent
63  * @return A new window
64  * @note This creates an extra window in addition to the default main window
65  */
66 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
67
68 /**
69  * @brief Creates an initialized handle to a new Window.
70  *
71  * @param[in] surface Can be a window or pixmap.
72  * @param[in] windowPosition The position and size of the Window
73  * @param[in] name The Window title
74  * @param[in] className The Window class name
75  * @param[in] isTransparent Whether Window is transparent
76  * @note This creates an extra window in addition to the default main window
77  * @return A new Window
78  */
79 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
80
81 /**
82  * @brief Sets position and size of the window. This API guarantees that both moving and resizing of window will appear on the screen at once.
83  *
84  * @param[in] window The window instance
85  * @param[in] positionSize The new window position and size
86  */
87 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
88
89 /**
90  * @brief Retrieve the window that the given actor is added to.
91  *
92  * @param[in] actor The actor
93  * @return The window the actor is added to or an empty handle if the actor is not added to any window.
94  */
95 DALI_ADAPTOR_API Window Get(Actor actor);
96
97 /**
98  * @brief This signal is emitted just after the event processing is finished.
99  *
100  * @param[in] window The window instance
101  * @return The signal to connect to
102  */
103 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
104
105 /**
106  * @brief This signal is emitted when wheel event is received.
107  *
108  * A callback of the following type may be connected:
109  * @code
110  *   void YourCallbackName(const WheelEvent& event);
111  * @endcode
112  * @param[in] window The window instance
113  * @return The signal to connect to
114  */
115 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
116
117 /**
118  * @brief This signal is emitted when the window is shown or hidden.
119  *
120  * A callback of the following type may be connected:
121  * @code
122  *   void YourCallbackName( Window window, bool visible );
123  * @endcode
124  * @param[in] window The window instance
125  * @return The signal to connect to
126  */
127 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
128
129 /**
130  * @brief This signal is emitted for transition effect.
131  *
132  * The transition animation is appeared when the window is shown/hidden.
133  * When the animation is started, START signal is emitted.
134  * Then the animation is ended, END signal is emitted, too.
135  * A callback of the following type may be connected:
136  * @code
137  *   void YourCallbackName( Window window, EffectState state, EffectType type );
138  * @endcode
139  * @param[in] window The window instance
140  * @return The signal to connect to
141  */
142 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
143
144 /**
145  * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
146  *
147  * @param[in] window The window instance
148  * @return The signal to connect to
149  */
150 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
151
152 /**
153  * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
154  *
155  * Auxiliary message is sent by display server.
156  * When client application added the window's auxiliary hint and if the auxiliary is changed,
157  * display server send the auxiliary message.
158  * Auxiliary message has the key, value and options.
159  *
160  * @param[in] window The window instance
161  * @return The signal to connect to
162  */
163 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
164
165 /**
166  * @brief This signal is emitted when the window needs to grab or clear accessibility highlight.
167  * The highlight indicates that it is an object to interact with the user regardless of focus.
168  * After setting the highlight on the object, you can do things that the object can do, such as
169  * giving or losing focus.
170  *
171  * This signal is emitted by Dali::Accessibility::Component::GrabHighlight
172  * and Dali::Accessibility::Component::ClearHighlight
173  *
174  * A callback of the following type may be connected:
175  * @code
176  *   void YourCallbackName( Window window, bool highlight );
177  * @endcode
178  *
179  * @param[in] window The window instance
180  * @return The signal to connect to
181  */
182 DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window);
183
184 /**
185  * @brief Sets parent window of the window.
186  *
187  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
188  * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
189  * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
190  *
191  * @param[in] window The window instance
192  * @param[in] parent The parent window instance
193  */
194 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
195
196 /**
197  * @brief Sets parent window of the window.
198  *
199  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
200  * This function has the additional flag whether the child is located above or below of the parent.
201  *
202  * @param[in] window The window instance
203  * @param[in] parent The parent window instance
204  * @param[in] belowParent The flag is whether the child is located above or below of the parent.
205  */
206 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
207
208 /**
209  * @brief Unsets parent window of the window.
210  *
211  * After unsetting, the window is disconnected his parent window.
212  *
213  * @param[in] window The window instance
214  */
215 DALI_ADAPTOR_API void Unparent(Window window);
216
217 /**
218  * @brief Gets parent window of the window.
219  *
220  * @param[in] window The window instance
221  * @return The parent window of the window
222  */
223 DALI_ADAPTOR_API Window GetParent(Window window);
224
225 /**
226  * @brief Gets current orientation of the window.
227  *
228  * @param[in] window The window instance
229  * @return The current window orientation if previously set, or none
230  */
231 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
232
233 /**
234  * @brief Gets current physical orientation of the window.
235  *
236  * It means current physical rotation angle of the window.
237  * If the height of the display device's area is greater than the width,
238  * default current orientation is PORTRAIT and current physical orientation angle is 0.
239  * If the width of the display device's area is greater than the height,
240  * default current orientation is LANDSCAPE and current physical orientation angle is 0.
241  *
242  * @param[in] window The window instance
243  * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
244  */
245 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
246
247 /**
248  * @brief Sets available orientations of the window.
249  *
250  * This API is for setting several orientations one time.
251  *
252  * @param[in] window The window instance
253  * @param[in] orientations The available orientation list to add
254  */
255 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
256
257 /**
258  * @brief Gets current window ID.
259  *
260  * @param[in] window The window instance
261  */
262 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
263
264 /**
265  * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
266  *
267  * @param[in] window The window instance
268  * @param[in] callback The function to call
269  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
270  *
271  * @note A callback of the following type may be used:
272  * @code
273  *   void MyFunction( int frameId );
274  * @endcode
275  * This callback will be deleted once it is called.
276  *
277  * @note Ownership of the callback is passed onto this class.
278  */
279 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
280
281 /**
282  * @brief Adds a callback that is called when the frame is displayed on the display.
283  *
284  * @param[in] window The window instance
285  * @param[in] callback The function to call
286  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
287  *
288  * @note A callback of the following type may be used:
289  * @code
290  *   void MyFunction( int frameId );
291  * @endcode
292  * This callback will be deleted once it is called.
293  *
294  * @note Ownership of the callback is passed onto this class.
295  */
296 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
297
298 /**
299  * @brief Sets window position and size for specific orientation.
300  * This api reserves the position and size per orientation to display server.
301  * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
302  *
303  * @param[in] window The window instance
304  * @param[in] positionSize The reserved position and size for the orientation
305  * @param[in] orientation The orientation
306  *
307  * @note Currently, it only works when the window's type is WindowType::IME.
308  * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
309  * @note This function is only useful in Tizen world.
310  */
311 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
312
313 /**
314  * @brief Requests to display server for the window is moved by display server.
315  *
316  * This function should be called in mouse down event callback function.
317  * After this function is called in mouse down event callback function, the window is moved with mouse move event.
318  * When mouse up event happens, the window moved work is finished.
319  *
320  * @param[in] window The window instance
321  */
322 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
323
324 /**
325  * @brief Requests to display server for the window is resized by display server.
326  *
327  * This function should be called in mouse down event callback function.
328  * After this function is called in mouse down event callback function, the window is resized with mouse move event.
329  * The direction is selected one of eight ways.
330  * When mouse up event happens, the window resized work is finished.
331  *
332  * @param[in] window The window instance
333  * @param[in] direction it is indicated the window's side or edge for starting point.
334  */
335 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
336
337 /**
338  * @brief Enables the floating mode of window.
339  *
340  * The floating mode is to support making partial size window easliy.
341  * It is useful to make popup style window and this window is always upper than the other normal window.
342  * In addition, it is easy to change between popup style and normal style window.
343  *
344  * A special display server(as a Tizen display server) supports this mode.
345  *
346  * @param[in] window The window instance.
347  * @param[in] enable Enable floating mode or not.
348  */
349 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
350
351 /**
352  * @brief Returns whether the window is floating mode or not.
353  *
354  * @param[in] window The window instance.
355  * @return True if the window is enabled floating mode, false otherwise.
356  */
357 DALI_ADAPTOR_API bool IsFloatingModeEnabled(Window window);
358
359 /**
360  * @brief Includes input region.
361  *
362  * This function inlcudes input regions.
363  * It can be used multiple times and supports multiple regions.
364  * It means input region will be extended.
365  *
366  * This input is related to mouse and touch event.
367  * If device has touch screen, this function is useful.
368  * Otherwise device does not have that, we can use it after connecting mouse to the device.
369  *
370  * @param[in] window The window instance.
371  * @param[in] inputRegion The added region to accept input events.
372  */
373 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
374
375 /**
376  * @brief Excludes input region.
377  *
378  * This function excludes input regions.
379  * It can be used multiple times and supports multiple regions.
380  * It means input region will be reduced.
381  * Nofice, should be set input area by IncludeInputRegion() before this function is used.
382  *
383  * This input is related to mouse and touch event.
384  * If device has touch screen, this function is useful.
385  * Otherwise device does not have that, we can use it after connecting mouse to the device.
386  *
387  * @param[in] window The window instance.
388  * @param[in] inputRegion The subtracted region to except input events.
389  */
390 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
391
392 /**
393  * @brief Sets the necessary for window rotation Acknowledgement.
394  * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
395  *
396  * This function is supprot that application has the window rotation acknowledgement's control.
397  * It means display server waits when application's rotation work is finished.
398  * It is useful application has the other rendering engine which works asynchronous.
399  * For instance, GlView.
400  * It only works on Tizen device.
401  *
402  * @param[in] window The window instance.
403  * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
404  */
405 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
406
407 /**
408  * @brief send the Acknowledgement to complete window rotation.
409  * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
410  *
411  * @param[in] window The window instance.
412  */
413 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
414
415 /**
416  * @brief Feed (Send) touch event to window
417  * @param[in] window The window instance
418  * @param[in] point The touch point
419  * @param[in] timeStamp The time stamp
420  */
421 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
422
423 /**
424  * @brief Feed (Send) wheel event to window
425  * @param[in] window The window instance
426  * @param[in] wheelEvent The wheel event
427  */
428 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
429
430 /**
431  * @brief Feed (Send) key event to window
432  * @param[in] window The window instance
433  * @param[in] keyEvent The key event holding the key information.
434  */
435 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
436
437 /**
438  * @brief Maximizes window's size.
439  * If this function is called with true, window will be resized with screen size.
440  * Otherwise window will be resized with previous size.
441  * It is for the window's MAX button in window's border.
442  *
443  * It is for client application.
444  * If window border is supported by display server, it is not necessary.
445  *
446  * @param[in] window The window instance.
447  * @param[in] maximize If window is maximized or unmaximized.
448  */
449 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
450
451 /**
452  * @brief Returns whether the window is maximized or not.
453  *
454  * @param[in] window The window instance.
455  * @return True if the window is maximized, false otherwise.
456  */
457 DALI_ADAPTOR_API bool IsMaximized(Window window);
458
459 /**
460  * @brief Sets window's maximum size.
461  *
462  * It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
463  * Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
464  *
465  * After setting, if Maximize() is called, window is resized with the setting size and move the center.
466  *
467  * @param[in] window The window instance.
468  * @param[in] size the maximum size
469  */
470 DALI_ADAPTOR_API void SetMaximumSize(Window window, Dali::Window::WindowSize size);
471
472 /**
473  * @brief Minimizes window's size.
474  * If this function is called with true, window will be iconified.
475  * Otherwise window will be activated.
476  * It is for the window's MIN button in window border.
477  *
478  * It is for client application.
479  * If window border is supported by display server, it is not necessary.
480  *
481  * @param[in] window The window instance.
482  * @param[in] minimize If window is minimized or unminimized(activated).
483  */
484 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
485
486 /**
487  * @brief Returns whether the window is minimized or not.
488  *
489  * @param[in] window The window instance.
490  * @return True if the window is minimized, false otherwise.
491  */
492 DALI_ADAPTOR_API bool IsMinimized(Window window);
493
494 /**
495  * @brief Sets window's minimum size.
496  *
497  * It is to set the minimum size when window's size is decreased by RequestResizeToServer().
498  * Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
499  *
500  * @param[in] window The window instance.
501  * @param[in] size the minimum size
502  */
503 DALI_ADAPTOR_API void SetMimimumSize(Window window, Dali::Window::WindowSize size);
504
505 /**
506  * @brief Query whether window is rotating or not.
507  *
508  * @param[in] window The window instance.
509  * @return true if window is rotating, false otherwise.
510  */
511 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
512
513 /**
514  * @brief Gets the last key event the window gets.
515  *
516  * @param[in] window The window instance.
517  * @return The last key event the window gets.
518  */
519 DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
520
521 /**
522  * @brief Gets the last touch event the window gets.
523  *
524  * @param[in] window The window instance.
525  * @return The last touch event the window gets.
526  * @note It returns the raw event the window gets. There is no hit-actor and local position information.
527  */
528 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
529
530 /**
531  * @brief The user would connect to this signal to intercept a KeyEvent at window.
532  *
533  * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
534  * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
535  *
536  * @param[in] window The window instance.
537  * @return The signal to connect to
538  */
539 DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window);
540
541 /**
542  * @brief This signal is emitted when the window is moved.
543  *
544  * A callback of the following type may be connected:
545  * @code
546  *   void YourCallbackName( Window window, Dali::Window::WindowPosition position );
547  * @endcode
548  * The parameters are the moved x and y coordinates.
549  * and window means this signal was called from what window
550  *
551  * @param[in] window The window instance.
552  * @return The signal to connect to
553  */
554 DALI_ADAPTOR_API MovedSignalType& MovedSignal(Window window);
555
556 /**
557  * @brief This signal is emitted when the window orientation is changed.
558  *
559  * To emit Window Orientation signal, AddAvailableOrientation() or SetPreferredOrientation() should be called before device is rotated.
560  * Most of cases, AddAvailableOrientation() or SetPreferredOrientation() is callled in onCreate().
561  *
562  * A callback of the following type may be connected:
563  * @code
564  *   void YourCallbackName( Window window, Dali::WindowOrientation orientation );
565  * @endcode
566  * The parameter is the changed window orientation.
567  * and window means this signal was called from what window
568  *
569  * @param[in] window The window instance.
570  * @return The signal to connect to
571  */
572 DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
573
574 /**
575  * @brief This signal is emitted when the mouse in or out event is received.
576  *
577  * A callback of the following type may be connected:
578  * @code
579  *   void YourCallbackName( Window window, Dali::MouseInOutEvent event );
580  * @endcode
581  *
582  * @param[in] window The window instance.
583  * @return The signal to connect to
584  */
585 DALI_ADAPTOR_API MouseInOutEventSignalType& MouseInOutEventSignal(Window window);
586
587 /**
588  * @brief This signal is emitted when window has been moved by the display server.
589  * To make the window move by display server, RequestMoveToServer() should be called.
590  * After the moving job is completed, this function will be called.
591  *
592  * A callback of the following type may be connected:
593  * @code
594  *   void YourCallbackName( Window window, Dali::Window::WindowPosition position );
595  * @endcode
596  * The parameters are the moved x and y coordinates.
597  * and window means this signal was called from what window
598  *
599  * @param[in] window The window instance.
600  * @return The signal to connect to
601  */
602 DALI_ADAPTOR_API MoveCompletedSignalType& MoveCompletedSignal(Window window);
603
604 /**
605  * @brief This signal is emitted when window has been resized by the display server.
606  * To make the window move by display server, RequestResizeToServer() should be called.
607  * After the resizing job is completed, this function will be called.
608  *
609  * A callback of the following type may be connected:
610  * @code
611  *   void YourCallbackName( Window window, Dali::Window::WindowPosition position );
612  * @endcode
613  * The parameters are the resized width and height coordinates.
614  * and window means this signal was called from what window
615  *
616  * @param[in] window The window instance.
617  * @return The signal to connect to
618  */
619 DALI_ADAPTOR_API ResizeCompletedSignalType& ResizeCompletedSignal(Window window);
620
621 } // namespace DevelWindow
622
623 } // namespace Dali
624
625 #endif // DALI_WINDOW_DEVEL_H