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