1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
5 * Copyright (c) 2021 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>
40 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
42 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
44 typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
46 typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
48 typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
50 typedef Signal<void(Window, WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
52 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
54 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType; ///< Auxiliary message signal type
56 typedef Signal<void(Window, bool)> AccessibilityHighlightSignalType; ///< Accessibility Highlight signal type
59 * @brief Creates an initialized handle to a new Window.
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
68 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
71 * @brief Creates an initialized handle to a new Window.
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
81 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
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.
86 * @param[in] window The window instance
87 * @param[in] positionSize The new window position and size
89 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
92 * @brief Retrieve the window that the given actor is added to.
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.
97 DALI_ADAPTOR_API Window Get(Actor actor);
100 * @brief This signal is emitted just after the event processing is finished.
102 * @param[in] window The window instance
103 * @return The signal to connect to
105 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
108 * @brief This signal is emitted when wheel event is received.
110 * A callback of the following type may be connected:
112 * void YourCallbackName(const WheelEvent& event);
114 * @param[in] window The window instance
115 * @return The signal to connect to
117 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
120 * @brief This signal is emitted when the window is shown or hidden.
122 * A callback of the following type may be connected:
124 * void YourCallbackName( Window window, bool visible );
126 * @param[in] window The window instance
127 * @return The signal to connect to
129 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
132 * @brief This signal is emitted for transition effect.
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:
139 * void YourCallbackName( Window window, EffectState state, EffectType type );
141 * @param[in] window The window instance
142 * @return The signal to connect to
144 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
147 * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
149 * @param[in] window The window instance
150 * @return The signal to connect to
152 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
155 * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
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.
162 * @param[in] window The window instance
163 * @return The signal to connect to
165 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
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.
173 * This signal is emitted by Dali::Accessibility::Component::GrabHighlight
174 * and Dali::Accessibility::Component::ClearHighlight
176 * A callback of the following type may be connected:
178 * void YourCallbackName( Window window, bool highlight );
181 * @param[in] window The window instance
182 * @return The signal to connect to
184 DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window);
187 * @brief Sets parent window of the window.
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.
193 * @param[in] window The window instance
194 * @param[in] parent The parent window instance
196 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
199 * @brief Sets parent window of the window.
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.
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.
208 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
211 * @brief Unsets parent window of the window.
213 * After unsetting, the window is disconnected his parent window.
215 * @param[in] window The window instance
217 DALI_ADAPTOR_API void Unparent(Window window);
220 * @brief Gets parent window of the window.
222 * @param[in] window The window instance
223 * @return The parent window of the window
225 DALI_ADAPTOR_API Window GetParent(Window window);
228 * @brief Downcast sceneHolder to window
230 * @param[in] handle The handle need to downcast
231 * @return The window cast from SceneHolder
233 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
236 * @brief Gets current orientation of the window.
238 * @param[in] window The window instance
239 * @return The current window orientation if previously set, or none
241 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
244 * @brief Gets current physical orientation of the window.
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.
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.
255 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
258 * @brief Sets available orientations of the window.
260 * This API is for setting several orientations one time.
262 * @param[in] window The window instance
263 * @param[in] orientations The available orientation list to add
265 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
268 * @brief Gets current window ID.
270 * @param[in] window The window instance
272 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
275 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
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.
281 * @note A callback of the following type may be used:
283 * void MyFunction( int frameId );
285 * This callback will be deleted once it is called.
287 * @note Ownership of the callback is passed onto this class.
289 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
292 * @brief Adds a callback that is called when the frame is displayed on the display.
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.
298 * @note A callback of the following type may be used:
300 * void MyFunction( int frameId );
302 * This callback will be deleted once it is called.
304 * @note Ownership of the callback is passed onto this class.
306 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
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.
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
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.
321 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
324 * @brief Requests to display server for the window is moved by display server.
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.
330 * @param[in] window The window instance
332 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
335 * @brief Requests to display server for the window is resized by display server.
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.
342 * @param[in] window The window instance
343 * @param[in] direction it is indicated the window's side or edge for starting point.
345 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
348 * @brief Enables the floating mode of window.
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.
354 * A special display server(as a Tizen display server) supports this mode.
356 * @param[in] window The window instance.
357 * @param[in] enable Enable floating mode or not.
359 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
362 * @brief Includes input region.
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.
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.
372 * @param[in] window The window instance.
373 * @param[in] inputRegion The added region to accept input events.
375 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
378 * @brief Excludes input region.
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.
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.
389 * @param[in] window The window instance.
390 * @param[in] inputRegion The subtracted region to except input events.
392 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
395 * @brief Sets the necessary for window rotation Acknowledgement.
396 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
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.
404 * @param[in] window The window instance.
405 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
407 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
410 * @brief send the Acknowledgement to complete window rotation.
411 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
413 * @param[in] window The window instance.
415 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
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
423 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
426 * @brief Feed (Send) wheel event to window
427 * @param[in] window The window instance
428 * @param[in] wheelEvent The wheel event
430 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
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.
437 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
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.
445 * It is for client application.
446 * If window border is supported by display server, it is not necessary.
448 * @param[in] window The window instance.
449 * @param[in] maximize If window is maximized or unmaximized.
451 DALI_ADAPTOR_API void Maximize(Window window, bool maximize);
454 * @brief Returns whether the window is maximized or not.
456 * @param[in] window The window instance.
457 * @return True if the window is maximized, false otherwise.
459 DALI_ADAPTOR_API bool IsMaximized(Window window);
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.
467 * It is for client application.
468 * If window border is supported by display server, it is not necessary.
470 * @param[in] window The window instance.
471 * @param[in] minimize If window is minimized or unminimized(activated).
473 DALI_ADAPTOR_API void Minimize(Window window, bool minimize);
476 * @brief Returns whether the window is minimized or not.
478 * @param[in] window The window instance.
479 * @return True if the window is minimized, false otherwise.
481 DALI_ADAPTOR_API bool IsMinimized(Window window);
484 * @brief Query whether window is rotating or not.
486 * @param[in] window The window instance.
487 * @return true if window is rotating, false otherwise.
489 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
491 } // namespace DevelWindow
495 #endif // DALI_WINDOW_DEVEL_H