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