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>
38 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
40 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
42 typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
44 typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
46 typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
48 typedef Signal<void(Window, WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
50 typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
53 * @brief Creates an initialized handle to a new Window.
55 * @param[in] surface Can be a window or pixmap.
56 * @param[in] windowPosition The position and size of the Window
57 * @param[in] name The Window title
58 * @param[in] isTransparent Whether Window is transparent
59 * @return A new window
60 * @note This creates an extra window in addition to the default main window
62 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
65 * @brief Creates an initialized handle to a new Window.
67 * @param[in] surface Can be a window or pixmap.
68 * @param[in] windowPosition The position and size of the Window
69 * @param[in] name The Window title
70 * @param[in] className The Window class name
71 * @param[in] isTransparent Whether Window is transparent
72 * @note This creates an extra window in addition to the default main window
73 * @return A new Window
75 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
78 * @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.
80 * @param[in] window The window instance
81 * @param[in] positionSize The new window position and size
83 DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
86 * @brief Retrieve the window that the given actor is added to.
88 * @param[in] actor The actor
89 * @return The window the actor is added to or an empty handle if the actor is not added to any window.
91 DALI_ADAPTOR_API Window Get(Actor actor);
94 * @brief This signal is emitted just after the event processing is finished.
96 * @param[in] window The window instance
97 * @return The signal to connect to
99 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
102 * @brief This signal is emitted when wheel event is received.
104 * A callback of the following type may be connected:
106 * void YourCallbackName(const WheelEvent& event);
108 * @param[in] window The window instance
109 * @return The signal to connect to
111 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
114 * @brief This signal is emitted when the window is shown or hidden.
116 * A callback of the following type may be connected:
118 * void YourCallbackName( Window window, bool visible );
120 * @param[in] window The window instance
121 * @return The signal to connect to
123 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
126 * @brief This signal is emitted for transition effect.
128 * The transition animation is appeared when the window is shown/hidden.
129 * When the animation is started, START signal is emitted.
130 * Then the animation is ended, END signal is emitted, too.
131 * A callback of the following type may be connected:
133 * void YourCallbackName( Window window, EffectState state, EffectType type );
135 * @param[in] window The window instance
136 * @return The signal to connect to
138 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
141 * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
143 * @param[in] window The window instance
144 * @return The signal to connect to
146 DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
149 * @brief Sets parent window of the window.
151 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
152 * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
153 * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
155 * @param[in] window The window instance
156 * @param[in] parent The parent window instance
158 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
161 * @brief Sets parent window of the window.
163 * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
164 * This function has the additional flag whether the child is located above or below of the parent.
166 * @param[in] window The window instance
167 * @param[in] parent The parent window instance
168 * @param[in] belowParent The flag is whether the child is located above or below of the parent.
170 DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
173 * @brief Unsets parent window of the window.
175 * After unsetting, the window is disconnected his parent window.
177 * @param[in] window The window instance
179 DALI_ADAPTOR_API void Unparent(Window window);
182 * @brief Gets parent window of the window.
184 * @param[in] window The window instance
185 * @return The parent window of the window
187 DALI_ADAPTOR_API Window GetParent(Window window);
190 * @brief Downcast sceneHolder to window
192 * @param[in] handle The handle need to downcast
193 * @return The window cast from SceneHolder
195 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
198 * @brief Gets current orientation of the window.
200 * @param[in] window The window instance
201 * @return The current window orientation if previously set, or none
203 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
206 * @brief Gets current physical orientation of the window.
208 * It means current physical rotation angle of the window.
209 * If the height of the display device's area is greater than the width,
210 * default current orientation is PORTRAIT and current physical orientation angle is 0.
211 * If the width of the display device's area is greater than the height,
212 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
214 * @param[in] window The window instance
215 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
217 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
220 * @brief Sets available orientations of the window.
222 * This API is for setting several orientations one time.
224 * @param[in] window The window instance
225 * @param[in] orientations The available orientation list to add
227 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
230 * @brief Gets current window ID.
232 * @param[in] window The window instance
234 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
237 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
239 * @param[in] window The window instance
240 * @param[in] callback The function to call
241 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
243 * @note A callback of the following type may be used:
245 * void MyFunction( int frameId );
247 * This callback will be deleted once it is called.
249 * @note Ownership of the callback is passed onto this class.
251 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
254 * @brief Adds a callback that is called when the frame is displayed on the display.
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 AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
271 * @brief Sets window position and size for specific orientation.
272 * This api reserves the position and size per orientation to display server.
273 * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
275 * @param[in] window The window instance
276 * @param[in] positionSize The reserved position and size for the orientation
277 * @param[in] orientation The orientation
279 * @note Currently, it only works when the window's type is WindowType::IME.
280 * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
281 * @note This function is only useful in Tizen world.
283 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
286 * @brief Requests to display server for the window is moved by display server.
288 * This function should be called in mouse down event callback function.
289 * After this function is called in mouse down event callback function, the window is moved with mouse move event.
290 * When mouse up event happens, the window moved work is finished.
292 * @param[in] window The window instance
294 DALI_ADAPTOR_API void RequestMoveToServer(Window window);
297 * @brief Requests to display server for the window is resized by display server.
299 * This function should be called in mouse down event callback function.
300 * After this function is called in mouse down event callback function, the window is resized with mouse move event.
301 * The direction is selected one of eight ways.
302 * When mouse up event happens, the window resized work is finished.
304 * @param[in] window The window instance
305 * @param[in] direction it is indicated the window's side or edge for starting point.
307 DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
310 * @brief Enables the floating mode of window.
312 * The floating mode is to support making partial size window easliy.
313 * It is useful to make popup style window and this window is always upper than the other normal window.
314 * In addition, it is easy to change between popup style and normal style window.
316 * A special display server(as a Tizen display server) supports this mode.
318 * @param[in] window The window instance.
319 * @param[in] enable Enable floating mode or not.
321 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
324 * @brief Includes input region.
326 * This function inlcudes input regions.
327 * It can be used multiple times and supports multiple regions.
328 * It means input region will be extended.
330 * This input is related to mouse and touch event.
331 * If device has touch screen, this function is useful.
332 * Otherwise device does not have that, we can use it after connecting mouse to the device.
334 * @param[in] window The window instance.
335 * @param[in] inputRegion The added region to accept input events.
337 DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
340 * @brief Excludes input region.
342 * This function excludes input regions.
343 * It can be used multiple times and supports multiple regions.
344 * It means input region will be reduced.
345 * Nofice, should be set input area by IncludeInputRegion() before this function is used.
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 subtracted region to except input events.
354 DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
356 } // namespace DevelWindow
360 #endif // DALI_WINDOW_DEVEL_H