Merge "Add comment in the capture.h" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / window-devel.h
1 #ifndef DALI_WINDOW_DEVEL_H
2 #define DALI_WINDOW_DEVEL_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <memory>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/vector-wrapper.h>
26 #include <dali/public-api/adaptor-framework/window.h>
27
28 namespace Dali
29 {
30 class KeyEvent;
31 class TouchData;
32 class WheelEvent;
33 class RenderTaskList;
34
35 namespace DevelWindow
36 {
37 /**
38  * @brief Enumeration for transition effect's state.
39  */
40 enum class EffectState
41 {
42   NONE = 0,    ///< None state
43   START,       ///< Transition effect is started.
44   END          ///< Transition effect is ended.
45 };
46
47 /**
48  * @brief Enumeration for transition effect's type.
49  */
50 enum class  EffectType
51 {
52   NONE = 0,    ///< None type
53   SHOW,        ///< Window show effect.
54   HIDE,        ///< Window hide effect.
55 };
56
57 typedef Signal< void () > EventProcessingFinishedSignalType;       ///< Event Processing finished signal type
58
59 typedef Signal< void (const KeyEvent&) > KeyEventSignalType;       ///< Key event signal type
60
61 typedef Signal< void (const TouchData&) > TouchSignalType;         ///< Touch signal type
62
63 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;   ///< Touched signal type
64
65 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType; ///< Visibility changed signal type
66
67 typedef Signal< void (Window, EffectState, EffectType) > TransitionEffectEventSignalType; ///< Effect signal type and state
68
69 /**
70  * @brief Creates an initialized handle to a new Window.
71  *
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
78 */
79 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
80
81 /**
82  * @brief Creates an initialized handle to a new Window.
83  *
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
91  */
92 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
93
94 /**
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.
96  *
97  * @param[in] window The window instance
98  * @param[in] positionSize The new window position and size
99  */
100 DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize );
101
102 /**
103  * @brief Retrieves the list of render-tasks in the window.
104  *
105  * @param[in] window The window instance
106  * @return A valid handle to a RenderTaskList
107  */
108 DALI_ADAPTOR_API Dali::RenderTaskList GetRenderTaskList( Window window );
109
110 /**
111  * @brief Retrieve the window that the given actor is added to.
112  *
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.
115  */
116 DALI_ADAPTOR_API Window Get( Actor actor );
117
118 /**
119  * @brief This signal is emitted just after the event processing is finished.
120  *
121  * @param[in] window The window instance
122  * @return The signal to connect to
123  */
124 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
125
126 /**
127  * @brief This signal is emitted when key event is received.
128  *
129  * A callback of the following type may be connected:
130  * @code
131  *   void YourCallbackName(const KeyEvent& event);
132  * @endcode
133  * @param[in] window The window instance
134  * @return The signal to connect to
135  */
136 DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
137
138 /**
139  * @brief This signal is emitted when the screen is touched and when the touch ends
140  * (i.e. the down & up touch events only).
141  *
142  * If there are multiple touch points, then this will be emitted when the first touch occurs and
143  * then when the last finger is lifted.
144  * An interrupted event will also be emitted (if it occurs).
145  * A callback of the following type may be connected:
146  * @code
147  *   void YourCallbackName( TouchData event );
148  * @endcode
149  *
150  * @param[in] window The window instance
151  * @return The touch signal to connect to
152  * @note Motion events are not emitted.
153  */
154 DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
155
156 /**
157  * @brief This signal is emitted when wheel event is received.
158  *
159  * A callback of the following type may be connected:
160  * @code
161  *   void YourCallbackName(const WheelEvent& event);
162  * @endcode
163  * @param[in] window The window instance
164  * @return The signal to connect to
165  */
166 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
167
168 /**
169  * @brief This signal is emitted when the window is shown or hidden.
170  *
171  * A callback of the following type may be connected:
172  * @code
173  *   void YourCallbackName( Window window, bool visible );
174  * @endcode
175  * @param[in] window The window instance
176  * @return The signal to connect to
177  */
178 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
179
180 /**
181  * @brief This signal is emitted for transition effect.
182  *
183  * The transition animation is appeared when the window is shown/hidden.
184  * When the animation is started, START signal is emitted.
185  * Then the animation is ended, END signal is emitted, too.
186  * A callback of the following type may be connected:
187  * @code
188  *   void YourCallbackName( Window window, EffectState state, EffectType type );
189  * @endcode
190  * @param[in] window The window instance
191  * @return The signal to connect to
192  */
193 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window );
194
195 /**
196  * @brief Sets parent window of the window.
197  *
198  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
199  * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
200  * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
201  *
202  * @param[in] window The window instance
203  * @param[in] parent The parent window instance
204  */
205 DALI_ADAPTOR_API void SetParent( Window window, Window parent );
206
207 /**
208  * @brief Unsets parent window of the window.
209  *
210  * After unsetting, the window is disconnected his parent window.
211  *
212  * @param[in] window The window instance
213  */
214 DALI_ADAPTOR_API void Unparent( Window window );
215
216 /**
217  * @brief Gets parent window of the window.
218  *
219  * @param[in] window The window instance
220  * @return The parent window of the window
221  */
222 DALI_ADAPTOR_API Window GetParent( Window window );
223
224 /**
225  * @brief Downcast sceneHolder to window
226  *
227  * @param[in] handle The handle need to downcast
228  * @return The window cast from SceneHolder
229  */
230 DALI_ADAPTOR_API Window DownCast(  BaseHandle handle );
231
232 /**
233  * @brief Gets current orientation of the window.
234  *
235  * @param[in] window The window instance
236  * @return The current window orientation if previously set, or none
237  */
238 DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation( Window window );
239
240 /**
241  * @brief Sets available orientations of the window.
242  *
243  * This API is for setting several orientations one time.
244  *
245  * @param[in] window The window instance
246  * @param[in] orientations The available orientation list to add
247  */
248 DALI_ADAPTOR_API void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
249
250 /**
251  * @brief Gets current window ID.
252  *
253  * @param[in] window The window instance
254  */
255 DALI_ADAPTOR_API int32_t GetNativeId( Window window );
256
257 /**
258  * @brief Sets damaged areas of the window.
259  *
260  * This API is for setting static damaged areas of the window for partial update.
261  *
262  * @param[in] window The window instance
263  * @param[in] areas The damaged areas list to set
264  */
265 DALI_ADAPTOR_API void SetDamagedAreas(Window window, std::vector<Dali::Rect<int>>& areas);
266
267 /**
268  * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
269  *
270  * @param[in] window The window instance
271  * @param[in] callback The function to call
272  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
273  *
274  * @note A callback of the following type may be used:
275  * @code
276  *   void MyFunction( int frameId );
277  * @endcode
278  * This callback will be deleted once it is called.
279  *
280  * @note Ownership of the callback is passed onto this class.
281  */
282 DALI_ADAPTOR_API void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
283
284 /**
285  * @brief Adds a callback that is called when the frame is displayed on the display.
286  *
287  * @param[in] window The window instance
288  * @param[in] callback The function to call
289  * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
290  *
291  * @note A callback of the following type may be used:
292  * @code
293  *   void MyFunction( int frameId );
294  * @endcode
295  * This callback will be deleted once it is called.
296  *
297  * @note Ownership of the callback is passed onto this class.
298  */
299 DALI_ADAPTOR_API void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
300
301 } // namespace DevelWindow
302
303 } // namespace Dali
304
305 #endif // DALI_WINDOW_DEVEL_H