Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_LayoutLayoutContainer.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  * @file        FUi_LayoutLayoutContainer.h
19  * @brief       This is the header file for LayoutContainer class.
20  *
21  * This header file contains the declaration of LayoutContainer class.
22  */
23
24 #pragma once
25
26 #ifndef _FUI_INTERNAL_LAYOUT_LAYOUT_CONTAINER_H_
27 #define _FUI_INTERNAL_LAYOUT_LAYOUT_CONTAINER_H_
28
29 #include "FUi_LayoutLayoutItem.h"
30
31 //outer
32 namespace Tizen
33 {
34 namespace Ui
35 {
36 namespace _Layout
37 {
38
39 class LayoutList;
40
41 class _OSP_EXPORT_ LayoutContainer
42         : public LayoutItem
43 {
44 public:
45         /**
46          * This is the default constructor for this class.
47          *
48          * @since 2.0
49          */
50         LayoutContainer(void);
51
52         /**
53          * This is the destructor for this class.
54          *
55          * @since 2.0
56          */
57         virtual ~LayoutContainer(void);
58
59         /**
60          * Sets the current layout to specified layout that is in layout list.
61          *
62          * @return              An error code
63          * @exception   E_SUCCESS               The method was successful.
64          * @exception   E_INVALID_ARG   The input layout is not exist in layout list.
65          * @since 2.0
66          */
67         result SetCurrentLayout(Layout& layout);
68
69         /**
70          * Adds the specified layout to the layout list.
71          *
72          * @return              An error code
73          * @param[in]   layout                  The layout to add to list.
74          * @exception   E_SUCCESS               The method was successful.
75          * @exception   E_INVALID_STATE This instance is in an invalid state.
76          * @exception   E_OUT_OF_MEMORY Insufficient memory.
77          * @since 2.0
78          */
79         result AddLayout(Layout& layout);
80
81         /**
82          * Gets the current layout of container.
83          *
84          * @return              The current layout.
85          * @since 2.0
86          */
87         Layout* GetLayout(void) const;
88
89         /**
90          * Sets the default layout to specified layout.
91          *
92          * @return              An error code
93          * @param[in]   layout                  The default layout.
94          * @exception   E_SUCCESS               The method was successful.
95          * @exception   E_INVALID_ARG   The input layout is not exist in layout list.
96          * @since 2.0
97          */
98         result SetDefaultLayout(Layout& layout);
99
100         /**
101          * Gets the default layout.
102          *
103          * @return              The default layout.
104          * @since 2.0
105          */
106         Layout* GetDefaultLayout(void) const;
107
108         /**
109          * Checks whether the specified layout exists in list.
110          *
111          * @return              @c true, if the layout exists @n
112          *                              @c false, otherwise
113          * @param[in]   The layout to check.
114          * @since 2.0
115          */
116         bool LayoutExists(Layout& layout);
117
118         /**
119          * Adds the item to all layout of container.
120          *
121          * @return              An error code
122          * @param[in]   addItem                 The item to add the layout.
123          * @exception   E_SUCCESS               The method was successful.
124          * @exception   E_INVALID_STATE This instance is in an invalid state.
125          * @since 2.0
126          */
127         result AddItem(LayoutItem& addItem);
128
129         /**
130          * Removes the item from all layout of container.
131          *
132          * @return              An error code
133          * @param[in]   removeItem              The item to remove from the layout.
134          * @exception   E_SUCCESS               The method was successful.
135          * @exception   E_INVALID_STATE This instance is in an invalid state.
136          * @since 2.0
137          */
138         result RemoveItem(LayoutItem& removeItem);
139
140 private:
141         /**
142          * This is the copy constructor for this class.
143          *
144          * @since 2.0
145          */
146         LayoutContainer(const LayoutContainer&);
147
148         /**
149          * This is the substitution operator for this class.
150          *
151          * @since 2.0
152          */
153         LayoutContainer& operator =(const LayoutContainer&);
154
155         /**
156          * Sets the intended window size.
157          *
158          * @return              void
159          * @param[in]   intendedWindowSize
160          * @since 2.0
161          */
162         void SetIntendedWindowSize(const LayoutSize intendedWindowSize);
163
164         /**
165          * Gets the intended window size.
166          *
167          * @return              Intended window size.
168          * @since 2.0
169          */
170         LayoutSize GetIntendedWindowSize(void) const;
171
172         /**
173          * Determines the basic size for calculating size for all children.
174          *
175          * @return              An error code
176          * @param[in]   width
177          * @param[in]   height
178          * @exception   E_SUCCESS               The method was successful.
179          * @exception   E_INVALID_STATE This instance is in an invalid state.
180          * @since 2.0
181          */
182         virtual result Measure(int width, int height);
183
184         /**
185          * This method is not used currently.
186          *
187          * @return              An error code
188          * @param[in]   deletedLayout
189          * @exception   E_SUCCESS               The method was successful.
190          * @exception   E_INVALID_STATE This instance is in an invalid state.
191          * @since 2.0
192          */
193         result OnSetDefaultLayout(Layout& deletedLayout);
194
195         /**
196          * Removes the item from layout when the item has been destroyed.
197          *
198          * @return              An error code
199          * @param[in]   deletedLayout   The deleted item.
200          * @exception   E_SUCCESS               The method was successful.
201          * @exception   E_INVALID_STATE This instance is in an invalid state.
202          * @since 2.0
203          */
204         void OnDestroyItem(LayoutItem& item);
205
206         /**
207          * Removes the layout from list when the layout has been destroyed.
208          *
209          * @return              An error code
210          * @param[in]   pItem                   The deleted layout.
211          * @exception   E_SUCCESS               The method was successful.
212          * @exception   E_INVALID_STATE This instance is in an invalid state.
213          * @since 2.0
214          */
215         void OnDestroyLayout(Layout& layout);
216
217         /**
218          * Sets the container when the contaier proxy has been destroyed.
219          *
220          * @return              An error code
221          * @exception   E_SUCCESS               The method was successful.
222          * @exception   E_INVALID_STATE This instance is in an invalid state.
223          * @since 2.0
224          */
225         void OnDestroyContainerProxy(void);
226
227         LayoutList* GetLayoutList(void);
228
229 // property
230 private:
231         //_Control* __pOuterContainer;
232         Layout* __pCurrentLayout;
233         LayoutSize __intendedWindowSize;
234
235         LayoutList* __pLayoutList;
236
237         bool __defaultLayoutFlag;
238
239         friend class Layout;
240         friend class LayoutItem;
241         friend class LayoutItemProxy;
242 }; // LayoutContainer
243
244 }}} //Tizen::Ui::_Layout
245
246 #endif // _FUI_INTERNAL_LAYOUT_LAYOUT_CONTAINER_H_