2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiCtrlGroupContainer.h
20 * @brief This is the header file for the %GroupContainer class.
22 * This header file contains the declarations of the %GroupContainer class.
24 #ifndef _FUI_CTRL_GROUP_CONTAINER_H_
25 #define _FUI_CTRL_GROUP_CONTAINER_H_
27 #include <FBaseTypes.h>
28 #include <FUiContainer.h>
30 namespace Tizen { namespace Ui { namespace Controls
33 * @class GroupContainer
34 * @brief This class defines common behavior for a %GroupContainer container.
38 * The %GroupContainer class displays child controls in grouping look. It is a concrete implementation of the Container class.
41 class _OSP_EXPORT_ GroupContainer
42 : public Tizen::Ui::Container
46 * 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.
53 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
57 virtual ~GroupContainer(void);
60 * Initializes this instance of %GroupContainer with the specified parameters.
64 * @return An error code
65 * @param[in] rect The location and size of the %GroupContainer control as an instance of Rectangle
66 * @param[in] rowCount The number of rows
67 * @param[in] columnCount The number of columns
68 * @param[in] lineWidth Width of the grid lines to draw
69 * @exception E_SUCCESS The method is successful.
70 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
71 * The width or height of @c rect or @c rowCount or @c columnnCount is negative or the value of @c lineWidth is @c 0 or negative.
72 * @exception E_OPERATION_FAILED The operation has failed.
73 * @remarks The available space for controls is less than the width or height of the container by the total width or height of the grid lines.
75 result Construct(const Tizen::Graphics::Rectangle& rect, int rowCount, int columnCount, int lineWidth = 1);
78 * Initializes this instance of %GroupContainer with the specified parameters.
82 * @return An error code
83 * @param[in] rect The location and size of the %GroupContainer control as an instance of FloatRectangle
84 * @param[in] rowCount The number of rows
85 * @param[in] columnCount The number of columns
86 * @param[in] lineWidth Width of the grid lines to draw
87 * @exception E_SUCCESS The method is successful.
88 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
89 * The width or height of @c rect or @c rowCount or @c columnnCount is negative or the value of @c lineWidth is @c 0 or negative.
90 * @exception E_OPERATION_FAILED The operation has failed.
91 * @remarks The available space for controls is less than the width or height of the container by the total width or height of the grid lines.
93 result Construct(const Tizen::Graphics::FloatRectangle& rect, int rowCount, int columnCount, float lineWidth = 1.0f);
96 * Adds a control at the specified row and column index.
100 * @return An error code
101 * @param[in] control The control to add to the container
102 * @param[in] rowIndex The row index of the cell
103 * @param[in] columnIndex The column index of the cell
104 * @exception E_SUCCESS The method is successful.
105 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
106 * @exception E_INVALID_OPERATION The specified operation is not allowed
108 * @remarks If a control is being added to the merged cells, the row index and column index of a representative cell should be given.
109 * @remarks The control to add should be allocated in heap memory, and the ownership of the control is transferred to the platform.
111 result AddControlAt(Control& control, int rowIndex, int columnIndex);
114 * Gets the control at the specified cell index in the GroupContainer.
118 * @return The control at the specified index of the list, @n
119 * else @c null if the cell index is not valid or no control is added
120 * @param[in] rowIndex The row index of the cell
121 * @param[in] columnIndex The column index of the cell
122 * @exception E_SUCCESS The method is successful.
123 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
124 * @exception E_INVALID_OPERATION The specified operation is not allowed
125 * @remarks When you get the control from the merged cell, the row index and column index of a representative cell should be given.
127 const Tizen::Ui::Control* GetControlAt(int rowIndex, int columnIndex) const;
130 * Gets the control at the specified cell index in the GroupContainer.
134 * @return The control at the specified index of the list, @n
135 * else @c null if the cell index is not valid or no control is added
136 * @param[in] rowIndex The row index of the cell
137 * @param[in] columnIndex The column index of the cell
138 * @exception E_SUCCESS The method is successful.
139 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
140 * @exception E_INVALID_OPERATION The specified operation is not allowed
141 * @remarks When you get the control from the merged cells, the row index and column index of a representative cell should be given.
143 Tizen::Ui::Control* GetControlAt(int rowIndex, int columnIndex);
146 * Removes the specified control from the specified row and column index
150 * @return An error code
151 * @param[in] rowIndex The row index of the control to remove
152 * @param[in] columnIndex The column index of the control to remove
153 * @exception E_SUCCESS The method is successful.
154 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
155 * @exception E_OPERATION_FAILED The operation has failed.
156 * @exception E_OBJ_NOT_FOUND The specified cell does not have any control.
157 * @exception E_INVALID_OPERATION The specified operation is not allowed
158 * @remarks When you remove the control from the merged cell, the row index and column index of a representative cell should be given.
159 * @remarks The removed child control is deleted from the memory. Before it is removed from the container, OnTerminating() of the child control is called.
160 * @see Tizen::Ui::Control::OnTerminating()
162 result RemoveControlAt (int rowIndex, int columnIndex);
165 * Sets the width of a column.
169 * @return An error code
170 * @param[in] columnIndex The column index
171 * @param[in] width The new width of the column
172 * @exception E_SUCCESS The method is successful.
173 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
174 * @exception E_INVALID_ARG The specified @c width must be greater than or equal to @c 0.
177 result SetColumnWidth(int columnIndex, int width);
180 * Sets the width of a column.
184 * @return An error code
185 * @param[in] columnIndex The column index
186 * @param[in] width The new width of the column
187 * @exception E_SUCCESS The method is successful.
188 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
189 * @exception E_INVALID_ARG The specified @c width must be greater than or equal to @c 0.0f.
192 result SetColumnWidth(int columnIndex, float width);
195 * Gets the width of a column.
199 * @return The width of the column
200 * @param[in] columnIndex The column index
201 * @exception E_SUCCESS The method is successful.
202 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
204 int GetColumnWidth(int columnIndex) const;
207 * Gets the width of a column.
211 * @return The width of the column
212 * @param[in] columnIndex The column index
213 * @exception E_SUCCESS The method is successful.
214 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
216 float GetColumnWidthF(int columnIndex) const;
219 * Sets the height of a row.
223 * @return An error code
224 * @param[in] rowIndex The row index
225 * @param[in] height The new height of the row
226 * @exception E_SUCCESS The method is successful.
227 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
228 * @exception E_INVALID_ARG The specified @c height must be greater than or equal to @c 0.
231 result SetRowHeight(int rowIndex, int height);
234 * Sets the height of a row.
238 * @return An error code
239 * @param[in] rowIndex The row index
240 * @param[in] height The new height of the row
241 * @exception E_SUCCESS The method is successful.
242 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
243 * @exception E_INVALID_ARG The specified @c height must be greater than or equal to @c 0.
246 result SetRowHeight(int rowIndex, float height);
249 * Gets the height of a row.
253 * @return The height of the row
254 * @param[in] rowIndex The row index
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
259 int GetRowHeight(int rowIndex) const;
262 * Gets the height of a row.
266 * @return The height of the row
267 * @param[in] rowIndex The row index
268 * @exception E_SUCCESS The method is successful.
269 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
272 float GetRowHeightF(int rowIndex) const;
275 * Merges the cells for the given row and column index.
279 * @return An error code
280 * @param[in] rowStartIndex The start index of the row from which the merge should happen
281 * @param[in] columnStartIndex The start index of the column from which the merge should happen
282 * @param[in] rowCount The number of cells to merge along the row
283 * @param[in] columnCount The number of cells to merge along the column
284 * @exception E_SUCCESS The method is successful.
285 * @exception E_OUT_OF_RANGE The specified @c rowStartIndex or @c columnStartIndex is greater than the number of elements or less than @c 0
286 * @remarks When the cells are merged, the top-left cell will play the role of representative cell on behalf of merged cells. @n
287 * To manipulate the merge cell, the row index and column index of the representative cell has to be given. Merging cells with the merged cell
288 * is allowed, but the newly merged cell should completely contain the all cells to merge.
290 result Merge(int rowStartIndex, int columnStartIndex, int rowCount, int columnCount);
293 * Enables/disables resizing of the control in a cell
297 * @return An error code
298 * @param[in] rowIndex The row index of the row in which the control should be resized
299 * @param[in] columnIndex The column index of the column in which the control should be resized
300 * @param[in] enable boolean value to enable or disable the resizing of control
301 * @exception E_SUCCESS The method is successful.
302 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
305 result SetChildResizingEnabled(int rowIndex, int columnIndex, bool enable);
308 * Sets the margin of a cell
312 * @return An error code
313 * @param[in] rowIndex The row index of the cell
314 * @param[in] columnIndex The column index of the cell
315 * @param[in] leftMargin The left margin
316 * @param[in] rightMargin The right margin
317 * @param[in] topMargin The top margin
318 * @param[in] bottomMargin The bottom margin
319 * @exception E_SUCCESS The method is successful.
320 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
321 * @exception E_INVALID_ARG The specified @c leftMargin or @c topMargin or @c rightMargin or @c bottomMargin must be greater than or equal to @c 0.
322 * @remarks The default margin value is 2.0f logical pixel.
324 result SetMargin(int rowIndex, int columnIndex, int leftMargin, int rightMargin, int topMargin, int bottomMargin);
327 * Sets the margin of a cell
331 * @return An error code
332 * @param[in] rowIndex The row index of the cell
333 * @param[in] columnIndex The column index of the cell
334 * @param[in] leftMargin The left margin
335 * @param[in] rightMargin The right margin
336 * @param[in] topMargin The top margin
337 * @param[in] bottomMargin The bottom margin
338 * @exception E_SUCCESS The method is successful.
339 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
340 * @exception E_INVALID_ARG The specified @c leftMargin or @c topMargin or @c rightMargin or @c bottomMargin must be greater than or equal to @c 0.0f.
341 * @remarks The default margin value is 2.0f logical pixel.
343 result SetMargin(int rowIndex, int columnIndex, float leftMargin, float rightMargin, float topMargin, float bottomMargin);
346 * Splits the merged cells
350 * @return An error code
351 * @param[in] rowIndex The row index of the representative cell of the merged cells
352 * @param[in] columnIndex The column index of the representative cell of the merged cells
353 * @exception E_SUCCESS The method is successful.
354 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
355 * @exception E_INVALID_ARG The specified row and column index are not those of the representative cell of the merged cells.
357 result Split(int rowIndex, int columnIndex);
360 * Gets the bounds of specified cell
364 * @return An instance of the FloatRectangle that represents the position of top-left corner,
365 * the width, and the height of the cell, @n else Rectangle(0, 0, -1, -1) if an error occurs
366 * @param[in] rowIndex The row index of the cell
367 * @param[in] columnIndex The column index of the cell
368 * @exception E_SUCCESS The method is successful.
369 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
371 Tizen::Graphics::Rectangle GetBoundsAt(int rowIndex, int columnIndex) const;
374 * Gets the bounds of specified cell
378 * @return An instance of the FloatRectangle that represents the position of top-left corner,
379 * the width, and the height of the cell, @n else Rectangle(0.0f, 0.0f, -1.0f, -1.0f) if an error occurs
380 * @param[in] rowIndex The row index of the cell
381 * @param[in] columnIndex The column index of the cell
382 * @exception E_SUCCESS The method is successful.
383 * @exception E_OUT_OF_RANGE The specified @c rowIndex or @c columnIndex is greater than the number of elements or less than @c 0.
385 Tizen::Graphics::FloatRectangle GetBoundsAtF(int rowIndex, int columnIndex) const;
388 * Enables/disables stretchable or shrinkable property of a column
392 * @return An error code
393 * @param[in] columnIndex The column index of the cell
394 * @param[in] stretchable boolean value to set stretchable or shrinkable property
395 * @exception E_SUCCESS The method is successful.
396 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
398 result SetColumnStretchable(int columnIndex, bool stretchable);
401 * Checks whether the column is stretchable or shrinkable
405 * @return @c true if the column is stretchable or shrinkable
407 * @param[in] columnIndex The column index of the cell
408 * @exception E_SUCCESS The method is successful.
409 * @exception E_OUT_OF_RANGE The specified @c columnIndex is greater than the number of elements or less than @c 0.
411 bool IsColumnStretchable(int columnIndex) const;
414 * Enables/disables stretchable or shrinkable property of a row
418 * @return An error code
419 * @param[in] rowIndex The row index of the cell
420 * @param[in] stretchable boolean value to set stretchable or shrinkable property
421 * @exception E_SUCCESS The method is successful.
422 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
424 result SetRowStretchable(int rowIndex, bool stretchable);
427 * Checks whether the row is stretchable or shrinkable
431 * @return @c true if the row is stretchable or shrinkable
433 * @param[in] rowIndex The row index of the cell
434 * @exception E_SUCCESS The method is successful.
435 * @exception E_OUT_OF_RANGE The specified @c rowIndex is greater than the number of elements or less than @c 0.
437 bool IsRowStretchable(int rowIndex) const;
440 * Gets the background color of the %GroupContainer control.
444 * @return The background color, @n
445 * else RGBA(0, 0, 0, 0) if an error occurs
447 Tizen::Graphics::Color GetBackgroundColor(void) const;
450 * Sets the background color of the %GroupContainer control.
454 * @param[in] color The background color
456 void SetBackgroundColor(const Tizen::Graphics::Color& color);
459 * Gets the row and column divider line color of the %GroupContainer control.
463 * @return The row and column divider line color, @n
464 * else RGBA(0, 0, 0, 255) if line color is not set.
466 Tizen::Graphics::Color GetLineColor(void) const;
469 * Sets the row and column divider line color of the %GroupContainer control.
473 * @param[in] color The line color
475 void SetLineColor(const Tizen::Graphics::Color& color);
479 // This method is for internal use only. Using this method can cause behavioral, security-related,
480 // and consistency-related issues in the application.
482 // Following method is reserved and may change its name at any time without
487 virtual void GroupContainer_Reserved1(void) {}
490 // This method is for internal use only. Using this method can cause behavioral, security-related,
491 // and consistency-related issues in the application.
493 // Following method is reserved and may change its name at any time without
498 virtual void GroupContainer_Reserved2(void) {}
501 // This method is for internal use only. Using this method can cause behavioral, security-related,
502 // and consistency-related issues in the application.
504 // Following method is reserved and may change its name at any time without
509 virtual void GroupContainer_Reserved3(void) {}
512 friend class _GroupContainerImpl;
515 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
519 GroupContainer(const GroupContainer& rhs);
522 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
524 GroupContainer& operator =(const GroupContainer& rhs);
528 }}} //Tizen::Ui::Controls
530 #endif // _FUI_CTRL_GROUP_CONTAINER_H_