2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
20 * @brief This is the header file for the %Window class.
22 * This header file contains the declarations of the %Window class.
25 #ifndef _FUI_WINDOW_H_
26 #define _FUI_WINDOW_H_
28 #include <FBaseTypes.h>
29 #include <FUiContainer.h>
30 #include <FUiIWindowEventListener.h>
32 namespace Tizen { namespace Ui { namespace Animations {
36 namespace Tizen { namespace Ui
44 * Defines the state of %Window.
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 */
56 * @enum WindowZOrderGroup
58 * Defines the Z order group of %Window.
62 enum WindowZOrderGroup
64 WINDOW_Z_ORDER_GROUP_HIGHEST, /**< The highest group for windows such as the call screen */
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 */
71 * @brief This class provides abstract top-level 'window' objects.
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.
77 * The descendants of a %Window can exist outside of their applications's bounds.
80 class _OSP_EXPORT_ Window
86 * This destructor overrides Tizen::Base::Object::~Object().
90 virtual ~Window(void) = 0;
94 * Adds the listener instance. @n
95 * The added listener can listen to events on when they are fired.
99 * @param[in] listener The event listener to add
100 * @see RemoveWindowEventListener()
102 void AddWindowEventListener(Tizen::Ui::IWindowEventListener& listener);
105 * Removes a listener instance. @n
106 * The removed listener cannot listen to events when they are fired.
110 * @param[in] listener The listener to remove
111 * @see AddWindowEventListener()
113 void RemoveWindowEventListener(Tizen::Ui::IWindowEventListener& listener);
120 * @final Although this method is virtual, it should not be overridden.
121 * If overridden, it may not work as expected.
123 * @return An error code
124 * @exception E_SUCCESS The method is successful.
125 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or
126 * this control is not 'displayable'.
127 * @exception E_SYSTEM A system error has occurred.
129 virtual result Show(void);
132 * Sets the owner of the window.
133 * The visibility of a window has dependency on the visibility of the owner window.
137 * @param[in] pControl The control
138 * @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.
140 void SetOwner(Tizen::Ui::Control* pControl);
143 * Gets the owner of the window.
147 * @return The owner of the window
150 Tizen::Ui::Control* GetOwner(void) const;
153 * Sets the Z order group of %Window.
157 * @privlevel platform
158 * @privilege %http://tizen.org/privilege/uimanager
160 * @return An error code
161 * @param[in] windowZOrderGroup The Z order group of %Window
162 * @exception E_SUCCESS The method is successful.
163 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
164 * @remarks If this method is not explicitly called, the Z order group of %Window is set to #WINDOW_Z_ORDER_GROUP_NORMAL.
166 result SetZOrderGroup(WindowZOrderGroup windowZOrderGroup);
169 * Gets the current state of the window.
173 * @return The current state of the window
175 WindowState GetWindowState(void) const;
178 * Gets the display context of the window.
182 * @return A pointer to the DisplayContext instance
184 Tizen::Ui::Animations::DisplayContext* GetDisplayContext(void) const;
188 * Initializes this instance of %Window with the specified parameters.
192 * @return An error code
193 * @param[in] rect The rectangle bounds to set
194 * @param[in] resizable Set to @c true to make the window resizable, @n
196 * @param[in] movable Set to @c true to make the window movable, @n
198 * @exception E_SUCCESS The method is successful.
199 * @exception E_INVALID_ARG A specified input parameter is invalid.
200 * @remarks This method must be called from the derived classes's construct methods.
201 * @remarks If the @c resizable is @c false, IsResizable() returns @c false.
204 result Construct(const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);
207 * Initializes this instance of %Window with the specified parameters.
211 * @return An error code
212 * @param[in] rect The rectangle bounds to set
213 * @param[in] resizable Set to @c true to make the window resizable, @n
215 * @param[in] movable Set to @c true to make the window movable, @n
217 * @exception E_SUCCESS The method is successful.
218 * @exception E_INVALID_ARG A specified input parameter is invalid.
219 * @remarks This method must be called from the derived classes's construct methods.
220 * @remarks If the @c resizable is @c false, IsResizable() returns @c false.
223 result Construct(const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);
226 * Initializes this instance of %Window with the specified layout and rectangular region.
230 * @return An error code
231 * @param[in] layout The layout for both the portrait and landscape mode
232 * @param[in] rect The location and size of the %window
233 * @param[in] resizable Set to @c true to make the window resizable, @n
235 * @param[in] movable Set to @c true to make the window movable, @n
237 * @exception E_SUCCESS The method is successful.
238 * @exception E_INVALID_ARG A specified input parameter is invalid.
239 * @remarks This method must be called from the derived classes's construct methods.
240 * @remarks If the @c resizable is @c false, IsResizable() returns @c false.
242 * @see Tizen::Ui::Layout
243 * @see Tizen::Ui::Container::GetLayoutN()
245 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);
248 * Initializes this instance of %Window with a specified layout and rectangular region.
252 * @return An error code
253 * @param[in] layout The layout for both the portrait and landscape mode
254 * @param[in] rect The location and size of the window
255 * @param[in] resizable Set to @c true to make the window resizable, @n
257 * @param[in] movable Set to @c true to make the window movable, @n
259 * @exception E_SUCCESS The method is successful.
260 * @exception E_INVALID_ARG A specified input parameter is invalid.
262 * - This method must be called from the derived classes's construct methods.
263 * - If the @c resizable is @c false, IsResizable() returns @c false.
265 * @see Tizen::Ui::Layout
266 * @see Tizen::Ui::Container::GetLayoutN()
268 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);
271 * Initializes this instance of %Window with the specified layouts and rectangular region.
275 * @return An error code
276 * @param[in] portraitLayout The layout for the portrait mode
277 * @param[in] landscapeLayout The layout for the landscape mode
278 * @param[in] rect The location and size of the %Window
279 * @param[in] resizable Set to @c true to make the window resizable, @n
281 * @param[in] movable Set to @c true to make the window movable, @n
283 * @exception E_SUCCESS The method is successful.
284 * @exception E_INVALID_ARG A specified input parameter is invalid.
285 * @remarks If the @c resizable is @c false, IsResizable() returns @c false.
287 * @see Tizen::Ui::Layout
288 * @see Tizen::Ui::Layout
289 * @see Tizen::Ui::Container::GetLayoutN()
290 * @see Tizen::Ui::Container::GetPortraitLayoutN()
291 * @see Tizen::Ui::Container::GetLandscapeLayoutN()
293 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Rectangle& rect, bool resizable = true, bool movable = true);
296 * Initializes this instance of %Window with the specified layouts and rectangular region.
300 * @return An error code
301 * @param[in] portraitLayout The layout for the portrait mode
302 * @param[in] landscapeLayout The layout for the landscape mode
303 * @param[in] rect The location and size of the %Window
304 * @param[in] resizable Set to @c true to make the window resizable, @n
306 * @param[in] movable Set to @c true to make the window movable, @n
308 * @exception E_SUCCESS The method is successful.
309 * @exception E_INVALID_ARG A specified input parameter is invalid.
310 * @remarks If the @c resizable is @c false, IsResizable() returns @c false.
312 * @see Tizen::Ui::Layout
313 * @see Tizen::Ui::Layout
314 * @see Tizen::Ui::Container::GetLayoutN()
315 * @see Tizen::Ui::Container::GetPortraitLayoutN()
316 * @see Tizen::Ui::Container::GetLandscapeLayoutN()
318 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::FloatRectangle& rect, bool resizable = true, bool movable = true);
321 * 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.
329 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
331 Window(const Window& rhs);
334 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
336 Window& operator =(const Window& rhs);
339 friend class _WindowImpl;
342 // This method is for internal use only. Using this method can cause behavioral,
343 // security-related, and consistency-related issues in the application.
345 // This method is reserved and may change its name at any time without prior notice.
347 virtual void Window_Reserved1(void) {}
350 // This method is for internal use only. Using this method can cause behavioral,
351 // security-related, and consistency-related issues in the application.
353 // This method is reserved and may change its name at any time without prior notice.
355 virtual void Window_Reserved2(void) {}
358 // This method is for internal use only. Using this method can cause behavioral,
359 // security-related, and consistency-related issues in the application.
361 // This method is reserved and may change its name at any time without prior notice.
363 virtual void Window_Reserved3(void) {}
366 // This method is for internal use only. Using this method can cause behavioral,
367 // security-related, and consistency-related issues in the application.
369 // This method is reserved and may change its name at any time without prior notice.
371 virtual void Window_Reserved4(void) {}
374 // This method is for internal use only. Using this method can cause behavioral,
375 // security-related, and consistency-related issues in the application.
377 // This method is reserved and may change its name at any time without prior notice.
379 virtual void Window_Reserved5(void) {}
384 #endif //_FUI_WINDOW_H_