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
55 typedef Signal<void(WindowInsetsPartType, WindowInsetsPartState, const Extents&)> InsetsChangedSignalType; ///< InsetsChanged signal type
58 * @brief Creates an initialized handle to a new Window.
60 * @param[in] surface Can be a window or pixmap.
61 * @param[in] windowPosition The position and size of the Window
62 * @param[in] name The Window title
63 * @param[in] isTransparent Whether Window is transparent
64 * @return A new window
65 * @note This creates an extra window in addition to the default main window
67 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
70 * @brief Creates an initialized handle to a new Window.
72 * @param[in] surface Can be a window or pixmap.
73 * @param[in] windowPosition The position and size of the Window
74 * @param[in] name The Window title
75 * @param[in] className The Window class name
76 * @param[in] isTransparent Whether Window is transparent
77 * @note This creates an extra window in addition to the default main window
78 * @return A new Window
80 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
83 * @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 * @param[in] window The window instance
86 * @param[in] positionSize The new window position and size
88 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
91 * @brief Retrieve the window that the given actor is added to.
93 * @param[in] actor The actor
94 * @return The window the actor is added to or an empty handle if the actor is not added to any window.
96 DALI_ADAPTOR_API Window Get(Actor actor);
99 * @brief This signal is emitted just after the event processing is finished.
101 * @param[in] window The window instance
102 * @return The signal to connect to
104 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
107 * @brief This signal is emitted when wheel event is received.
109 * A callback of the following type may be connected:
111 * void YourCallbackName(const WheelEvent& event);
113 * @param[in] window The window instance
114 * @return The signal to connect to
116 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
119 * @brief This signal is emitted when the window is shown or hidden.
121 * A callback of the following type may be connected:
123 * void YourCallbackName( Window window, bool visible );
125 * @param[in] window The window instance
126 * @return The signal to connect to
128 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
131 * @brief This signal is emitted for transition effect.
133 * The transition animation is appeared when the window is shown/hidden.
134 * When the animation is started, START signal is emitted.
135 * Then the animation is ended, END signal is emitted, too.
136 * A callback of the following type may be connected:
138 * void YourCallbackName( Window window, EffectState state, EffectType type );
140 * @param[in] window The window instance
141 * @return The signal to connect to
143 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
146 * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
148 * @param[in] window The window instance
149 * @return The signal to connect to
151 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
154 * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
156 * Auxiliary message is sent by display server.
157 * When client application added the window's auxiliary hint and if the auxiliary is changed,
158 * display server send the auxiliary message.
159 * Auxiliary message has the key, value and options.
161 * @param[in] window The window instance
162 * @return The signal to connect to
164 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
167 * @brief This signal is emitted when the window needs to grab or clear accessibility highlight.
168 * The highlight indicates that it is an object to interact with the user regardless of focus.
169 * After setting the highlight on the object, you can do things that the object can do, such as
170 * giving or losing focus.
172 * This signal is emitted by Dali::Accessibility::Component::GrabHighlight
173 * and Dali::Accessibility::Component::ClearHighlight
175 * A callback of the following type may be connected:
177 * void YourCallbackName( Window window, bool highlight );
180 * @param[in] window The window instance
181 * @return The signal to connect to
183 DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window);
186 * @brief Sets parent window of the window.
188 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
189 * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
190 * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
192 * @param[in] window The window instance
193 * @param[in] parent The parent window instance
195 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
198 * @brief Sets parent window of the window.
200 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
201 * This function has the additional flag whether the child is located above or below of the parent.
203 * @param[in] window The window instance
204 * @param[in] parent The parent window instance
205 * @param[in] belowParent The flag is whether the child is located above or below of the parent.
207 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
210 * @brief Unsets parent window of the window.
212 * After unsetting, the window is disconnected his parent window.
214 * @param[in] window The window instance
216 DALI_ADAPTOR_API void Unparent(Window window);
219 * @brief Gets parent window of the window.
221 * @param[in] window The window instance
222 * @return The parent window of the window
224 DALI_ADAPTOR_API Window GetParent(Window window);
227 * @brief Gets current orientation of the window.
229 * @param[in] window The window instance
230 * @return The current window orientation if previously set, or none
232 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
235 * @brief Gets current physical orientation of the window.
237 * It means current physical rotation angle of the window.
238 * If the height of the display device's area is greater than the width,
239 * default current orientation is PORTRAIT and current physical orientation angle is 0.
240 * If the width of the display device's area is greater than the height,
241 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
243 * @param[in] window The window instance
244 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
246 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
249 * @brief Sets available orientations of the window.
251 * This API is for setting several orientations one time.
253 * @param[in] window The window instance
254 * @param[in] orientations The available orientation list to add
256 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
259 * @brief Gets current window ID.
261 * @param[in] window The window instance
263 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
266 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
268 * @param[in] window The window instance
269 * @param[in] callback The function to call
270 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
272 * @note A callback of the following type may be used:
274 * void MyFunction( int frameId );
276 * This callback will be deleted once it is called.
278 * @note Ownership of the callback is passed onto this class.
280 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
283 * @brief Adds a callback that is called when the frame is displayed on the display.
285 * @param[in] window The window instance
286 * @param[in] callback The function to call
287 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
289 * @note A callback of the following type may be used:
291 * void MyFunction( int frameId );
293 * This callback will be deleted once it is called.
295 * @note Ownership of the callback is passed onto this class.
297 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
300 * @brief Sets window position and size for specific orientation.
301 * This api reserves the position and size per orientation to display server.
302 * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
304 * @param[in] window The window instance
305 * @param[in] positionSize The reserved position and size for the orientation
306 * @param[in] orientation The orientation
308 * @note Currently, it only works when the window's type is WindowType::IME.
309 * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
310 * @note This function is only useful in Tizen world.
312 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
315 * @brief Requests to display server for the window is moved by display server.
317 * This function should be called in mouse down event callback function.
318 * After this function is called in mouse down event callback function, the window is moved with mouse move event.
319 * When mouse up event happens, the window moved work is finished.
321 * @param[in] window The window instance
323 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
326 * @brief Requests to display server for the window is resized by display server.
328 * This function should be called in mouse down event callback function.
329 * After this function is called in mouse down event callback function, the window is resized with mouse move event.
330 * The direction is selected one of eight ways.
331 * When mouse up event happens, the window resized work is finished.
333 * @param[in] window The window instance
334 * @param[in] direction it is indicated the window's side or edge for starting point.
336 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
339 * @brief Enables the floating mode of window.
341 * The floating mode is to support making partial size window easliy.
342 * It is useful to make popup style window and this window is always upper than the other normal window.
343 * In addition, it is easy to change between popup style and normal style window.
345 * A special display server(as a Tizen display server) supports this mode.
347 * @param[in] window The window instance.
348 * @param[in] enable Enable floating mode or not.
350 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
353 * @brief Returns whether the window is floating mode or not.
355 * @param[in] window The window instance.
356 * @return True if the window is enabled floating mode, false otherwise.
358 DALI_ADAPTOR_API bool IsFloatingModeEnabled(Window window);
361 * @brief Includes input region.
363 * This function inlcudes input regions.
364 * It can be used multiple times and supports multiple regions.
365 * It means input region will be extended.
367 * This input is related to mouse and touch event.
368 * If device has touch screen, this function is useful.
369 * Otherwise device does not have that, we can use it after connecting mouse to the device.
371 * @param[in] window The window instance.
372 * @param[in] inputRegion The added region to accept input events.
374 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
377 * @brief Excludes input region.
379 * This function excludes input regions.
380 * It can be used multiple times and supports multiple regions.
381 * It means input region will be reduced.
382 * Nofice, should be set input area by IncludeInputRegion() before this function is used.
384 * This input is related to mouse and touch event.
385 * If device has touch screen, this function is useful.
386 * Otherwise device does not have that, we can use it after connecting mouse to the device.
388 * @param[in] window The window instance.
389 * @param[in] inputRegion The subtracted region to except input events.
391 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
394 * @brief Sets the necessary for window rotation Acknowledgement.
395 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
397 * This function is supprot that application has the window rotation acknowledgement's control.
398 * It means display server waits when application's rotation work is finished.
399 * It is useful application has the other rendering engine which works asynchronous.
400 * For instance, GlView.
401 * It only works on Tizen device.
403 * @param[in] window The window instance.
404 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
406 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
409 * @brief send the Acknowledgement to complete window rotation.
410 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
412 * @param[in] window The window instance.
414 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
417 * @brief Feed (Send) touch event to window
418 * @param[in] window The window instance
419 * @param[in] point The touch point
420 * @param[in] timeStamp The time stamp
422 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
425 * @brief Feed (Send) wheel event to window
426 * @param[in] window The window instance
427 * @param[in] wheelEvent The wheel event
429 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
432 * @brief Feed (Send) key event to window
433 * @param[in] window The window instance
434 * @param[in] keyEvent The key event holding the key information.
436 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
439 * @brief Maximizes window's size.
440 * If this function is called with true, window will be resized with screen size.
441 * Otherwise window will be resized with previous size.
442 * It is for the window's MAX button in window's border.
444 * It is for client application.
445 * If window border is supported by display server, it is not necessary.
447 * @param[in] window The window instance.
448 * @param[in] maximize If window is maximized or unmaximized.
450 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
453 * @brief Returns whether the window is maximized or not.
455 * @param[in] window The window instance.
456 * @return True if the window is maximized, false otherwise.
458 DALI_ADAPTOR_API bool IsMaximized(Window window);
461 * @brief Sets window's maximum size.
463 * It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
464 * Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
466 * After setting, if Maximize() is called, window is resized with the setting size and move the center.
468 * @param[in] window The window instance.
469 * @param[in] size the maximum size
471 DALI_ADAPTOR_API void SetMaximumSize(Window window, Dali::Window::WindowSize size);
474 * @brief Minimizes window's size.
475 * If this function is called with true, window will be iconified.
476 * Otherwise window will be activated.
477 * It is for the window's MIN button in window border.
479 * It is for client application.
480 * If window border is supported by display server, it is not necessary.
482 * @param[in] window The window instance.
483 * @param[in] minimize If window is minimized or unminimized(activated).
485 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
488 * @brief Returns whether the window is minimized or not.
490 * @param[in] window The window instance.
491 * @return True if the window is minimized, false otherwise.
493 DALI_ADAPTOR_API bool IsMinimized(Window window);
496 * @brief Sets window's minimum size.
498 * It is to set the minimum size when window's size is decreased by RequestResizeToServer().
499 * Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
501 * @param[in] window The window instance.
502 * @param[in] size the minimum size
504 DALI_ADAPTOR_API void SetMimimumSize(Window window, Dali::Window::WindowSize size);
507 * @brief Query whether window is rotating or not.
509 * @param[in] window The window instance.
510 * @return true if window is rotating, false otherwise.
512 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
515 * @brief Gets the last key event the window gets.
517 * @param[in] window The window instance.
518 * @return The last key event the window gets.
520 DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
523 * @brief Gets the last touch event the window gets.
525 * @param[in] window The window instance.
526 * @return The last touch event the window gets.
527 * @note It returns the raw event the window gets. There is no hit-actor and local position information.
529 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
532 * @brief The user would connect to this signal to intercept a KeyEvent at window.
534 * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
535 * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
537 * @param[in] window The window instance.
538 * @return The signal to connect to
540 DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window);
543 * @brief This signal is emitted when the window is moved.
545 * A callback of the following type may be connected:
547 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
549 * The parameters are the moved x and y coordinates.
550 * and window means this signal was called from what window
552 * @param[in] window The window instance.
553 * @return The signal to connect to
555 DALI_ADAPTOR_API MovedSignalType& MovedSignal(Window window);
558 * @brief This signal is emitted when the window orientation is changed.
560 * To emit Window Orientation signal, AddAvailableOrientation() or SetPreferredOrientation() should be called before device is rotated.
561 * Most of cases, AddAvailableOrientation() or SetPreferredOrientation() is callled in onCreate().
563 * A callback of the following type may be connected:
565 * void YourCallbackName( Window window, Dali::WindowOrientation orientation );
567 * The parameter is the changed window orientation.
568 * and window means this signal was called from what window
570 * @param[in] window The window instance.
571 * @return The signal to connect to
573 DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
576 * @brief This signal is emitted when the mouse in or out event is received.
578 * A callback of the following type may be connected:
580 * void YourCallbackName( Window window, Dali::MouseInOutEvent event );
583 * @param[in] window The window instance.
584 * @return The signal to connect to
586 DALI_ADAPTOR_API MouseInOutEventSignalType& MouseInOutEventSignal(Window window);
589 * @brief This signal is emitted when window has been moved by the display server.
590 * To make the window move by display server, RequestMoveToServer() should be called.
591 * After the moving job is completed, this function will be called.
593 * A callback of the following type may be connected:
595 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
597 * The parameters are the moved x and y coordinates.
598 * and window means this signal was called from what window
600 * @param[in] window The window instance.
601 * @return The signal to connect to
603 DALI_ADAPTOR_API MoveCompletedSignalType& MoveCompletedSignal(Window window);
606 * @brief This signal is emitted when window has been resized by the display server.
607 * To make the window move by display server, RequestResizeToServer() should be called.
608 * After the resizing job is completed, this function will be called.
610 * A callback of the following type may be connected:
612 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
614 * The parameters are the resized width and height coordinates.
615 * and window means this signal was called from what window
617 * @param[in] window The window instance.
618 * @return The signal to connect to
620 DALI_ADAPTOR_API ResizeCompletedSignalType& ResizeCompletedSignal(Window window);
623 * @brief This signal is emitted when window insets are changed by appearing or disappearing indicator, virtual keyboard, or clipboard.
625 * @param[in] window The window instance
626 * @return The signal to connect to
628 DALI_ADAPTOR_API InsetsChangedSignalType& InsetsChangedSignal(Window window);
630 } // namespace DevelWindow
634 #endif // DALI_WINDOW_DEVEL_H