Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_LayoutLayoutItem.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_LayoutLayoutItem.h
19  * @brief       This is the header file for LayoutItem class.
20  *
21  * This header file contains the declaration of LayoutItem class.
22  */
23
24 #pragma once
25
26 #ifndef _FUI_INTERNAL_LAYOUT_LAYOUT_ITEM_H_
27 #define _FUI_INTERNAL_LAYOUT_LAYOUT_ITEM_H_
28
29 #include <FBaseObject.h>
30 #include <FBaseErrors.h>
31 #include <FGrpRectangle.h>
32 #include <FOspConfig.h>
33 #include "FUi_LayoutLayoutTypes.h"
34 #include "FUi_LayoutILayoutItemHandler.h"
35
36 namespace Tizen { namespace Ui
37 {
38 class _Control;
39 } }
40
41 namespace Tizen
42 {
43 namespace Ui
44 {
45 namespace _Layout
46 {
47
48 class Layout;
49 class LayoutContainer;
50
51 class _OSP_EXPORT_ LayoutItem
52         : public Tizen::Base::Object
53 {
54 public:
55         /**
56          * This is the default constructor for this class.
57          *
58          * @since 2.0
59          */
60         LayoutItem(void);
61
62         /**
63          * This is the destructor for this class.
64          *
65          * @since 2.0
66          */
67         virtual ~LayoutItem(void);
68
69         /**
70          * Gets the layout of parent container.
71          *
72          * @return              The layout of parent container.
73          * @since 2.0
74          */
75         Layout* GetIncludedLayout(void) const;
76
77         /**
78          * Sets the base rect when the bounds of container has been changed.
79          *
80          * @return              An error code
81          * @exception   E_SUCCESS               The method was successful.
82          * @exception   E_INVALID_STATE This instance is in an invalid state.
83          * @since 2.0
84          */
85         result OnChangeBaseRect(void);
86
87         /**
88          * Sets the item handler.
89          *
90          * @return              void
91          * @since 2.0
92          */
93         void SetItemHandler(ILayoutItemHandler* pOuterControl);
94
95         /**
96          * Gets the layoutable flag.
97          *
98          * @return              void
99          * @since 2.0
100          */
101         bool GetLayoutable(void);
102
103         /**
104          * Converts the window bounds to client bounds.
105          *
106          * @param[in]   windowRect
107          * @param[out]  clientRect
108          * @since 2.0
109          */
110         void ConvertWindowToClientBounds(const LayoutRect windowRect, LayoutRect& clientRect);
111
112 protected:
113         /**
114          * Determines the basic size for calculating size.
115          *
116          * @return              An error code
117          * @param[in]   width
118          * @param[in]   height
119          * @exception   E_SUCCESS               The method was successful.
120          * @exception   E_INVALID_STATE This instance is in an invalid state.
121          * @since 2.0
122          */
123         virtual result Measure(int width, int height);
124
125         /**
126          * Sets the parent container.
127          *
128          * @return              void
129          * @param[in]   pParentContainer
130          * @since 2.0
131          */
132         void SetParentContainer(LayoutContainer* pParentContainer);
133
134         /**
135          * Gets the parent container.
136          *
137          * @return              The parent container.
138          * @since 2.0
139          */
140         LayoutContainer* GetParentContainer(void) const;
141
142         /**
143          * Sets the measured size.
144          *
145          * @return              void
146          * @param[in]   width
147          * @param[in]   height
148          * @since 2.0
149          */
150         void SetMeasuredSize(int width, int height);
151
152         /**
153          * Gets the measured size.
154          *
155          * @return              void
156          * @param[out]  width
157          * @param[out]  height
158          * @since 2.0
159          */
160         void GetMeasuredSize(int& width, int& height) const;
161
162         /**
163          * Runs ILayoutItemHandler::OnItemMeasure.
164          *
165          * @return                      void
166          * @param[inout]        width
167          * @param[inout]        height
168          * @since 2.0
169          */
170         void RunItemMeasure(int& width, int& height);
171
172         /**
173          * Gets the minimum size of _Control.
174          *
175          * @param[out]  minSize
176          * @since 2.0
177          */
178         void GetMinSize(LayoutSize& minSize) const;
179
180         /**
181          * Gets the maximum size of _Control.
182          *
183          * @param[out]  maxSize
184          * @since 2.0
185          */
186         void GetMaxSize(LayoutSize& maxSize) const;
187
188         /**
189          * Sets the bounds of _Control.
190          *
191          * @return              An error code
192          * @param[in]   rect
193          * @exception   E_SUCCESS               The method was successful.
194          * @exception   E_INVALID_STATE This instance is in an invalid state.
195          * @since 2.0
196          */
197         result SetItemWindowRect(const LayoutRect rect);
198
199         /**
200          * Gets the bounds of _Control.
201          *
202          * @param[out]  rect
203          * @since 2.0
204          */
205         void GetItemWindowRect(LayoutRect& rect) const;
206
207 private:
208         /**
209          * This is the copy constructor for this class.
210          *
211          * @since 2.0
212          */
213         LayoutItem(const LayoutItem&);
214
215         /**
216          * This is the substitution operator for this class.
217          *
218          * @since 2.0
219          */
220         LayoutItem& operator =(const LayoutItem&);
221
222         /**
223          * Sets the visible state.
224          *
225          * @return              An error code
226          * @exception   E_SUCCESS               The method was successful.
227          * @exception   E_INVALID_STATE This instance is in an invalid state.
228          * @since 2.0
229          */
230         void Visible(bool visible);
231
232 // property
233 private:
234         ILayoutItemHandler* __pOuterControl;
235         LayoutContainer* __pParentContainer;
236
237         LayoutSize __measuredSize;
238
239         friend class LayoutItemProxy;
240 }; // LayoutItem
241
242 }}} //Tizen::Ui::_Layout
243
244 #endif // _FUI_INTERNAL_LAYOUT_LAYOUT_ITEM_H_