Partial update implementation, first phase.
[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
23 // INTERNAL INCLUDES
24 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali/public-api/adaptor-framework/window.h>
26
27 namespace Dali
28 {
29 class KeyEvent;
30 class TouchData;
31 class WheelEvent;
32 class RenderTaskList;
33
34 namespace DevelWindow
35 {
36 /**
37  * @brief Enumeration for transition effect's state.
38  */
39 enum class EffectState
40 {
41   NONE = 0,    ///< None state
42   START,       ///< Transition effect is started.
43   END          ///< Transition effect is ended.
44 };
45
46 /**
47  * @brief Enumeration for transition effect's type.
48  */
49 enum class  EffectType
50 {
51   NONE = 0,    ///< None type
52   SHOW,        ///< Window show effect.
53   HIDE,        ///< Window hide effect.
54 };
55
56 typedef Signal< void () > EventProcessingFinishedSignalType;       ///< Event Processing finished signal type
57
58 typedef Signal< void (const KeyEvent&) > KeyEventSignalType;       ///< Key event signal type
59
60 typedef Signal< void (const TouchData&) > TouchSignalType;         ///< Touch signal type
61
62 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;   ///< Touched signal type
63
64 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType; ///< Visibility changed signal type
65
66 typedef Signal< void (Window, EffectState, EffectType) > TransitionEffectEventSignalType; ///< Effect signal type and state
67
68 /**
69  * @brief Creates an initialized handle to a new Window.
70  *
71  * @param[in] surface Can be a window or pixmap.
72  * @param[in] windowPosition The position and size of the Window
73  * @param[in] name The Window title
74  * @param[in] isTransparent Whether Window is transparent
75  * @return A new window
76  * @note This creates an extra window in addition to the default main window
77 */
78 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
79
80 /**
81  * @brief Creates an initialized handle to a new Window.
82  *
83  * @param[in] surface Can be a window or pixmap.
84  * @param[in] windowPosition The position and size of the Window
85  * @param[in] name The Window title
86  * @param[in] className The Window class name
87  * @param[in] isTransparent Whether Window is transparent
88  * @note This creates an extra window in addition to the default main window
89  * @return A new Window
90  */
91 DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
92
93 /**
94  * @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.
95  *
96  * @param[in] window The window instance
97  * @param[in] positionSize The new window position and size
98  */
99 DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize );
100
101 /**
102  * @brief Retrieves the list of render-tasks in the window.
103  *
104  * @param[in] window The window instance
105  * @return A valid handle to a RenderTaskList
106  */
107 DALI_ADAPTOR_API Dali::RenderTaskList GetRenderTaskList( Window window );
108
109 /**
110  * @brief Retrieve the window that the given actor is added to.
111  *
112  * @param[in] actor The actor
113  * @return The window the actor is added to or an empty handle if the actor is not added to any window.
114  */
115 DALI_ADAPTOR_API Window Get( Actor actor );
116
117 /**
118  * @brief This signal is emitted just after the event processing is finished.
119  *
120  * @param[in] window The window instance
121  * @return The signal to connect to
122  */
123 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
124
125 /**
126  * @brief This signal is emitted when key event is received.
127  *
128  * A callback of the following type may be connected:
129  * @code
130  *   void YourCallbackName(const KeyEvent& event);
131  * @endcode
132  * @param[in] window The window instance
133  * @return The signal to connect to
134  */
135 DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
136
137 /**
138  * @brief This signal is emitted when the screen is touched and when the touch ends
139  * (i.e. the down & up touch events only).
140  *
141  * If there are multiple touch points, then this will be emitted when the first touch occurs and
142  * then when the last finger is lifted.
143  * An interrupted event will also be emitted (if it occurs).
144  * A callback of the following type may be connected:
145  * @code
146  *   void YourCallbackName( TouchData event );
147  * @endcode
148  *
149  * @param[in] window The window instance
150  * @return The touch signal to connect to
151  * @note Motion events are not emitted.
152  */
153 DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
154
155 /**
156  * @brief This signal is emitted when wheel event is received.
157  *
158  * A callback of the following type may be connected:
159  * @code
160  *   void YourCallbackName(const WheelEvent& event);
161  * @endcode
162  * @param[in] window The window instance
163  * @return The signal to connect to
164  */
165 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
166
167 /**
168  * @brief This signal is emitted when the window is shown or hidden.
169  *
170  * A callback of the following type may be connected:
171  * @code
172  *   void YourCallbackName( Window window, bool visible );
173  * @endcode
174  * @param[in] window The window instance
175  * @return The signal to connect to
176  */
177 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
178
179 /**
180  * @brief This signal is emitted for transition effect.
181  *
182  * The transition animation is appeared when the window is shown/hidden.
183  * When the animation is started, START signal is emitted.
184  * Then the animation is ended, END signal is emitted, too.
185  * A callback of the following type may be connected:
186  * @code
187  *   void YourCallbackName( Window window, EffectState state, EffectType type );
188  * @endcode
189  * @param[in] window The window instance
190  * @return The signal to connect to
191  */
192 DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window );
193
194 /**
195  * @brief Sets parent window of the window.
196  *
197  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
198  * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
199  * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
200  *
201  * @param[in] window The window instance
202  * @param[in] parent The parent window instance
203  */
204 DALI_ADAPTOR_API void SetParent( Window window, Window parent );
205
206 /**
207  * @brief Unsets parent window of the window.
208  *
209  * After unsetting, the window is disconnected his parent window.
210  *
211  * @param[in] window The window instance
212  */
213 DALI_ADAPTOR_API void Unparent( Window window );
214
215 /**
216  * @brief Gets parent window of the window.
217  *
218  * @param[in] window The window instance
219  * @return The parent window of the window
220  */
221 DALI_ADAPTOR_API Window GetParent( Window window );
222
223 /**
224  * @brief Downcast sceneHolder to window
225  *
226  * @param[in] handle The handle need to downcast
227  * @return The window cast from SceneHolder
228  */
229 DALI_ADAPTOR_API Window DownCast(  BaseHandle handle );
230
231 /**
232  * @brief Gets current orientation of the window.
233  *
234  * @param[in] window The window instance
235  * @return The current window orientation if previously set, or none
236  */
237 DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation( Window window );
238
239 /**
240  * @brief Sets available orientations of the window.
241  *
242  * This API is for setting several orientations one time.
243  *
244  * @param[in] window The window instance
245  * @param[in] orientations The available orientation list to add
246  */
247 DALI_ADAPTOR_API void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
248
249 /**
250  * @brief Gets current window ID.
251  *
252  * @param[in] window The window instance
253  */
254 DALI_ADAPTOR_API int32_t GetNativeId( Window window );
255
256 /**
257  * @brief Sets damaged areas of the window.
258  *
259  * This API is for setting static damaged areas of the window for partial update.
260  *
261  * @param[in] window The window instance
262  * @param[in] areas The damaged areas list to set
263  */
264 DALI_ADAPTOR_API void SetDamagedAreas(Window window, std::vector<Dali::Rect<int>>& areas);
265
266 } // namespace DevelWindow
267
268 } // namespace Dali
269
270 #endif // DALI_WINDOW_DEVEL_H