1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
5 * Copyright (c) 2020 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/common/vector-wrapper.h>
26 #include <dali/public-api/adaptor-framework/window.h>
38 * @brief Enumeration for transition effect's state.
40 enum class EffectState
42 NONE = 0, ///< None state
43 START, ///< Transition effect is started.
44 END ///< Transition effect is ended.
48 * @brief Enumeration for transition effect's type.
52 NONE = 0, ///< None type
53 SHOW, ///< Window show effect.
54 HIDE, ///< Window hide effect.
57 typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
59 typedef Signal< void (const KeyEvent&) > KeyEventSignalType; ///< Key event signal type
61 typedef Signal< void (const TouchData&) > TouchSignalType; ///< Touch signal type
63 typedef Signal< void (const WheelEvent&) > WheelEventSignalType; ///< Touched signal type
65 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType; ///< Visibility changed signal type
67 typedef Signal< void (Window, EffectState, EffectType) > TransitionEffectEventSignalType; ///< Effect signal type and state
70 * @brief Creates an initialized handle to a new Window.
72 * @param[in] surface Can be a window or pixmap.
73 * @param[in] windowPosition The position and size of the Window
74 * @param[in] name The Window title
75 * @param[in] isTransparent Whether Window is transparent
76 * @return A new window
77 * @note This creates an extra window in addition to the default main window
79 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
82 * @brief Creates an initialized handle to a new Window.
84 * @param[in] surface Can be a window or pixmap.
85 * @param[in] windowPosition The position and size of the Window
86 * @param[in] name The Window title
87 * @param[in] className The Window class name
88 * @param[in] isTransparent Whether Window is transparent
89 * @note This creates an extra window in addition to the default main window
90 * @return A new Window
92 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
95 * @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.
97 * @param[in] window The window instance
98 * @param[in] positionSize The new window position and size
100 DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize );
103 * @brief Retrieves the list of render-tasks in the window.
105 * @param[in] window The window instance
106 * @return A valid handle to a RenderTaskList
108 DALI_ADAPTOR_API Dali::RenderTaskList GetRenderTaskList( Window window );
111 * @brief Retrieve the window that the given actor is added to.
113 * @param[in] actor The actor
114 * @return The window the actor is added to or an empty handle if the actor is not added to any window.
116 DALI_ADAPTOR_API Window Get( Actor actor );
119 * @brief This signal is emitted just after the event processing is finished.
121 * @param[in] window The window instance
122 * @return The signal to connect to
124 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
127 * @brief This signal is emitted when wheel event is received.
129 * A callback of the following type may be connected:
131 * void YourCallbackName(const WheelEvent& event);
133 * @param[in] window The window instance
134 * @return The signal to connect to
136 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
139 * @brief This signal is emitted when the window is shown or hidden.
141 * A callback of the following type may be connected:
143 * void YourCallbackName( Window window, bool visible );
145 * @param[in] window The window instance
146 * @return The signal to connect to
148 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
151 * @brief This signal is emitted for transition effect.
153 * The transition animation is appeared when the window is shown/hidden.
154 * When the animation is started, START signal is emitted.
155 * Then the animation is ended, END signal is emitted, too.
156 * A callback of the following type may be connected:
158 * void YourCallbackName( Window window, EffectState state, EffectType type );
160 * @param[in] window The window instance
161 * @return The signal to connect to
163 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal( 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 Unsets parent window of the window.
180 * After unsetting, the window is disconnected his parent window.
182 * @param[in] window The window instance
184 DALI_ADAPTOR_API void Unparent( Window window );
187 * @brief Gets parent window of the window.
189 * @param[in] window The window instance
190 * @return The parent window of the window
192 DALI_ADAPTOR_API Window GetParent( Window window );
195 * @brief Downcast sceneHolder to window
197 * @param[in] handle The handle need to downcast
198 * @return The window cast from SceneHolder
200 DALI_ADAPTOR_API Window DownCast( BaseHandle handle );
203 * @brief Gets current orientation of the window.
205 * @param[in] window The window instance
206 * @return The current window orientation if previously set, or none
208 DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation( Window window );
211 * @brief Sets available orientations of the window.
213 * This API is for setting several orientations one time.
215 * @param[in] window The window instance
216 * @param[in] orientations The available orientation list to add
218 DALI_ADAPTOR_API void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
221 * @brief Gets current window ID.
223 * @param[in] window The window instance
225 DALI_ADAPTOR_API int32_t GetNativeId( Window window );
228 * @brief Sets damaged areas of the window.
230 * This API is for setting static damaged areas of the window for partial update.
232 * @param[in] window The window instance
233 * @param[in] areas The damaged areas list to set
235 DALI_ADAPTOR_API void SetDamagedAreas(Window window, std::vector<Dali::Rect<int>>& areas);
238 * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
240 * @param[in] window The window instance
241 * @param[in] callback The function to call
242 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
244 * @note A callback of the following type may be used:
246 * void MyFunction( int frameId );
248 * This callback will be deleted once it is called.
250 * @note Ownership of the callback is passed onto this class.
252 DALI_ADAPTOR_API void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
255 * @brief Adds a callback that is called when the frame is displayed on the display.
257 * @param[in] window The window instance
258 * @param[in] callback The function to call
259 * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
261 * @note A callback of the following type may be used:
263 * void MyFunction( int frameId );
265 * This callback will be deleted once it is called.
267 * @note Ownership of the callback is passed onto this class.
269 DALI_ADAPTOR_API void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
271 } // namespace DevelWindow
275 #endif // DALI_WINDOW_DEVEL_H