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
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 Sets parent window of the window.
168 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
169 * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
170 * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
172 * @param[in] window The window instance
173 * @param[in] parent The parent window instance
175 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
178 * @brief Sets parent window of the window.
180 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
181 * This function has the additional flag whether the child is located above or below of the parent.
183 * @param[in] window The window instance
184 * @param[in] parent The parent window instance
185 * @param[in] belowParent The flag is whether the child is located above or below of the parent.
187 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
190 * @brief Unsets parent window of the window.
192 * After unsetting, the window is disconnected his parent window.
194 * @param[in] window The window instance
196 DALI_ADAPTOR_API void Unparent(Window window);
199 * @brief Gets parent window of the window.
201 * @param[in] window The window instance
202 * @return The parent window of the window
204 DALI_ADAPTOR_API Window GetParent(Window window);
207 * @brief Downcast sceneHolder to window
209 * @param[in] handle The handle need to downcast
210 * @return The window cast from SceneHolder
212 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
215 * @brief Gets current orientation of the window.
217 * @param[in] window The window instance
218 * @return The current window orientation if previously set, or none
220 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
223 * @brief Gets current physical orientation of the window.
225 * It means current physical rotation angle of the window.
226 * If the height of the display device's area is greater than the width,
227 * default current orientation is PORTRAIT and current physical orientation angle is 0.
228 * If the width of the display device's area is greater than the height,
229 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
231 * @param[in] window The window instance
232 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
234 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
237 * @brief Sets available orientations of the window.
239 * This API is for setting several orientations one time.
241 * @param[in] window The window instance
242 * @param[in] orientations The available orientation list to add
244 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
247 * @brief Gets current window ID.
249 * @param[in] window The window instance
251 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
254 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
256 * @param[in] window The window instance
257 * @param[in] callback The function to call
258 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
260 * @note A callback of the following type may be used:
262 * void MyFunction( int frameId );
264 * This callback will be deleted once it is called.
266 * @note Ownership of the callback is passed onto this class.
268 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
271 * @brief Adds a callback that is called when the frame is displayed on the display.
273 * @param[in] window The window instance
274 * @param[in] callback The function to call
275 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
277 * @note A callback of the following type may be used:
279 * void MyFunction( int frameId );
281 * This callback will be deleted once it is called.
283 * @note Ownership of the callback is passed onto this class.
285 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
288 * @brief Sets window position and size for specific orientation.
289 * This api reserves the position and size per orientation to display server.
290 * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
292 * @param[in] window The window instance
293 * @param[in] positionSize The reserved position and size for the orientation
294 * @param[in] orientation The orientation
296 * @note Currently, it only works when the window's type is WindowType::IME.
297 * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
298 * @note This function is only useful in Tizen world.
300 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
303 * @brief Requests to display server for the window is moved by display server.
305 * This function should be called in mouse down event callback function.
306 * After this function is called in mouse down event callback function, the window is moved with mouse move event.
307 * When mouse up event happens, the window moved work is finished.
309 * @param[in] window The window instance
311 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
314 * @brief Requests to display server for the window is resized 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 resized with mouse move event.
318 * The direction is selected one of eight ways.
319 * When mouse up event happens, the window resized work is finished.
321 * @param[in] window The window instance
322 * @param[in] direction it is indicated the window's side or edge for starting point.
324 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
327 * @brief Enables the floating mode of window.
329 * The floating mode is to support making partial size window easliy.
330 * It is useful to make popup style window and this window is always upper than the other normal window.
331 * In addition, it is easy to change between popup style and normal style window.
333 * A special display server(as a Tizen display server) supports this mode.
335 * @param[in] window The window instance.
336 * @param[in] enable Enable floating mode or not.
338 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
341 * @brief Includes input region.
343 * This function inlcudes input regions.
344 * It can be used multiple times and supports multiple regions.
345 * It means input region will be extended.
347 * This input is related to mouse and touch event.
348 * If device has touch screen, this function is useful.
349 * Otherwise device does not have that, we can use it after connecting mouse to the device.
351 * @param[in] window The window instance.
352 * @param[in] inputRegion The added region to accept input events.
354 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
357 * @brief Excludes input region.
359 * This function excludes input regions.
360 * It can be used multiple times and supports multiple regions.
361 * It means input region will be reduced.
362 * Nofice, should be set input area by IncludeInputRegion() before this function is used.
364 * This input is related to mouse and touch event.
365 * If device has touch screen, this function is useful.
366 * Otherwise device does not have that, we can use it after connecting mouse to the device.
368 * @param[in] window The window instance.
369 * @param[in] inputRegion The subtracted region to except input events.
371 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
374 * @brief Sets the necessary for window rotation Acknowledgement.
375 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
377 * This function is supprot that application has the window rotation acknowledgement's control.
378 * It means display server waits when application's rotation work is finished.
379 * It is useful application has the other rendering engine which works asynchronous.
380 * For instance, GlView.
381 * It only works on Tizen device.
383 * @param[in] window The window instance.
384 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
386 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
389 * @brief send the Acknowledgement to complete window rotation.
390 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
392 * @param[in] window The window instance.
394 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
397 * @brief Feed (Send) touch event to window
398 * @param[in] window The window instance
399 * @param[in] point The touch point
400 * @param[in] timeStamp The time stamp
402 DALI_ADAPTOR_API void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp);
405 * @brief Feed (Send) wheel event to window
406 * @param[in] window The window instance
407 * @param[in] wheelEvent The wheel event
409 DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent);
412 * @brief Feed (Send) key event to window
413 * @param[in] window The window instance
414 * @param[in] keyEvent The key event holding the key information.
416 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
418 } // namespace DevelWindow
422 #endif // DALI_WINDOW_DEVEL_H