Fix to adjust the position of the partial Frame
[platform/framework/native/uifw.git] / inc / FUiWindow.h
1 //\r
2 // Open Service Platform\r
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
4 //\r
5 // Licensed under the Flora License, Version 1.0 (the License);\r
6 // you may not use this file except in compliance with the License.\r
7 // You may obtain a copy of the License at\r
8 //\r
9 //     http://floralicense.org/license/\r
10 //\r
11 // Unless required by applicable law or agreed to in writing, software\r
12 // distributed under the License is distributed on an AS IS BASIS,\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 // See the License for the specific language governing permissions and\r
15 // limitations under the License.\r
16 //\r
17 \r
18 /**\r
19  * @file        FUiWindow.h\r
20  * @brief       This is the header file for the %Window class.\r
21  *\r
22  * This header file contains the declarations of the %Window class.\r
23  */\r
24 \r
25 #ifndef _FUI_WINDOW_H_\r
26 #define _FUI_WINDOW_H_\r
27 \r
28 #include <FBaseTypes.h>\r
29 #include <FUiContainer.h>\r
30 #include <FUiIWindowEventListener.h>\r
31 \r
32 namespace Tizen { namespace Ui { namespace Animations {\r
33 class DisplayContext;\r
34 }}}\r
35 \r
36 namespace Tizen { namespace Ui\r
37 {\r
38 \r
39 class _WindowImpl;\r
40 \r
41 /**\r
42  * @enum WindowState\r
43  *\r
44  * Defines the state of %Window.\r
45  *\r
46  * @since       2.0\r
47  */\r
48 enum WindowState\r
49 {\r
50         WINDOW_STATE_INITIALIZED = 0x0000,      /**< The initial state of the window */\r
51         WINDOW_STATE_ACTIVATED = 0x0001,        /**< The state indicates that the window is the topmost window */\r
52         WINDOW_STATE_DEACTIVATED = 0x0002,      /**< The state indicates that the window is not the topmost window */\r
53 };\r
54 \r
55 /**\r
56  * @enum WindowZOrderGroup\r
57  *\r
58  * Defines the Z order group of %Window.\r
59  *\r
60  * @since 2.0\r
61  */\r
62 enum WindowZOrderGroup\r
63 {\r
64         WINDOW_Z_ORDER_GROUP_HIGHEST,        /**< The highest group for windows such as the call screen */\r
65         WINDOW_Z_ORDER_GROUP_HIGH,           /**< The high group for windows such as the lock screen */
66         WINDOW_Z_ORDER_GROUP_NORMAL,         /**< The default group of apps */\r
67 };\r
68 \r
69 /**\r
70  * @class       Window\r
71  * @brief       This class provides abstract top-level 'window' objects.\r
72  *\r
73  * @since       2.0\r
74  *\r
75  * The %Window class is an abstract base class.
76  * The %Window is a top-level window such as Controls::Frame, Controls::MessageBox, and Controls::Popup.\r
77  * The descendants of a %Window can exist outside of their applications's bounds.\r
78  *\r
79  */\r
80 class _OSP_EXPORT_ Window\r
81         : public Container\r
82 {\r
83 \r
84 public:\r
85         /**\r
86          * This destructor overrides Tizen::Base::Object::~Object().\r
87          *\r
88          * @since       2.0\r
89          */\r
90         virtual ~Window(void) = 0;\r
91 \r
92 public:\r
93         /**\r
94          * Adds the listener instance. @n\r
95          * The added listener can listen to events on when they are fired.\r
96          *\r
97          * @since                       2.0\r
98          *\r
99          * @param[in]   listener    The event listener to add\r
100          * @see                         RemoveWindowEventListener()\r
101          */\r
102         void AddWindowEventListener(Tizen::Ui::IWindowEventListener& listener);\r
103 \r
104         /**\r
105          * Removes a listener instance. @n\r
106          * The removed listener cannot listen to events when they are fired.\r
107          *\r
108          * @since                       2.0\r
109          *\r
110          * @param[in]   listener    The listener to remove\r
111          * @see                         AddWindowEventListener()\r
112          */\r
113         void RemoveWindowEventListener(Tizen::Ui::IWindowEventListener& listener);\r
114 \r
115         /**\r
116          * Shows the %Window.\r
117          *\r
118          * @since                       2.0\r
119          *\r
120          * @final     Although this method is virtual, it should not be overridden.\r
121      * If overridden, it may not work as expected.\r
122          *\r
123          * @return              An error code\r
124          * @exception   E_SUCCESS                       The method is successful.\r
125          * @exception   E_INVALID_OPERATION             The current state of the instance prohibits the execution of the specified operation, or\r
126          *                                                              this control is not 'displayable'.\r
127          * @exception   E_SYSTEM                        A system error has occurred.\r
128          */\r
129         virtual result Show(void);\r
130 \r
131         /**\r
132          * Sets the owner of the window.\r
133          *\r
134          * @since 2.0\r
135          *\r
136          * @param[in]    pControl      The control\r
137          * @remarks       The ownership of @c pControl is not transferred to this instance. It is the developer's responsibility to deallocate @c pControl even after calling this method.\r
138          */\r
139         void SetOwner(Tizen::Ui::Control *pControl);\r
140 \r
141         /**\r
142          * Gets the owner of the window.\r
143          *\r
144          * @since 2.1\r
145          *\r
146          * @return    The owner of the window\r
147          * @see    SetOwner()\r
148          */\r
149         Tizen::Ui::Control* GetOwner(void) const;\r
150 \r
151         /**\r
152          * Sets the Z order group of %Window.\r
153          *\r
154          * @since 2.0\r
155          *\r
156          * @privlevel      platform\r
157          * @privilege      %http://tizen.org/privilege/uimanager\r
158          *\r
159          * @return         An error code\r
160          * @param[in]      windowZOrderGroup    The Z order group of %Window\r
161          * @exception      E_SUCCESS            The method is successful.\r
162          * @exception      E_PRIVILEGE_DENIED   The application does not have the privilege to call this method.\r
163          * @remarks        If this method is not explicitly called, the Z order group of %Window is set to #WINDOW_Z_ORDER_GROUP_NORMAL.\r
164          */\r
165         result SetZOrderGroup(WindowZOrderGroup windowZOrderGroup);\r
166 \r
167         /**\r
168          * Gets the current state of the window.\r
169          *\r
170          * @since                       2.0\r
171          *\r
172          * @return              The current state of the window\r
173          */\r
174         WindowState GetWindowState(void) const;\r
175 \r
176         /**\r
177          * Gets the display context of the window.\r
178          *\r
179          * @since 2.0\r
180          *\r
181          * @return              A pointer to the DisplayContext instance\r
182          */\r
183         Tizen::Ui::Animations::DisplayContext* GetDisplayContext(void) const;\r
184 \r
185 protected:\r
186         /**\r
187          * Initializes this instance of %Window with the specified parameters.
188          *\r
189          * @since 2.0\r
190          *\r
191          * @return      An error code\r
192          * @param[in]   rect                                      The rectangle bounds to set\r
193          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
194          *                                  else @c false\r
195          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
196          *                                  else @c false\r
197          * @exception   E_SUCCESS           The method is successful.\r
198          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
199          * @remarks     This method must be called from the derived classes's construct methods.\r
200          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
201          * @see IsResizable()\r
202          */\r
203         result Construct(const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);\r
204 \r
205         /**\r
206          * Initializes this instance of %Window.\r
207          *\r
208          * @since 2.1\r
209          *\r
210          * @return      An error code\r
211          * @param[in]   rect                                      The rectangle bounds to set\r
212          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
213          *                                  else @c false\r
214          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
215          *                                  else @c false\r
216          * @exception   E_SUCCESS           The method is successful.\r
217          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
218          * @remarks     This method must be called from the derived classes's construct methods.\r
219          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
220          * @see IsResizable()\r
221          */\r
222         result Construct(const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);\r
223 \r
224         /**\r
225          * Initializes this instance of %Window with the specified layout and rectangular region.\r
226          *\r
227          * @since 2.0\r
228          *\r
229          * @return                  An error code\r
230          * @param[in]   layout                                   The layout for both the portrait and landscape mode\r
231          * @param[in]   rect                                      The location and size of the %window\r
232          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
233          *                                  else @c false\r
234          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
235          *                                  else @c false\r
236          * @exception   E_SUCCESS                The method is successful.\r
237          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
238          * @remarks     This method must be called from the derived classes's construct methods.\r
239          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
240          * @see IsResizable()\r
241          * @see Tizen::Ui::Layout\r
242          * @see Tizen::Ui::Container::GetLayoutN()\r
243          */\r
244          result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);\r
245 \r
246         /**\r
247          * Initializes this instance of %Window with the specified layout and rectangular region.\r
248          *\r
249          * @since 2.1\r
250          *\r
251          * @return                  An error code\r
252          * @param[in]   layout                                   The layout for both the portrait and landscape mode\r
253          * @param[in]   rect                                      The location and size of the %window\r
254          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
255          *                                  else @c false\r
256          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
257          *                                  else @c false\r
258          * @exception   E_SUCCESS                The method is successful.\r
259          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
260          * @remarks     This method must be called from the derived classes's construct methods.\r
261          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
262          * @see IsResizable()\r
263          * @see Tizen::Ui::Layout\r
264          * @see Tizen::Ui::Container::GetLayoutN()\r
265          */\r
266          result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);\r
267 \r
268         /**\r
269          * Initializes this instance of %Window with the specified layouts and rectangular region.\r
270          *\r
271          * @since 2.0\r
272          *\r
273          * @return                  An error code\r
274          * @param[in]   portraitLayout              The layout for the portrait mode\r
275          * @param[in]   landscapeLayout           The layout for the landscape mode\r
276          * @param[in]   rect                                      The location and size of the %Window\r
277          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
278          *                                  else @c false\r
279          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
280          *                                  else @c false\r
281          * @exception   E_SUCCESS                The method is successful.\r
282          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
283          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
284          * @see IsResizable()\r
285          * @see Tizen::Ui::Layout\r
286          * @see Tizen::Ui::Layout\r
287          * @see Tizen::Ui::Container::GetLayoutN()\r
288          * @see Tizen::Ui::Container::GetPortraitLayoutN()\r
289          * @see Tizen::Ui::Container::GetLandscapeLayoutN()\r
290          */\r
291         result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);\r
292 \r
293         /**\r
294          * Initializes this instance of %Window with the specified layouts and rectangular region.\r
295          *\r
296          * @since 2.1\r
297          *\r
298          * @return                  An error code\r
299          * @param[in]   portraitLayout              The layout for the portrait mode\r
300          * @param[in]   landscapeLayout           The layout for the landscape mode\r
301          * @param[in]   rect                                      The location and size of the %Window\r
302          * @param[in]   resizable                                Set to @c true to make the window resizable, @n\r
303          *                                  else @c false\r
304          * @param[in]   movable                                          Set to @c true to make the window movable, @n\r
305          *                                  else @c false\r
306          * @exception   E_SUCCESS                The method is successful.\r
307          * @exception   E_INVALID_ARG            A specified input parameter is invalid.\r
308          * @remarks     If the @c resizable is @c false, IsResizable() returns @c false.\r
309          * @see IsResizable()\r
310          * @see Tizen::Ui::Layout\r
311          * @see Tizen::Ui::Layout\r
312          * @see Tizen::Ui::Container::GetLayoutN()\r
313          * @see Tizen::Ui::Container::GetPortraitLayoutN()\r
314          * @see Tizen::Ui::Container::GetLandscapeLayoutN()\r
315          */\r
316         result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);\r
317 \r
318         /**\r
319          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.\r
320          *\r
321          * @since       2.0\r
322          */\r
323         Window(void);\r
324 \r
325 private:\r
326         //\r
327         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
328         //\r
329         Window(const Window& rhs);\r
330 \r
331         //\r
332         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
333         //\r
334         Window& operator =(const Window& rhs);\r
335 \r
336 protected:\r
337         friend class _WindowImpl;\r
338 \r
339         //\r
340         // This method is for internal use only. Using this method can cause behavioral,\r
341         // security-related, and consistency-related issues in the application.\r
342         //\r
343         // This method is reserved and may change its name at any time without prior notice.\r
344         //\r
345         virtual void Window_Reserved1(void) {}\r
346 \r
347         //\r
348         // This method is for internal use only. Using this method can cause behavioral,\r
349         // security-related, and consistency-related issues in the application.\r
350         //\r
351         // This method is reserved and may change its name at any time without prior notice.\r
352         //\r
353         virtual void Window_Reserved2(void) {}\r
354 \r
355         //\r
356         // This method is for internal use only. Using this method can cause behavioral,\r
357         // security-related, and consistency-related issues in the application.\r
358         //\r
359         // This method is reserved and may change its name at any time without prior notice.\r
360         //\r
361         virtual void Window_Reserved3(void) {}\r
362 \r
363         //\r
364         // This method is for internal use only. Using this method can cause behavioral,\r
365         // security-related, and consistency-related issues in the application.\r
366         //\r
367         // This method is reserved and may change its name at any time without prior notice.\r
368         //\r
369         virtual void Window_Reserved4(void) {}\r
370 \r
371         //\r
372         // This method is for internal use only. Using this method can cause behavioral,\r
373         // security-related, and consistency-related issues in the application.\r
374         //\r
375         // This method is reserved and may change its name at any time without prior notice.\r
376         //\r
377         virtual void Window_Reserved5(void) {}\r
378 }; // Window\r
379 \r
380 }} // Tizen::Ui\r
381 \r
382 #endif //_FUI_WINDOW_H_\r