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>
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
56 * @brief Creates an initialized handle to a new Window.
58 * @param[in] surface Can be a window or pixmap.
59 * @param[in] windowPosition The position and size of the Window
60 * @param[in] name The Window title
61 * @param[in] isTransparent Whether Window is transparent
62 * @return A new window
63 * @note This creates an extra window in addition to the default main window
65 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
68 * @brief Creates an initialized handle to a new Window.
70 * @param[in] surface Can be a window or pixmap.
71 * @param[in] windowPosition The position and size of the Window
72 * @param[in] name The Window title
73 * @param[in] className The Window class name
74 * @param[in] isTransparent Whether Window is transparent
75 * @note This creates an extra window in addition to the default main window
76 * @return A new Window
78 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
81 * @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.
83 * @param[in] window The window instance
84 * @param[in] positionSize The new window position and size
86 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
89 * @brief Retrieve the window that the given actor is added to.
91 * @param[in] actor The actor
92 * @return The window the actor is added to or an empty handle if the actor is not added to any window.
94 DALI_ADAPTOR_API Window Get(Actor actor);
97 * @brief This signal is emitted just after the event processing is finished.
99 * @param[in] window The window instance
100 * @return The signal to connect to
102 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
105 * @brief This signal is emitted when wheel event is received.
107 * A callback of the following type may be connected:
109 * void YourCallbackName(const WheelEvent& event);
111 * @param[in] window The window instance
112 * @return The signal to connect to
114 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
117 * @brief This signal is emitted when the window is shown or hidden.
119 * A callback of the following type may be connected:
121 * void YourCallbackName( Window window, bool visible );
123 * @param[in] window The window instance
124 * @return The signal to connect to
126 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
129 * @brief This signal is emitted for transition effect.
131 * The transition animation is appeared when the window is shown/hidden.
132 * When the animation is started, START signal is emitted.
133 * Then the animation is ended, END signal is emitted, too.
134 * A callback of the following type may be connected:
136 * void YourCallbackName( Window window, EffectState state, EffectType type );
138 * @param[in] window The window instance
139 * @return The signal to connect to
141 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
144 * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
146 * @param[in] window The window instance
147 * @return The signal to connect to
149 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
152 * @brief This signal is emitted when window's auxiliary was changed then display server sent the message.
154 * Auxiliary message is sent by display server.
155 * When client application added the window's auxiliary hint and if the auxiliary is changed,
156 * display server send the auxiliary message.
157 * Auxiliary message has the key, value and options.
159 * @param[in] window The window instance
160 * @return The signal to connect to
162 DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window);
165 * @brief Sets parent window of the window.
167 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
168 * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
169 * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
171 * @param[in] window The window instance
172 * @param[in] parent The parent window instance
174 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
177 * @brief Sets parent window of the window.
179 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
180 * This function has the additional flag whether the child is located above or below of the parent.
182 * @param[in] window The window instance
183 * @param[in] parent The parent window instance
184 * @param[in] belowParent The flag is whether the child is located above or below of the parent.
186 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
189 * @brief Unsets parent window of the window.
191 * After unsetting, the window is disconnected his parent window.
193 * @param[in] window The window instance
195 DALI_ADAPTOR_API void Unparent(Window window);
198 * @brief Gets parent window of the window.
200 * @param[in] window The window instance
201 * @return The parent window of the window
203 DALI_ADAPTOR_API Window GetParent(Window window);
206 * @brief Downcast sceneHolder to window
208 * @param[in] handle The handle need to downcast
209 * @return The window cast from SceneHolder
211 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
214 * @brief Gets current orientation of the window.
216 * @param[in] window The window instance
217 * @return The current window orientation if previously set, or none
219 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
222 * @brief Gets current physical orientation of the window.
224 * It means current physical rotation angle of the window.
225 * If the height of the display device's area is greater than the width,
226 * default current orientation is PORTRAIT and current physical orientation angle is 0.
227 * If the width of the display device's area is greater than the height,
228 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
230 * @param[in] window The window instance
231 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
233 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
236 * @brief Sets available orientations of the window.
238 * This API is for setting several orientations one time.
240 * @param[in] window The window instance
241 * @param[in] orientations The available orientation list to add
243 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
246 * @brief Gets current window ID.
248 * @param[in] window The window instance
250 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
253 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
255 * @param[in] window The window instance
256 * @param[in] callback The function to call
257 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
259 * @note A callback of the following type may be used:
261 * void MyFunction( int frameId );
263 * This callback will be deleted once it is called.
265 * @note Ownership of the callback is passed onto this class.
267 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
270 * @brief Adds a callback that is called when the frame is displayed on the display.
272 * @param[in] window The window instance
273 * @param[in] callback The function to call
274 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
276 * @note A callback of the following type may be used:
278 * void MyFunction( int frameId );
280 * This callback will be deleted once it is called.
282 * @note Ownership of the callback is passed onto this class.
284 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
287 * @brief Sets window position and size for specific orientation.
288 * This api reserves the position and size per orientation to display server.
289 * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
291 * @param[in] window The window instance
292 * @param[in] positionSize The reserved position and size for the orientation
293 * @param[in] orientation The orientation
295 * @note Currently, it only works when the window's type is WindowType::IME.
296 * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
297 * @note This function is only useful in Tizen world.
299 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
302 * @brief Requests to display server for the window is moved by display server.
304 * This function should be called in mouse down event callback function.
305 * After this function is called in mouse down event callback function, the window is moved with mouse move event.
306 * When mouse up event happens, the window moved work is finished.
308 * @param[in] window The window instance
310 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
313 * @brief Requests to display server for the window is resized by display server.
315 * This function should be called in mouse down event callback function.
316 * After this function is called in mouse down event callback function, the window is resized with mouse move event.
317 * The direction is selected one of eight ways.
318 * When mouse up event happens, the window resized work is finished.
320 * @param[in] window The window instance
321 * @param[in] direction it is indicated the window's side or edge for starting point.
323 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
326 * @brief Enables the floating mode of window.
328 * The floating mode is to support making partial size window easliy.
329 * It is useful to make popup style window and this window is always upper than the other normal window.
330 * In addition, it is easy to change between popup style and normal style window.
332 * A special display server(as a Tizen display server) supports this mode.
334 * @param[in] window The window instance.
335 * @param[in] enable Enable floating mode or not.
337 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
340 * @brief Includes input region.
342 * This function inlcudes input regions.
343 * It can be used multiple times and supports multiple regions.
344 * It means input region will be extended.
346 * This input is related to mouse and touch event.
347 * If device has touch screen, this function is useful.
348 * Otherwise device does not have that, we can use it after connecting mouse to the device.
350 * @param[in] window The window instance.
351 * @param[in] inputRegion The added region to accept input events.
353 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
356 * @brief Excludes input region.
358 * This function excludes input regions.
359 * It can be used multiple times and supports multiple regions.
360 * It means input region will be reduced.
361 * Nofice, should be set input area by IncludeInputRegion() before this function is used.
363 * This input is related to mouse and touch event.
364 * If device has touch screen, this function is useful.
365 * Otherwise device does not have that, we can use it after connecting mouse to the device.
367 * @param[in] window The window instance.
368 * @param[in] inputRegion The subtracted region to except input events.
370 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
373 * @brief Sets the necessary for window rotation Acknowledgement.
374 * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
376 * This function is supprot that application has the window rotation acknowledgement's control.
377 * It means display server waits when application's rotation work is finished.
378 * It is useful application has the other rendering engine which works asynchronous.
379 * For instance, GlView.
380 * It only works on Tizen device.
382 * @param[in] window The window instance.
383 * @param[in] needAcknowledgement the flag is true if window rotation acknowledge is sent.
385 DALI_ADAPTOR_API void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement);
388 * @brief send the Acknowledgement to complete window rotation.
389 * For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
391 * @param[in] window The window instance.
393 DALI_ADAPTOR_API void SendRotationCompletedAcknowledgement(Window window);
395 } // namespace DevelWindow
399 #endif // DALI_WINDOW_DEVEL_H