[AT-SPI] Window: add highlight signal
[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) 2021 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/public-api/adaptor-framework/window-enumerations.h>
26 #include <dali/public-api/adaptor-framework/window.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28
29 namespace Dali
30 {
31 class KeyEvent;
32 class TouchEvent;
33 class WheelEvent;
34 class RenderTaskList;
35 struct TouchPoint;
36
37 namespace DevelWindow
38 {
39
40 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
41
42 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
43
44 typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
45
46 typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
47
48 typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
49
50 typedef Signal<void(Window, WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
51
52 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
53
54 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType; ///< Auxiliary message signal type
55
56 typedef Signal<void(Window, bool)> AccessibilityHighlightSignalType; ///< Accessibility Highlight signal type
57
58 /**
59  * @brief Creates an initialized handle to a new Window.
60  *
61  * @param[in] surface Can be a window or pixmap.
62  * @param[in] windowPosition The position and size of the Window
63  * @param[in] name The Window title
64  * @param[in] isTransparent Whether Window is transparent
65  * @return A new window
66  * @note This creates an extra window in addition to the default main window
67 */
68 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
69
70 /**
71  * @brief Creates an initialized handle to a new Window.
72  *
73  * @param[in] surface Can be a window or pixmap.
74  * @param[in] windowPosition The position and size of the Window
75  * @param[in] name The Window title
76  * @param[in] className The Window class name
77  * @param[in] isTransparent Whether Window is transparent
78  * @note This creates an extra window in addition to the default main window
79  * @return A new Window
80  */
81 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
82
83 /**
84  * @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.
85  *
86  * @param[in] window The window instance
87  * @param[in] positionSize The new window position and size
88  */
89 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
90
91 /**
92  * @brief Retrieve the window that the given actor is added to.
93  *
94  * @param[in] actor The actor
95  * @return The window the actor is added to or an empty handle if the actor is not added to any window.
96  */
97 DALI_ADAPTOR_API Window Get(Actor actor);
98
99 /**
100  * @brief This signal is emitted just after the event processing is finished.
101  *
102  * @param[in] window The window instance
103  * @return The signal to connect to
104  */
105 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
106
107 /**
108  * @brief This signal is emitted when wheel event is received.
109  *
110  * A callback of the following type may be connected:
111  * @code
112  *   void YourCallbackName(const WheelEvent& event);
113  * @endcode
114  * @param[in] window The window instance
115  * @return The signal to connect to
116  */
117 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
118
119 /**
120  * @brief This signal is emitted when the window is shown or hidden.
121  *
122  * A callback of the following type may be connected:
123  * @code
124  *   void YourCallbackName( Window window, bool visible );
125  * @endcode
126  * @param[in] window The window instance
127  * @return The signal to connect to
128  */
129 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
130
131 /**
132  * @brief This signal is emitted for transition effect.
133  *
134  * The transition animation is appeared when the window is shown/hidden.
135  * When the animation is started, START signal is emitted.
136  * Then the animation is ended, END signal is emitted, too.
137  * A callback of the following type may be connected:
138  * @code
139  *   void YourCallbackName( Window window, EffectState state, EffectType type );
140  * @endcode
141  * @param[in] window The window instance
142  * @return The signal to connect to
143  */
144 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
145
146 /**
147  * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
148  *
149  * @param[in] window The window instance
150  * @return The signal to connect to
151  */
152 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
153
154 /**
155  * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
156  *
157  * Auxiliary message is sent by display server.
158  * When client application added the window's auxiliary hint and if the auxiliary is changed,
159  * display server send the auxiliary message.
160  * Auxiliary message has the key, value and options.
161  *
162  * @param[in] window The window instance
163  * @return The signal to connect to
164  */
165 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
166
167 /**
168  * @brief This signal is emitted when the window needs to grab or clear accessibility highlight.
169  * The highlight indicates that it is an object to interact with the user regardless of focus.
170  * After setting the highlight on the object, you can do things that the object can do, such as
171  * giving or losing focus.
172  *
173  * This signal is emitted by Dali::Accessibility::Component::GrabHighlight
174  * and Dali::Accessibility::Component::ClearHighlight
175  *
176  * A callback of the following type may be connected:
177  * @code
178  *   void YourCallbackName( Window window, bool highlight );
179  * @endcode
180  *
181  * @param[in] window The window instance
182  * @return The signal to connect to
183  */
184 DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window);
185
186 /**
187  * @brief Sets parent window of the window.
188  *
189  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
190  * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
191  * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
192  *
193  * @param[in] window The window instance
194  * @param[in] parent The parent window instance
195  */
196 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
197
198 /**
199  * @brief Sets parent window of the window.
200  *
201  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
202  * This function has the additional flag whether the child is located above or below of the parent.
203  *
204  * @param[in] window The window instance
205  * @param[in] parent The parent window instance
206  * @param[in] belowParent The flag is whether the child is located above or below of the parent.
207  */
208 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
209
210 /**
211  * @brief Unsets parent window of the window.
212  *
213  * After unsetting, the window is disconnected his parent window.
214  *
215  * @param[in] window The window instance
216  */
217 DALI_ADAPTOR_API void Unparent(Window window);
218
219 /**
220  * @brief Gets parent window of the window.
221  *
222  * @param[in] window The window instance
223  * @return The parent window of the window
224  */
225 DALI_ADAPTOR_API Window GetParent(Window window);
226
227 /**
228  * @brief Downcast sceneHolder to window
229  *
230  * @param[in] handle The handle need to downcast
231  * @return The window cast from SceneHolder
232  */
233 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
234
235 /**
236  * @brief Gets current orientation of the window.
237  *
238  * @param[in] window The window instance
239  * @return The current window orientation if previously set, or none
240  */
241 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
242
243 /**
244  * @brief Gets current physical orientation of the window.
245  *
246  * It means current physical rotation angle of the window.
247  * If the height of the display device's area is greater than the width,
248  * default current orientation is PORTRAIT and current physical orientation angle is 0.
249  * If the width of the display device's area is greater than the height,
250  * default current orientation is LANDSCAPE and current physical orientation angle is 0.
251  *
252  * @param[in] window The window instance
253  * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
254  */
255 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
256
257 /**
258  * @brief Sets available orientations of the window.
259  *
260  * This API is for setting several orientations one time.
261  *
262  * @param[in] window The window instance
263  * @param[in] orientations The available orientation list to add
264  */
265 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
266
267 /**
268  * @brief Gets current window ID.
269  *
270  * @param[in] window The window instance
271  */
272 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
273
274 /**
275  * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
276  *
277  * @param[in] window The window instance
278  * @param[in] callback The function to call
279  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
280  *
281  * @note A callback of the following type may be used:
282  * @code
283  *   void MyFunction( int frameId );
284  * @endcode
285  * This callback will be deleted once it is called.
286  *
287  * @note Ownership of the callback is passed onto this class.
288  */
289 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
290
291 /**
292  * @brief Adds a callback that is called when the frame is displayed on the display.
293  *
294  * @param[in] window The window instance
295  * @param[in] callback The function to call
296  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
297  *
298  * @note A callback of the following type may be used:
299  * @code
300  *   void MyFunction( int frameId );
301  * @endcode
302  * This callback will be deleted once it is called.
303  *
304  * @note Ownership of the callback is passed onto this class.
305  */
306 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
307
308 /**
309  * @brief Sets window position and size for specific orientation.
310  * This api reserves the position and size per orientation to display server.
311  * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
312  *
313  * @param[in] window The window instance
314  * @param[in] positionSize The reserved position and size for the orientation
315  * @param[in] orientation The orientation
316  *
317  * @note Currently, it only works when the window's type is WindowType::IME.
318  * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
319  * @note This function is only useful in Tizen world.
320  */
321 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
322
323 /**
324  * @brief Requests to display server for the window is moved by display server.
325  *
326  * This function should be called in mouse down event callback function.
327  * After this function is called in mouse down event callback function, the window is moved with mouse move event.
328  * When mouse up event happens, the window moved work is finished.
329  *
330  * @param[in] window The window instance
331  */
332 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
333
334 /**
335  * @brief Requests to display server for the window is resized by display server.
336  *
337  * This function should be called in mouse down event callback function.
338  * After this function is called in mouse down event callback function, the window is resized with mouse move event.
339  * The direction is selected one of eight ways.
340  * When mouse up event happens, the window resized work is finished.
341  *
342  * @param[in] window The window instance
343  * @param[in] direction it is indicated the window's side or edge for starting point.
344  */
345 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
346
347 /**
348  * @brief Enables the floating mode of window.
349  *
350  * The floating mode is to support making partial size window easliy.
351  * It is useful to make popup style window and this window is always upper than the other normal window.
352  * In addition, it is easy to change between popup style and normal style window.
353  *
354  * A special display server(as a Tizen display server) supports this mode.
355  *
356  * @param[in] window The window instance.
357  * @param[in] enable Enable floating mode or not.
358  */
359 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
360
361 /**
362  * @brief Includes input region.
363  *
364  * This function inlcudes input regions.
365  * It can be used multiple times and supports multiple regions.
366  * It means input region will be extended.
367  *
368  * This input is related to mouse and touch event.
369  * If device has touch screen, this function is useful.
370  * Otherwise device does not have that, we can use it after connecting mouse to the device.
371  *
372  * @param[in] window The window instance.
373  * @param[in] inputRegion The added region to accept input events.
374  */
375 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
376
377 /**
378  * @brief Excludes input region.
379  *
380  * This function excludes input regions.
381  * It can be used multiple times and supports multiple regions.
382  * It means input region will be reduced.
383  * Nofice, should be set input area by IncludeInputRegion() before this function is used.
384  *
385  * This input is related to mouse and touch event.
386  * If device has touch screen, this function is useful.
387  * Otherwise device does not have that, we can use it after connecting mouse to the device.
388  *
389  * @param[in] window The window instance.
390  * @param[in] inputRegion The subtracted region to except input events.
391  */
392 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
393
394 /**
395  * @brief Sets the necessary for window rotation Acknowledgement.
396  * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
397  *
398  * This function is supprot that application has the window rotation acknowledgement's control.
399  * It means display server waits when application's rotation work is finished.
400  * It is useful application has the other rendering engine which works asynchronous.
401  * For instance, GlView.
402  * It only works on Tizen device.
403  *
404  * @param[in] window The window instance.
405  * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
406  */
407 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
408
409 /**
410  * @brief send the Acknowledgement to complete window rotation.
411  * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
412  *
413  * @param[in] window The window instance.
414  */
415 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
416
417 /**
418  * @brief Feed (Send) touch event to window
419  * @param[in] window The window instance
420  * @param[in] point The touch point
421  * @param[in] timeStamp The time stamp
422  */
423 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
424
425 /**
426  * @brief Feed (Send) wheel event to window
427  * @param[in] window The window instance
428  * @param[in] wheelEvent The wheel event
429  */
430 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
431
432 /**
433  * @brief Feed (Send) key event to window
434  * @param[in] window The window instance
435  * @param[in] keyEvent The key event holding the key information.
436  */
437 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
438
439 /**
440  * @brief Maximizes window's size.
441  * If this function is called with true, window will be resized with screen size.
442  * Otherwise window will be resized with previous size.
443  * It is for the window's MAX button in window's border.
444  *
445  * It is for client application.
446  * If window border is supported by display server, it is not necessary.
447  *
448  * @param[in] window The window instance.
449  * @param[in] maximize If window is maximized or unmaximized.
450  */
451 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
452
453 /**
454  * @brief Returns whether the window is maximized or not.
455  *
456  * @param[in] window The window instance.
457  * @return True if the window is maximized, false otherwise.
458  */
459 DALI_ADAPTOR_API bool IsMaximized(Window window);
460
461 /**
462  * @brief Minimizes window's size.
463  * If this function is called with true, window will be iconified.
464  * Otherwise window will be activated.
465  * It is for the window's MIN button in window border.
466  *
467  * It is for client application.
468  * If window border is supported by display server, it is not necessary.
469  *
470  * @param[in] window The window instance.
471  * @param[in] minimize If window is minimized or unminimized(activated).
472  */
473 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
474
475 /**
476  * @brief Returns whether the window is minimized or not.
477  *
478  * @param[in] window The window instance.
479  * @return True if the window is minimized, false otherwise.
480  */
481 DALI_ADAPTOR_API bool IsMinimized(Window window);
482
483 } // namespace DevelWindow
484
485 } // namespace Dali
486
487 #endif // DALI_WINDOW_DEVEL_H