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 Unsets parent window of the window.
163 * After unsetting, the window is disconnected his parent window.
165 * @param[in] window The window instance
167 DALI_ADAPTOR_API void Unparent(Window window);
170 * @brief Gets parent window of the window.
172 * @param[in] window The window instance
173 * @return The parent window of the window
175 DALI_ADAPTOR_API Window GetParent(Window window);
178 * @brief Downcast sceneHolder to window
180 * @param[in] handle The handle need to downcast
181 * @return The window cast from SceneHolder
183 DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
186 * @brief Gets current orientation of the window.
188 * @param[in] window The window instance
189 * @return The current window orientation if previously set, or none
191 DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window);
194 * @brief Gets current physical orientation of the window.
196 * It means current physical rotation angle of the window.
197 * If the height of the display device's area is greater than the width,
198 * default current orientation is PORTRAIT and current physical orientation angle is 0.
199 * If the width of the display device's area is greater than the height,
200 * default current orientation is LANDSCAPE and current physical orientation angle is 0.
202 * @param[in] window The window instance
203 * @return The current physical orientation degree of the window. It is one of them as 0, 90, 180 and 270.
205 DALI_ADAPTOR_API int GetPhysicalOrientation(Window window);
208 * @brief Sets available orientations of the window.
210 * This API is for setting several orientations one time.
212 * @param[in] window The window instance
213 * @param[in] orientations The available orientation list to add
215 DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations);
218 * @brief Gets current window ID.
220 * @param[in] window The window instance
222 DALI_ADAPTOR_API int32_t GetNativeId(Window window);
225 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
227 * @param[in] window The window instance
228 * @param[in] callback The function to call
229 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
231 * @note A callback of the following type may be used:
233 * void MyFunction( int frameId );
235 * This callback will be deleted once it is called.
237 * @note Ownership of the callback is passed onto this class.
239 DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
242 * @brief Adds a callback that is called when the frame is displayed on the display.
244 * @param[in] window The window instance
245 * @param[in] callback The function to call
246 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
248 * @note A callback of the following type may be used:
250 * void MyFunction( int frameId );
252 * This callback will be deleted once it is called.
254 * @note Ownership of the callback is passed onto this class.
256 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
258 } // namespace DevelWindow
262 #endif // DALI_WINDOW_DEVEL_H