modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUi_GridLayoutImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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_GridLayoutImpl.h
19  * @brief       This is the header file for _GridLayoutImpl class.
20  *
21  * This header file contains the declaration of _GridLayoutImpl class.
22  */
23
24 #ifndef _FUI_INTERNAL_GRID_LAYOUT_IMPL_H
25 #define _FUI_INTERNAL_GRID_LAYOUT_IMPL_H
26
27 #include <FUiGridLayout.h>
28 #include "FUi_LayoutImpl.h"
29 #include "FUi_LayoutTableLayout.h"
30
31 namespace Tizen { namespace Ui
32 {
33
34 class GridLayout;
35
36 class _GridLayoutImpl
37         : public _LayoutImpl
38 {
39 public:
40         /**
41          * This is the destructor for this class.
42          *
43          * @since               2.0
44          */
45         virtual ~_GridLayoutImpl(void);
46
47         /**
48          * Creates the instance of _GridLayoutImpl.
49          *
50          * @since 2.0
51          * @return              The instance of _GridLayoutImpl.
52          * @param[in]   pPublicLayout   The public class of grid layout.
53          * @param[in]   maxRow                  The max number of row.
54          * @param[in]   maxColumn               The max number of column.
55          * @exception   E_SUCCESS               The method was successful.
56          * @exception   E_OUT_OF_MEMORY Insufficient memory.
57          */
58         static _GridLayoutImpl* CreateGridLayoutImplN(GridLayout* pPublicLayout, int maxRow, int maxColumn);
59
60         /**
61          * Gets the name of public class.
62          *
63          * @since 2.0
64          * @return              The name of public class.
65          */
66         virtual const char* GetPublicClassName(void) const;
67
68         /**
69          * Gets the public class.
70          *
71          * @since 2.0
72          * @return              The public class.
73          */
74         virtual const GridLayout& GetPublic(void) const;
75
76         /**
77          * Gets the public class.
78          *
79          * @since 2.0
80          * @return              The public class.
81          */
82         virtual GridLayout& GetPublic(void);
83
84         /**
85          * Gets the core class.
86          *
87          * @since 2.0
88          * @return              The core class.
89          */
90         virtual const _Layout::TableLayout& GetCore(void) const;
91
92         /**
93          * Gets the core class.
94          *
95          * @since 2.0
96          * @return              The core class.
97          */
98         virtual _Layout::TableLayout& GetCore(void);
99
100         /**
101          * Gets the _GridLayoutImpl instance for the GridLayout.
102          *
103          * @since 2.0
104          * @return              The _GridLayoutImpl instance.
105          * @param[in]   pLayout         The GridLayout instance.
106          */
107         static const _GridLayoutImpl* GetInstance(const GridLayout& layout);
108
109         /**
110          * Gets the _GridLayoutImpl instance for the GridLayout.
111          *
112          * @since 2.0
113          * @return              The _GridLayoutImpl instance.
114          * @param[in]   pLayout         The GridLayout instance.
115          */
116         static _GridLayoutImpl* GetInstance(GridLayout& layout);
117
118         /**
119          * Sets the stretching ability of the specified column.
120          *
121          * @since               2.0
122          * @return              An error code
123          * @param[in]   columnIndex     The column index
124          * @param[in]   stretchable     Set to @c true to make the column as stretchable @n
125          *                                                      @c false, otherwise
126          * @exception   E_SUCCESS               The method was successful.
127          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
128          */
129         result SetColumnStretchable(int columnIndex, bool stretchable);
130
131         /**
132          * Sets the shrinking ability of the specified column.
133          *
134          * @since               2.0
135          * @return              An error code
136          * @param[in]   columnIndex     The column index
137          * @param[in]   shrinkable      Set to @c true to make the column as shrinkable @n
138          *                                                      @c false, otherwise
139          * @exception   E_SUCCESS               The method was successful.
140          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
141          */
142         result SetColumnShrinkable(int columnIndex, bool shrinkable);
143
144         /**
145          * Sets the collapsibility of a column.
146          *
147          * @since               2.0
148          * @return              An error code
149          * @param[in]   columnIndex     The column index
150          * @param[in]   collapsed       Set to @c true to make the column as collapsible @n
151          *                                                      @c false, otherwise
152          * @exception   E_SUCCESS               The method was successful.
153          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
154          */
155         result SetColumnCollapsed(int columnIndex, bool collapsed);
156
157         /**
158          * Sets the stretching ability of all columns.
159          *
160          * @since               2.0
161          * @return              An error code
162          * @param[in]   stretchable     Set to @c true to set all columns as stretchable @n
163          *                                                      @c false, otherwise
164          * @exception   E_SUCCESS               The method was successful.
165          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
166          * @exception   E_OUT_OF_MEMORY Insufficient memory.
167          */
168         result SetAllColumnsStretchable(bool stretchable);
169
170         /**
171          * Sets the shrinking ability of all columns.
172          *
173          * @since               2.0
174          * @return              An error code
175          * @param[in]   shrinkable      Set to @c true to set all columns as shrinkable @n
176          *                                                      @c false, otherwise
177          * @exception   E_SUCCESS               The method was successful.
178          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
179          * @exception   E_OUT_OF_MEMORY Insufficient memory.
180          */
181         result SetAllColumnsShrinkable(bool shrinkable);
182
183         /*
184          * Sets the space before the specified column index.
185          *
186          * @since               2.1
187          * @return              An error code
188          * @param[in]   columnIndex     The column index
189          * @param[in]   space           The space
190          * @exception   E_SUCCESS               The method was successful.
191          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
192          */
193         result SetColumnSpacing(int columnIndex, float space);
194
195         /**
196          * Sets the stretching ability of the specified row.
197          *
198          * @since               2.0
199          * @return              An error code
200          * @param[in]   rowIndex        The row index
201          * @param[in]   stretchable     Set to @c true to make the row as stretchable @n
202          *                                                      @c false, otherwise
203          * @exception   E_SUCCESS               The method was successful.
204          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
205          */
206         result SetRowStretchable(int rowIndex, bool stretchable);
207
208         /**
209          * Sets the shrinking ability of the specified row.
210          *
211          * @since               2.0
212          * @return              An error code
213          * @param[in]   rowIndex        The row index
214          * @param[in]   shrinkable      Set to @c true to make the row as shrinkable @n
215          *                                                      @c false, otherwise
216          * @exception   E_SUCCESS               The method was successful.
217          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
218          */
219         result SetRowShrinkable(int rowIndex, bool shrinkable);
220
221         /**
222          * Sets the collapsibility of the specified row.
223          *
224          * @since               2.0
225          * @return              An error code
226          * @param[in]   rowIndex        The row index
227          * @param[in]   collapsed       Set to @c true to make the row as collapsible @n
228          *                                                      @c false, otherwise
229          * @exception   E_SUCCESS               The method was successful.
230          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
231          */
232         result SetRowCollapsed(int rowIndex, bool collapsed);
233
234         /**
235          * Sets the stretching ability of all rows.
236          *
237          * @since               2.0
238          * @return              An error code
239          * @param[in]   stretchable     Set to @c true to set all rows as stretchable @n
240          *                                                      @c false, otherwise
241          * @exception   E_SUCCESS               The method was successful.
242          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
243          * @exception   E_OUT_OF_MEMORY Insufficient memory.
244          */
245         result SetAllRowsStretchable(bool stretchable);
246
247         /**
248          * Sets the shrinking ability of all rows.
249          *
250          * @since               2.0
251          * @return              An error code
252          * @param[in]   shrinkable      Set to @c true to set all rows as shrinkable @n
253          *                                                      @c false, otherwise
254          * @exception   E_SUCCESS               The method was successful.
255          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
256          * @exception   E_OUT_OF_MEMORY Insufficient memory.
257          */
258         result SetAllRowsShrinkable(bool shrinkable);
259
260         /*
261          * Sets the space before the specified column index.
262          *
263          * @since               2.1
264          * @return              An error code
265          * @param[in]   rowIndex        The row index
266          * @param[in]   space           The space
267          * @exception   E_SUCCESS               The method was successful.
268          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
269          */
270         result SetRowSpacing(int rowIndex, float space);
271
272         /**
273          * Adds the control at the specified position.
274          * Sets the position and span of the control.
275          *
276          * @since               2.0
277          * @return              An error code
278          * @param[in]   control         The control for which the position is set
279          * @param[in]   row                     The row index
280          * @param[in]   column          The column index
281          * @param[in]   rowSpan         The row span specifies how many cells in the row should be merged into a cell.
282          * @param[in]   columnSpan      The column span specifies how many cells in the column should be merged into a cell.
283          * @exception   E_SUCCESS               The method was successful.
284          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
285          * @exception   E_OUT_OF_RANGE  Input Argument value over the max value.
286          * @exception   E_SYSTEM                A system error occurred.
287          */
288         result SetPosition(_ControlImpl& control, int row, int column, int rowSpan, int columnSpan);
289
290         /**
291          * Gets the type of the layout.
292          *
293          * @since               2.0
294          * @return      The layout type
295          */
296         virtual LayoutType GetLayoutType(void) const;
297
298 protected:
299         /**
300          * This is the default constructor for this class.
301          *
302          * @since               2.0
303          */
304         _GridLayoutImpl(GridLayout* pPublicLayout, _Layout::TableLayout* pCoreLayout);
305
306         /**
307          * Gets the number of rows in a grid layout.
308          *
309          * @since               2.0
310          * @return              The number of rows
311          * @exception   E_SUCCESS               The method was successful.
312          * @exception   E_INVALID_STATE This instance is in an invalid state.
313          */
314         int GetRowCount(void) const;
315
316         /**
317          * Gets the number of columns in a grid layout.
318          *
319          * @since               2.0
320          * @return              The number of columns
321          * @exception   E_SUCCESS               The method was successful.
322          * @exception   E_INVALID_STATE This instance is in an invalid state.
323          */
324         int GetColumnCount(void) const;
325
326 private:
327         /**
328          * This is the copy constructor for this class.
329          *
330          * @since       2.0
331          */
332         _GridLayoutImpl(const _GridLayoutImpl&);
333
334         /**
335          * This is the substitution operator for this class.
336          *
337          * @since       2.0
338          */
339         _GridLayoutImpl& operator =(const _GridLayoutImpl&);
340
341         /**
342          * Initializes this instance of _GridLayoutImpl with the specified parameters.
343          *
344          * @since               2.0
345          * @return              An error code
346          * @param[in]   maxRow                          The max number of rows
347          * @param[in]   maxColumn                       The max number of columns
348          * @exception   E_SUCCESS                       The method was successful.
349          * @exception   E_INVALID_STATE This instance is in an invalid state.
350          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
351          * @exception   E_SYSTEM                        A system error occurred.
352          */
353         result Construct(int maxRow, int maxColumn);
354
355 private:
356         int __maxRow;
357         int __maxColumn;
358
359         friend class GridLayout;
360 }; // _GridLayoutImpl
361
362 }} // Tizen::Ui
363
364 #endif // #ifndef _FUI_INTERNAL_GRID_LAYOUT_IMPL_H