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 Includes input region.
354 * This function inlcudes input regions.
355 * It can be used multiple times and supports multiple regions.
356 * It means input region will be extended.
358 * This input is related to mouse and touch event.
359 * If device has touch screen, this function is useful.
360 * Otherwise device does not have that, we can use it after connecting mouse to the device.
362 * @param[in] window The window instance.
363 * @param[in] inputRegion The added region to accept input events.
365 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
368 * @brief Excludes input region.
370 * This function excludes input regions.
371 * It can be used multiple times and supports multiple regions.
372 * It means input region will be reduced.
373 * Nofice, should be set input area by IncludeInputRegion() before this function is used.
375 * This input is related to mouse and touch event.
376 * If device has touch screen, this function is useful.
377 * Otherwise device does not have that, we can use it after connecting mouse to the device.
379 * @param[in] window The window instance.
380 * @param[in] inputRegion The subtracted region to except input events.
382 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
385 * @brief Sets the necessary for window rotation Acknowledgement.
386 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
388 * This function is supprot that application has the window rotation acknowledgement's control.
389 * It means display server waits when application's rotation work is finished.
390 * It is useful application has the other rendering engine which works asynchronous.
391 * For instance, GlView.
392 * It only works on Tizen device.
394 * @param[in] window The window instance.
395 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
397 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
400 * @brief send the Acknowledgement to complete window rotation.
401 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
403 * @param[in] window The window instance.
405 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
408 * @brief Feed (Send) touch event to window
409 * @param[in] window The window instance
410 * @param[in] point The touch point
411 * @param[in] timeStamp The time stamp
413 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
416 * @brief Feed (Send) wheel event to window
417 * @param[in] window The window instance
418 * @param[in] wheelEvent The wheel event
420 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
423 * @brief Feed (Send) key event to window
424 * @param[in] window The window instance
425 * @param[in] keyEvent The key event holding the key information.
427 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
430 * @brief Maximizes window's size.
431 * If this function is called with true, window will be resized with screen size.
432 * Otherwise window will be resized with previous size.
433 * It is for the window's MAX button in window's border.
435 * It is for client application.
436 * If window border is supported by display server, it is not necessary.
438 * @param[in] window The window instance.
439 * @param[in] maximize If window is maximized or unmaximized.
441 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
444 * @brief Returns whether the window is maximized or not.
446 * @param[in] window The window instance.
447 * @return True if the window is maximized, false otherwise.
449 DALI_ADAPTOR_API bool IsMaximized(Window window);
452 * @brief Sets window's maximum size.
454 * It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
455 * Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
457 * After setting, if Maximize() is called, window is resized with the setting size and move the center.
459 * @param[in] window The window instance.
460 * @param[in] size the maximum size
462 DALI_ADAPTOR_API void SetMaximumSize(Window window, Dali::Window::WindowSize size);
465 * @brief Minimizes window's size.
466 * If this function is called with true, window will be iconified.
467 * Otherwise window will be activated.
468 * It is for the window's MIN button in window border.
470 * It is for client application.
471 * If window border is supported by display server, it is not necessary.
473 * @param[in] window The window instance.
474 * @param[in] minimize If window is minimized or unminimized(activated).
476 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
479 * @brief Returns whether the window is minimized or not.
481 * @param[in] window The window instance.
482 * @return True if the window is minimized, false otherwise.
484 DALI_ADAPTOR_API bool IsMinimized(Window window);
487 * @brief Sets window's minimum size.
489 * It is to set the minimum size when window's size is decreased by RequestResizeToServer().
490 * Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
492 * @param[in] window The window instance.
493 * @param[in] size the minimum size
495 DALI_ADAPTOR_API void SetMimimumSize(Window window, Dali::Window::WindowSize size);
498 * @brief Query whether window is rotating or not.
500 * @param[in] window The window instance.
501 * @return true if window is rotating, false otherwise.
503 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
506 * @brief Gets the last key event the window gets.
508 * @param[in] window The window instance.
509 * @return The last key event the window gets.
511 DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
514 * @brief Gets the last touch event the window gets.
516 * @param[in] window The window instance.
517 * @return The last touch event the window gets.
518 * @note It returns the raw event the window gets. There is no hit-actor and local position information.
520 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
523 * @brief The user would connect to this signal to intercept a KeyEvent at window.
525 * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
526 * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
528 * @param[in] window The window instance.
529 * @return The signal to connect to
531 DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window);
534 * @brief This signal is emitted when the window is moved.
536 * A callback of the following type may be connected:
538 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
540 * The parameters are the moved x and y coordinates.
541 * and window means this signal was called from what window
543 * @param[in] window The window instance.
544 * @return The signal to connect to
546 DALI_ADAPTOR_API MovedSignalType& MovedSignal(Window window);
549 * @brief This signal is emitted when the window orientation is changed.
551 * To emit Window Orientation signal, AddAvailableOrientation() or SetPreferredOrientation() should be called before device is rotated.
552 * Most of cases, AddAvailableOrientation() or SetPreferredOrientation() is callled in onCreate().
554 * A callback of the following type may be connected:
556 * void YourCallbackName( Window window, Dali::WindowOrientation orientation );
558 * The parameter is the changed window orientation.
559 * and window means this signal was called from what window
561 * @param[in] window The window instance.
562 * @return The signal to connect to
564 DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
567 * @brief This signal is emitted when the mouse in or out event is received.
569 * A callback of the following type may be connected:
571 * void YourCallbackName( Window window, Dali::MouseInOutEvent event );
574 * @param[in] window The window instance.
575 * @return The signal to connect to
577 DALI_ADAPTOR_API MouseInOutEventSignalType& MouseInOutEventSignal(Window window);
580 * @brief This signal is emitted when window has been moved by the display server.
581 * To make the window move by display server, RequestMoveToServer() should be called.
582 * After the moving job is completed, this function will be called.
584 * A callback of the following type may be connected:
586 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
588 * The parameters are the moved x and y coordinates.
589 * and window means this signal was called from what window
591 * @param[in] window The window instance.
592 * @return The signal to connect to
594 DALI_ADAPTOR_API MoveCompletedSignalType& MoveCompletedSignal(Window window);
597 * @brief This signal is emitted when window has been resized by the display server.
598 * To make the window move by display server, RequestResizeToServer() should be called.
599 * After the resizing job is completed, this function will be called.
601 * A callback of the following type may be connected:
603 * void YourCallbackName( Window window, Dali::Window::WindowPosition position );
605 * The parameters are the resized width and height coordinates.
606 * and window means this signal was called from what window
608 * @param[in] window The window instance.
609 * @return The signal to connect to
611 DALI_ADAPTOR_API ResizeCompletedSignalType& ResizeCompletedSignal(Window window);
613 } // namespace DevelWindow
617 #endif // DALI_WINDOW_DEVEL_H