1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
5 * Copyright (c) 2022 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/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>
39 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
41 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
43 typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
45 typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
47 typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
49 typedef Signal<void(Window, WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
51 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
53 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType; ///< Auxiliary message signal type
55 typedef Signal<void(Window, bool)> AccessibilityHighlightSignalType; ///< Accessibility Highlight 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 Downcast sceneHolder to window
229 * @param[in] handle The handle need to downcast
230 * @return The window cast from SceneHolder
232 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
235 * @brief Gets current orientation of the window.
237 * @param[in] window The window instance
238 * @return The current window orientation if previously set, or none
240 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
243 * @brief Gets current physical orientation of the window.
245 * It means current physical rotation angle of the window.
246 * If the height of the display device's area is greater than the width,
247 * default current orientation is PORTRAIT and current physical orientation angle is 0.
248 * If the width of the display device's area is greater than the height,
249 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
251 * @param[in] window The window instance
252 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
254 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
257 * @brief Sets available orientations of the window.
259 * This API is for setting several orientations one time.
261 * @param[in] window The window instance
262 * @param[in] orientations The available orientation list to add
264 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
267 * @brief Gets current window ID.
269 * @param[in] window The window instance
271 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
274 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
276 * @param[in] window The window instance
277 * @param[in] callback The function to call
278 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
280 * @note A callback of the following type may be used:
282 * void MyFunction( int frameId );
284 * This callback will be deleted once it is called.
286 * @note Ownership of the callback is passed onto this class.
288 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
291 * @brief Adds a callback that is called when the frame is displayed on the display.
293 * @param[in] window The window instance
294 * @param[in] callback The function to call
295 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
297 * @note A callback of the following type may be used:
299 * void MyFunction( int frameId );
301 * This callback will be deleted once it is called.
303 * @note Ownership of the callback is passed onto this class.
305 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
308 * @brief Sets window position and size for specific orientation.
309 * This api reserves the position and size per orientation to display server.
310 * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
312 * @param[in] window The window instance
313 * @param[in] positionSize The reserved position and size for the orientation
314 * @param[in] orientation The orientation
316 * @note Currently, it only works when the window's type is WindowType::IME.
317 * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
318 * @note This function is only useful in Tizen world.
320 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
323 * @brief Requests to display server for the window is moved by display server.
325 * This function should be called in mouse down event callback function.
326 * After this function is called in mouse down event callback function, the window is moved with mouse move event.
327 * When mouse up event happens, the window moved work is finished.
329 * @param[in] window The window instance
331 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
334 * @brief Requests to display server for the window is resized by display server.
336 * This function should be called in mouse down event callback function.
337 * After this function is called in mouse down event callback function, the window is resized with mouse move event.
338 * The direction is selected one of eight ways.
339 * When mouse up event happens, the window resized work is finished.
341 * @param[in] window The window instance
342 * @param[in] direction it is indicated the window's side or edge for starting point.
344 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
347 * @brief Enables the floating mode of window.
349 * The floating mode is to support making partial size window easliy.
350 * It is useful to make popup style window and this window is always upper than the other normal window.
351 * In addition, it is easy to change between popup style and normal style window.
353 * A special display server(as a Tizen display server) supports this mode.
355 * @param[in] window The window instance.
356 * @param[in] enable Enable floating mode or not.
358 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
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 Minimizes window's size.
462 * If this function is called with true, window will be iconified.
463 * Otherwise window will be activated.
464 * It is for the window's MIN button in window border.
466 * It is for client application.
467 * If window border is supported by display server, it is not necessary.
469 * @param[in] window The window instance.
470 * @param[in] minimize If window is minimized or unminimized(activated).
472 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
475 * @brief Returns whether the window is minimized or not.
477 * @param[in] window The window instance.
478 * @return True if the window is minimized, false otherwise.
480 DALI_ADAPTOR_API bool IsMinimized(Window window);
483 * @brief Query whether window is rotating or not.
485 * @param[in] window The window instance.
486 * @return true if window is rotating, false otherwise.
488 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
491 * @brief Gets the last key event the window gets.
493 * @param[in] window The window instance.
494 * @return The last key event the window gets.
496 DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
499 * @brief Gets the last touch event the window gets.
501 * @param[in] window The window instance.
502 * @return The last touch event the window gets.
504 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
506 } // namespace DevelWindow
510 #endif // DALI_WINDOW_DEVEL_H