Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUi_RelativeLayoutImpl.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_RelativeLayoutImpl.h
19  * @brief       This is the header file for _RelativeLayoutImpl class.
20  *
21  * This header file contains the declaration of _RelativeLayoutImpl class.
22  */
23
24 #ifndef _FUI_INTERNAL_RELATIVE_LAYOUT_IMPL_H
25 #define _FUI_INTERNAL_RELATIVE_LAYOUT_IMPL_H
26
27 #include <FUiRelativeLayout.h>
28 #include "FUi_LayoutImpl.h"
29 #include "FUi_LayoutRelativeLayout.h"
30
31 namespace Tizen { namespace Ui
32 {
33
34 class RelativeLayout;
35
36 class _RelativeLayoutImpl
37         : public _LayoutImpl
38 {
39 public:
40         /**
41          * This is the destructor for this class.
42          *
43          * @since               2.0
44          */
45         virtual ~_RelativeLayoutImpl(void);
46
47         /**
48          * Creates the instance of _RelativeLayoutImpl.
49          *
50          * @since 2.0
51          * @return              The instance of _RelativeLayoutImpl.
52          * @param[in]   pPublicLayout   The public class of relative layout.
53          * @exception   E_SUCCESS               The method was successful.
54          * @exception   E_OUT_OF_MEMORY Insufficient memory.
55          */
56         static _RelativeLayoutImpl* CreateRelativeLayoutImplN(RelativeLayout* pPublicLayout);
57
58         /**
59          * Gets the name of public class.
60          *
61          * @since 2.0
62          * @return              The name of public class.
63          */
64         virtual const char* GetPublicClassName(void) const;
65
66         /**
67          * Gets the public class.
68          *
69          * @since 2.0
70          * @return              The public class.
71          */
72         virtual const RelativeLayout& GetPublic(void) const;
73
74         /**
75          * Gets the public class.
76          *
77          * @since 2.0
78          * @return              The public class.
79          */
80         virtual RelativeLayout& GetPublic(void);
81
82         /**
83          * Gets the core class.
84          *
85          * @since 2.0
86          * @return              The core class.
87          */
88         virtual const _Layout::RelativeLayout& GetCore(void) const;
89
90         /**
91          * Gets the core class.
92          *
93          * @since 2.0
94          * @return              The core class.
95          */
96         virtual _Layout::RelativeLayout& GetCore(void);
97
98         /**
99          * Gets the _RelativeLayoutImpl instance for the RelativeLayout.
100          *
101          * @since 2.0
102          * @return              The _RelativeLayoutImpl instance.
103          * @param[in]   pLayout         The RelativeLayout instance.
104          */
105         static const _RelativeLayoutImpl* GetInstance(const RelativeLayout& layout);
106
107         /**
108          * Gets the _RelativeLayoutImpl instance for the RelativeLayout.
109          *
110          * @since 2.0
111          * @return              The _RelativeLayoutImpl instance.
112          * @param[in]   pLayout         The RelativeLayout instance.
113          */
114         static _RelativeLayoutImpl* GetInstance(RelativeLayout& layout);
115
116         /**
117          * Sets the specified control at the center of the parent control.
118          *
119          * @since               2.0
120          * @return              An error code
121          * @param[in]   control                 The control to be center aligned
122          * @param[in]   alignment               The center alignment for a control either vertically or horizontally
123          * @exception   E_SUCCESS               The method was successful.
124          * @exception   E_INVALID_STATE This instance is in an invalid state.
125          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
126          * @exception   E_SYSTEM                A system error occurred.
127          */
128         result SetCenterAligned(_ControlImpl& control, CenterAlignmentType alignment);
129
130         /**
131          * Sets the relation of the specified child control for the edge with other control.
132          *
133          * @since               2.0
134          * @return              An error code
135          * @param[in]   childControl    The control for which the relation is set
136          * @param[in]   targetControl   The target control @n
137          *                                                              It should be a parent or sibling.
138          * @param[in]   edgeRelation    The edge of the specified control to be aligned with the edge of the target control
139          * @exception   E_SUCCESS               The method was successful.
140          * @exception   E_INVALID_STATE This instance is in an invalid state.
141          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
142          * @exception   E_SYSTEM                A system error occurred.
143          */
144         result SetRelation(_ControlImpl& childControl, _ControlImpl& targetControl, RectangleEdgeRelation edgeRelation);
145
146         /**
147          * Resets the center position of the specified control.
148          *
149          * @since               2.0
150          * @return              An error code
151          * @param[in]   childControl    The control to be center aligned
152          * @param[in]   alignment               The center alignment for a control either vertically or horizontally
153          * @exception   E_SUCCESS               The method was successful.
154          * @exception   E_INVALID_STATE This instance is in an invalid state.
155          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
156          * @exception   E_SYSTEM                A system error occurred.
157          */
158         result ResetCenterAligned(_ControlImpl& control, CenterAlignmentType alignment);
159
160         /**
161          * Resets the relation of the specified control for the vertical edge.
162          *
163          * @since               2.0
164          * @return              An error code
165          * @param[in]   childControl    The control for which the relation is reset
166          * @param[in]   edgeType                The edge type of the specified control
167          * @exception   E_SUCCESS               The method was successful.
168          * @exception   E_INVALID_STATE This instance is in an invalid state.
169          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
170          * @exception   E_SYSTEM                A system error occurred.
171          */
172         result ResetRelation(_ControlImpl& control, RectangleEdgeType edgeType);
173
174         /**
175          * Sets the height of the specified control to the fixed size.
176          *
177          * @since               2.0
178          * @return              An error code
179          * @param[in]   childControl    The control for which the height is set
180          * @param[in]   height                  The value of the height
181          * @exception   E_SUCCESS               The method was successful.
182          * @exception   E_INVALID_STATE This instance is in an invalid state.
183          */
184         result SetHeight(_ControlImpl& control, int height);
185
186         /**
187          * Sets the width of the specified control to the fixed size.
188          *
189          * @since               2.0
190          * @return              An error code
191          * @param[in]   childControl    The control for which the width is set
192          * @param[in]   width                   The value of the width
193          * @exception   E_SUCCESS               The method was successful.
194          * @exception   E_INVALID_STATE This instance is in an invalid state.
195          */
196         result SetWidth(_ControlImpl& control, int width);
197
198         /**
199          * Sets the margins of the specified control.
200          *
201          * @since               2.0
202          * @return              An error code
203          * @param[in]   item                    The control for which the margins are set
204          * @param[in]   left                    The left margin
205          * @param[in]   right                   The right margin
206          * @param[in]   top                             The top margin
207          * @param[in]   bottom                  The bottom margin
208          * @exception   E_SUCCESS               The method was successful.
209          * @exception   E_INVALID_STATE This instance is in an invalid state.
210          */
211         result SetItemMargin(const _ControlImpl& item, int left, int right, int top, int bottom);
212
213         /**
214          * Gets the margins of the specified control.
215          *
216          * @since               2.0
217          * @return              An error code
218          * @param[in]   item                    The control for which the margins are set
219          * @param[out]  left                    The left margin
220          * @param[out]  right                   The right margin
221          * @param[out]  top                             The top margin
222          * @param[out]  bottom                  The bottom margin
223          * @exception   E_SUCCESS               The method was successful.
224          * @exception   E_INVALID_STATE This instance is in an invalid state.
225          */
226         result GetItemMargin(const _ControlImpl& item, int& left, int& right, int& top, int& bottom);
227
228         /**
229          * Sets the width of the specified control as per the fitting policy.
230          *
231          * @since               2.0
232          * @return              An error code
233          * @param[in]   item                    The control for which the width is set
234          * @param[in]   policy                  The fitting policy for the width
235          * @exception   E_SUCCESS               The method was successful.
236          * @exception   E_INVALID_STATE This instance is in an invalid state.
237          */
238         result SetItemHorizontalFitPolicy(const _ControlImpl& item, const FitPolicy policy);
239
240         /**
241          * Sets the height of the specified control as per the fitting policy.
242          *
243          * @since               2.0
244          * @return              An error code
245          * @param[in]   childControl    The control for which the height is set
246          * @param[in]   policy                  The fitting policy for the height
247          * @exception   E_SUCCESS               The method was successful.
248          * @exception   E_INVALID_STATE This instance is in an invalid state.
249          */
250         result SetItemVerticalFitPolicy(const _ControlImpl& item, const FitPolicy policy);
251
252         /**
253          * Gets the type of the layout.
254          *
255          * @since               2.0
256          * @return      The layout type
257          */
258         virtual LayoutType GetLayoutType(void) const;
259
260 protected:
261         /**
262          * This is the default constructor for this class.
263          *
264          * @since               2.0
265          */
266         _RelativeLayoutImpl(RelativeLayout* pPublicLayout, _Layout::RelativeLayout* pCoreLayout);
267 }; // _RelativeLayoutImpl
268
269 }} // Tizen::Ui
270
271 #endif // _FUI_INTERNAL_RELATIVE_LAYOUT_IMPL_H