1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
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
57 * @brief Creates an initialized handle to a new Window.
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
66 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
69 * @brief Creates an initialized handle to a new Window.
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
79 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
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.
84 * @param[in] window The window instance
85 * @param[in] positionSize The new window position and size
87 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
90 * @brief Retrieve the window that the given actor is added to.
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.
95 DALI_ADAPTOR_API Window Get(Actor actor);
98 * @brief This signal is emitted just after the event processing is finished.
100 * @param[in] window The window instance
101 * @return The signal to connect to
103 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
106 * @brief This signal is emitted when wheel event is received.
108 * A callback of the following type may be connected:
110 * void YourCallbackName(const WheelEvent& event);
112 * @param[in] window The window instance
113 * @return The signal to connect to
115 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
118 * @brief This signal is emitted when the window is shown or hidden.
120 * A callback of the following type may be connected:
122 * void YourCallbackName( Window window, bool visible );
124 * @param[in] window The window instance
125 * @return The signal to connect to
127 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
130 * @brief This signal is emitted for transition effect.
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:
137 * void YourCallbackName( Window window, EffectState state, EffectType type );
139 * @param[in] window The window instance
140 * @return The signal to connect to
142 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
145 * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
147 * @param[in] window The window instance
148 * @return The signal to connect to
150 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
153 * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
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.
160 * @param[in] window The window instance
161 * @return The signal to connect to
163 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
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.
171 * This signal is emitted by Dali::Accessibility::Component::GrabHighlight
172 * and Dali::Accessibility::Component::ClearHighlight
174 * A callback of the following type may be connected:
176 * void YourCallbackName( Window window, bool highlight );
179 * @param[in] window The window instance
180 * @return The signal to connect to
182 DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window);
185 * @brief Sets parent window of the window.
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.
191 * @param[in] window The window instance
192 * @param[in] parent The parent window instance
194 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
197 * @brief Sets parent window of the window.
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.
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.
206 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
209 * @brief Unsets parent window of the window.
211 * After unsetting, the window is disconnected his parent window.
213 * @param[in] window The window instance
215 DALI_ADAPTOR_API void Unparent(Window window);
218 * @brief Gets parent window of the window.
220 * @param[in] window The window instance
221 * @return The parent window of the window
223 DALI_ADAPTOR_API Window GetParent(Window window);
226 * @brief Gets current orientation of the window.
228 * @param[in] window The window instance
229 * @return The current window orientation if previously set, or none
231 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
234 * @brief Gets current physical orientation of the window.
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.
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.
245 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
248 * @brief Sets available orientations of the window.
250 * This API is for setting several orientations one time.
252 * @param[in] window The window instance
253 * @param[in] orientations The available orientation list to add
255 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
258 * @brief Gets current window ID.
260 * @param[in] window The window instance
262 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
265 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
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.
271 * @note A callback of the following type may be used:
273 * void MyFunction( int frameId );
275 * This callback will be deleted once it is called.
277 * @note Ownership of the callback is passed onto this class.
279 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
282 * @brief Adds a callback that is called when the frame is displayed on the display.
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.
288 * @note A callback of the following type may be used:
290 * void MyFunction( int frameId );
292 * This callback will be deleted once it is called.
294 * @note Ownership of the callback is passed onto this class.
296 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
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.
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
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.
311 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
314 * @brief Requests to display server for the window is moved by display server.
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.
320 * @param[in] window The window instance
322 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
325 * @brief Requests to display server for the window is resized by display server.
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.
332 * @param[in] window The window instance
333 * @param[in] direction it is indicated the window's side or edge for starting point.
335 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
338 * @brief Enables the floating mode of window.
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.
344 * A special display server(as a Tizen display server) supports this mode.
346 * @param[in] window The window instance.
347 * @param[in] enable Enable floating mode or not.
349 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
352 * @brief Returns whether the window is floating mode or not.
354 * @param[in] window The window instance.
355 * @return True if the window is enabled floating mode, false otherwise.
357 DALI_ADAPTOR_API bool IsFloatingModeEnabled(Window window);
360 * @brief Includes input region.
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.
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.
370 * @param[in] window The window instance.
371 * @param[in] inputRegion The added region to accept input events.
373 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
376 * @brief Excludes input region.
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.
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.
387 * @param[in] window The window instance.
388 * @param[in] inputRegion The subtracted region to except input events.
390 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
393 * @brief Sets the necessary for window rotation Acknowledgement.
394 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
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.
402 * @param[in] window The window instance.
403 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
405 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
408 * @brief send the Acknowledgement to complete window rotation.
409 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
411 * @param[in] window The window instance.
413 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
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
421 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
424 * @brief Feed (Send) wheel event to window
425 * @param[in] window The window instance
426 * @param[in] wheelEvent The wheel event
428 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
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.
435 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
438 * @brief Feed (Send) hover event to window
439 * @param[in] window The window instance
440 * @param[in] point The touch point that create a hover event
442 DALI_ADAPTOR_API void FeedHoverEvent(Window window, const Dali::TouchPoint& point);
445 * @brief Maximizes window's size.
446 * If this function is called with true, window will be resized with screen size.
447 * Otherwise window will be resized with previous size.
448 * It is for the window's MAX button in window's border.
450 * It is for client application.
451 * If window border is supported by display server, it is not necessary.
453 * @param[in] window The window instance.
454 * @param[in] maximize If window is maximized or unmaximized.
456 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
459 * @brief Returns whether the window is maximized or not.
461 * @param[in] window The window instance.
462 * @return True if the window is maximized, false otherwise.
464 DALI_ADAPTOR_API bool IsMaximized(Window window);
467 * @brief Sets window's maximum size.
469 * It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
470 * Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
472 * After setting, if Maximize() is called, window is resized with the setting size and move the center.
474 * @param[in] window The window instance.
475 * @param[in] size the maximum size
477 DALI_ADAPTOR_API void SetMaximumSize(Window window, Dali::Window::WindowSize size);
480 * @brief Minimizes window's size.
481 * If this function is called with true, window will be iconified.
482 * Otherwise window will be activated.
483 * It is for the window's MIN button in window border.
485 * It is for client application.
486 * If window border is supported by display server, it is not necessary.
488 * @param[in] window The window instance.
489 * @param[in] minimize If window is minimized or unminimized(activated).
491 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
494 * @brief Returns whether the window is minimized or not.
496 * @param[in] window The window instance.
497 * @return True if the window is minimized, false otherwise.
499 DALI_ADAPTOR_API bool IsMinimized(Window window);
502 * @brief Sets window's minimum size.
504 * It is to set the minimum size when window's size is decreased by RequestResizeToServer().
505 * Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
507 * @param[in] window The window instance.
508 * @param[in] size the minimum size
510 DALI_ADAPTOR_API void SetMimimumSize(Window window, Dali::Window::WindowSize size);
513 * @brief Query whether window is rotating or not.
515 * @param[in] window The window instance.
516 * @return true if window is rotating, false otherwise.
518 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
521 * @brief Gets the last key event the window gets.
523 * @param[in] window The window instance.
524 * @return The last key event the window gets.
526 DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
529 * @brief Gets the last touch event the window gets.
531 * @param[in] window The window instance.
532 * @return The last touch event the window gets.
533 * @note It returns the raw event the window gets. There is no hit-actor and local position information.
535 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
538 * @brief The user would connect to this signal to intercept a KeyEvent at window.
540 * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
541 * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
543 * @param[in] window The window instance.
544 * @return The signal to connect to
546 DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window);
549 * @brief This signal is emitted when the window is moved.
551 * A callback of the following type may be connected:
553 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
555 * The parameters are the moved x and y coordinates.
556 * and window means this signal was called from what window
558 * @param[in] window The window instance.
559 * @return The signal to connect to
561 DALI_ADAPTOR_API MovedSignalType& MovedSignal(Window window);
564 * @brief This signal is emitted when the window orientation is changed.
566 * To emit Window Orientation signal, AddAvailableOrientation() or SetPreferredOrientation() should be called before device is rotated.
567 * Most of cases, AddAvailableOrientation() or SetPreferredOrientation() is callled in onCreate().
569 * A callback of the following type may be connected:
571 * void YourCallbackName( Window window, Dali::WindowOrientation orientation );
573 * The parameter is the changed window orientation.
574 * and window means this signal was called from what window
576 * @param[in] window The window instance.
577 * @return The signal to connect to
579 DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
582 * @brief This signal is emitted when the mouse in or out event is received.
584 * A callback of the following type may be connected:
586 * void YourCallbackName( Window window, Dali::MouseInOutEvent event );
589 * @param[in] window The window instance.
590 * @return The signal to connect to
592 DALI_ADAPTOR_API MouseInOutEventSignalType& MouseInOutEventSignal(Window window);
595 * @brief This signal is emitted when window has been moved by the display server.
596 * To make the window move by display server, RequestMoveToServer() should be called.
597 * After the moving job is completed, this function will be called.
599 * A callback of the following type may be connected:
601 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
603 * The parameters are the moved x and y coordinates.
604 * and window means this signal was called from what window
606 * @param[in] window The window instance.
607 * @return The signal to connect to
609 DALI_ADAPTOR_API MoveCompletedSignalType& MoveCompletedSignal(Window window);
612 * @brief This signal is emitted when window has been resized by the display server.
613 * To make the window move by display server, RequestResizeToServer() should be called.
614 * After the resizing job is completed, this function will be called.
616 * A callback of the following type may be connected:
618 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
620 * The parameters are the resized width and height coordinates.
621 * and window means this signal was called from what window
623 * @param[in] window The window instance.
624 * @return The signal to connect to
626 DALI_ADAPTOR_API ResizeCompletedSignalType& ResizeCompletedSignal(Window window);
628 } // namespace DevelWindow
632 #endif // DALI_WINDOW_DEVEL_H