X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Ftable-view%2Ftable-view.h;h=8af9427d965a8b2e62773dcb4f0b7413ca914782;hb=ed59234dddddba1caa4acecc638c0ad6b8a9150b;hp=4340d45fcf5610628ec8825cea5e99d6fe8753f0;hpb=2ec164cd618f93ccafe17b1d0b8ff16401ed4aef;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git
diff --git a/dali-toolkit/public-api/controls/table-view/table-view.h b/dali-toolkit/public-api/controls/table-view/table-view.h
index 4340d45..8af9427 100644
--- a/dali-toolkit/public-api/controls/table-view/table-view.h
+++ b/dali-toolkit/public-api/controls/table-view/table-view.h
@@ -2,7 +2,7 @@
#define __DALI_TOOLKIT_TABLE_VIEW_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,12 +35,53 @@ namespace Internal DALI_INTERNAL
{
class TableView;
}
+/**
+ * @addtogroup dali_toolkit_controls_table_view
+ * @{
+ */
/**
- * TableView is a layout container for aligning child actors in a grid like layout.
+ * @brief TableView is a layout container for aligning child actors in a grid like layout.
+ *
* TableView constrains the x and y position and width and height of the child actors.
* z position and depth are left intact so that 3D model actors can also be laid out
* in a grid without loosing their depth scaling.
+ *
+ * @nosubgrouping
+ *
Per-child Custom properties for script supporting:
+ *
+ * When an actor is add to the tableView through Actor::Add() instead of TableView::AddChild,
+ * the following custom properties of the actor are checked to decide the actor position inside the table.
+ *
+ * These properties are registered dynamically to the child and is non-animatable.
+ *
+ * | %Property Name | Type |
+ * |-------------------------|-------------|
+ * | cellIndex | Vector2 |
+ * | rowSpan | float |
+ * | columnSpan | float |
+ * | cellHorizontalAlignment | string |
+ * | cellVerticalAlignment | string |
+ *
+ * The rowSpan or columnSpan has integer value, but its type is float here due to the limitation of the builder's ability to differentiate integer and float from Json string.
+ * The available values for cellHorizontalAlignment are: left, center, right.
+ * The available values for cellVerticalAlignment are: top, center, bottom.
+ *
+ * @code
+ * "name":"gallery1",
+ * "type":"ImageView",
+ * "image": {
+ * "url": "{DALI_IMAGE_DIR}gallery-small-1.jpg"
+ * },
+ * "properties": {
+ * "cellIndex":[1,1], // property to specify the top-left cell this child occupies, if not set, the first available cell is used
+ * "rowSpan":3, // property to specify how many rows this child occupies, if not set, default value is 1
+ * "columnSpan": 2, // property to specify how many columns this child occupies, if nor set, default value is 1
+ * "cellHorizontalAlignment": "left", // property to specify how to align horizontally inside the cells, if not set, default value is 'left'
+ * "cellVerticalAlignment": "center" // property to specify how to align vertically inside the cells, if not set, default value is 'top'
+ * }
+ * @endcode
+ * @SINCE_1_0.0
*/
class DALI_IMPORT_API TableView : public Control
{
@@ -48,11 +89,15 @@ public:
/**
* @brief The start and end property ranges for this control.
+ * @SINCE_1_0.0
*/
enum PropertyRange
{
- PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices @SINCE_1_0.0
+
+ CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, ///< @SINCE_1_1.36
+ CHILD_PROPERTY_END_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve child property indices @SINCE_1_1.36
};
/**
@@ -61,57 +106,79 @@ public:
* LayoutRows: set the height of the rows.
* It has the format as follows in script:
* @code
- * "layout-rows":
- {
- "0": { "policy": "fixed", "value": 40 }, //@see SetFixedHight
- "2": { "policy": "relative", "value": 0.33 } //@see SetRelativeHeight
- }
+ * "layoutRows":
+ * {
+ * "0": { "policy": "fixed", "value": 40 }, //@see SetFixedHight
+ * "2": { "policy": "relative", "value": 0.33 }, //@see SetRelativeHeight
+ * "3": { "policy": "fit", "value":0.0 } //@see SetFitHeight, the value is not used, its height is decided by the children in this row
+ * }
* @endcode
*
- * LayoutColumns: set the height of the rows.
+ * LayoutColumns: set the width of the columns.
* It has the format as follows in script:
* @code
- * "layout-columns":
- {
- "0": { "policy": "fixed", "value": 40 }, //@see SetFixedWidth
- "2": { "policy": "relative", "value": 0.33 } //@see SetRelativeWidth
- }
+ * "layoutColumns":
+ * {
+ * "0": { "policy": "fixed", "value": 40 }, //@see SetFixedWidth
+ * "1": { "policy": "fit", "value":0.0 } //@see SetFitHeight, the value is not used, its width is decided by the children in this column
+ * "2": { "policy": "relative", "value": 0.33 } //@see SetRelativeWidth
+ * }
* @endcode
+ * @SINCE_1_0.0
*/
struct Property
{
enum
{
- ROWS = PROPERTY_START_INDEX, ///< name "rows", type unsigned int
- COLUMNS, ///< name "columns", type unsigned int
- CELL_PADDING, ///< name "cell-padding", type Vector2
- LAYOUT_ROWS, ///< name "layout-rows", type Map
- LAYOUT_COLUMNS, ///< name "layout-columns", type Map
+ ROWS = PROPERTY_START_INDEX, ///< name "rows", type unsigned int @SINCE_1_0.0
+ COLUMNS, ///< name "columns", type unsigned int @SINCE_1_0.0
+ CELL_PADDING, ///< name "cellPadding", type Vector2 @SINCE_1_0.0
+ LAYOUT_ROWS, ///< name "layoutRows", type Map @SINCE_1_0.0
+ LAYOUT_COLUMNS, ///< name "layoutColumns", type Map @SINCE_1_0.0
};
};
- // Custom properties for where to put the actor, these properties should be registered to the child which would be added to the table
- static const std::string CELL_INDICES_PROPERTY_NAME; ///< Property, name "cell-indices", type Vector2
- static const std::string ROW_SPAN_PROPERTY_NAME; ///< Property, name "row-span", type float (Currently builder is unable to differentiate integer and float from Json string)
- static const std::string COLUMN_SPAN_PROPERTY_NAME; ///< Property, name "column-span", type float (Currently builder is unable to differentiate integer and float from Json string)
+ /**
+ * @brief An enumeration of child properties belonging to the TableView class.
+ * @SINCE_1_1.36
+ */
+ struct ChildProperty
+ {
+ enum
+ {
+ CELL_INDEX = CHILD_PROPERTY_START_INDEX, ///< name "cellIndex", The top-left cell this child occupies, if not set, the first available cell is used, type VECTOR2 @SINCE_1_1.36
+ ROW_SPAN, ///< name "rowSpan", The number of rows this child occupies, if not set, default value is 1, type FLOAT @SINCE_1_1.36
+ COLUMN_SPAN, ///< name "columnSpan", The number of columns this child occupies, if not set, default value is 1, type FLOAT @SINCE_1_1.36
+ CELL_HORIZONTAL_ALIGNMENT, ///< name "cellHorizontalAlignment", The horizontal alignment of this child inside the cells, if not set, default value is 'left', type STRING @SINCE_1_1.36
+ CELL_VERTICAL_ALIGNMENT ///< name "cellVerticalAlignment", The vertical alignment of this child inside the cells, if not set, default value is 'top', type STRING @SINCE_1_1.36
+ };
+ };
/**
* @brief Describes how the size of a row / column been set
+ * @SINCE_1_0.0
*/
enum LayoutPolicy
{
- FIXED, ///< Fixed with the given value.
- RELATIVE, ///< Calculated as percentage of the remainder after subtracting Padding and Fixed height/width
- FILL ///< Get the remainder of the 100% (after subtracting Padding, Fixed and Relative height/ width) divided evenly between 'fill' rows/columns
+ FIXED, ///< Fixed with the given value. @SINCE_1_0.0
+ RELATIVE, ///< Calculated as percentage of the remainder after subtracting Padding and Fixed height/width @SINCE_1_0.0
+ FILL, ///< Default policy, get the remainder of the 100% (after subtracting Fixed, Fit and Relative height/ width) divided evenly between 'fill' rows/columns @SINCE_1_0.0
+ FIT ///< Fit around its children. @SINCE_1_0.0
};
/**
- * Structure to specify layout position for child actor
+ * @brief Structure to specify layout position for child actor
+ * @SINCE_1_0.0
*/
struct CellPosition
{
/**
- * Constructor to initialise values to defaults for convenience
+ * @brief Constructor to initialise values to defaults for convenience
+ * @SINCE_1_0.0
+ * @param[in] rowIndex The row index initialized
+ * @param[in] columnIndex The column index initialized
+ * @param[in] rowSpan The row span initialized
+ * @param[in] columnSpan The column span initialized
*/
CellPosition( unsigned int rowIndex = 0, unsigned int columnIndex = 0,
unsigned int rowSpan = 1, unsigned int columnSpan = 1 )
@@ -126,19 +193,24 @@ public:
};
/**
- * Create a TableView handle; this can be initialised with TableView::New()
+ * @brief Create a TableView handle; this can be initialised with TableView::New()
* Calling member functions with an uninitialised handle is not allowed.
+ * @SINCE_1_0.0
*/
TableView();
/**
- * Copy constructor. Creates another handle that points to the same real object
- * @param handle to copy from
+ * @brief Copy constructor. Creates another handle that points to the same real object
+ * @SINCE_1_0.0
+ * @param[in] handle to copy from
*/
TableView( const TableView& handle );
/**
- * Assignment operator. Changes this handle to point to another real object
+ * @brief Assignment operator. Changes this handle to point to another real object
+ * @SINCE_1_0.0
+ * @param[in] handle Handle to an object
+ * @return A reference to this
*/
TableView& operator=( const TableView& handle );
@@ -146,11 +218,13 @@ public:
* @brief Destructor
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @SINCE_1_0.0
*/
~TableView();
/**
- * Create the TableView control.
+ * @brief Create the TableView control.
+ * @SINCE_1_0.0
* @param[in] initialRows for the table
* @param[in] initialColumns for the table
* @return A handle to the TableView control.
@@ -158,42 +232,49 @@ public:
static TableView New( unsigned int initialRows, unsigned int initialColumns );
/**
- * Downcast an Object handle to TableView. If handle points to a TableView the
+ * @brief Downcast a handle to TableView handle.
+ *
+ * If handle points to a TableView the
* downcast produces valid handle. If not the returned handle is left uninitialized.
+ * @SINCE_1_0.0
* @param[in] handle Handle to an object
* @return handle to a TableView or an uninitialized handle
*/
static TableView DownCast( BaseHandle handle );
/**
- * Adds a child to the table
+ * @brief Adds a child to the table
* If the row or column index is outside the table, the table gets resized bigger
- * @pre The child actor has been initialized.
+ * @SINCE_1_0.0
* @param[in] child to add
* @param[in] position for the child
* @return true if the addition succeeded, false if the cell is already occupied
+ * @pre The child actor has been initialized.
*/
bool AddChild( Actor child, CellPosition position );
/**
- * Returns a child from the given layout position
- * Note! if there is no child in this position this method returns an uninitialized
- * Actor handle
+ * @brief Returns a child from the given layout position
+ * @SINCE_1_0.0
* @param[in] position in the table
* @return child that was in the cell or an uninitialized handle
+ * @note If there is no child in this position this method returns an uninitialized.
+ * Actor handle
*/
Actor GetChildAt( CellPosition position );
/**
- * Removes a child from the given layout position
- * Note! if there is no child in this position this method does nothing
+ * @brief Removes a child from the given layout position
+ * @SINCE_1_0.0
* @param[in] position for the child to remove
* @return child that was removed or an uninitialized handle
+ * @note If there is no child in this position this method does nothing.
*/
Actor RemoveChildAt( CellPosition position );
/**
- * Finds the childs layout position
+ * @brief Finds the childs layout position
+ * @SINCE_1_0.0
* @param[in] child to search for
* @param[out] position for the child
* @return true if the child was included in this TableView
@@ -201,72 +282,85 @@ public:
bool FindChildPosition( Actor child, CellPosition& position );
/**
- * Insert a new row to given index
+ * @brief Insert a new row to given index
+ * @SINCE_1_0.0
* @param [in] rowIndex of the new row
*/
void InsertRow( unsigned int rowIndex );
/**
- * Delete a row from given index
+ * @brief Delete a row from given index
* Removed elements are deleted
+ * @SINCE_1_0.0
* @param [in] rowIndex of the row to delete
*/
void DeleteRow( unsigned int rowIndex );
/**
- * Delete a row from given index
+ * @brief Delete a row from given index
+ * @SINCE_1_0.0
* @param [in] rowIndex of the row to delete
* @param [out] removed elements
*/
void DeleteRow( unsigned int rowIndex, std::vector& removed );
/**
- * Insert a new column to given index
+ * @brief Insert a new column to given index
+ * @SINCE_1_0.0
* @param [in] columnIndex of the new column
*/
void InsertColumn( unsigned int columnIndex );
/**
- * Delete a column from given index.
+ * @brief Delete a column from given index.
* Removed elements are deleted
+ * @SINCE_1_0.0
* @param [in] columnIndex of the column to delete
*/
void DeleteColumn( unsigned int columnIndex );
/**
- * Delete a column from given index
+ * @brief Delete a column from given index
+ * @SINCE_1_0.0
* @param [in] columnIndex of the column to delete
* @param [out] removed elements
*/
void DeleteColumn( unsigned int columnIndex, std::vector& removed );
/**
- * Resize the TableView. Note! if the new size is smaller than old,
- * superfluous actors get removed. If you want to relayout removed children,
- * use the variant that returns the removed Actors and reinsert them into the table
- * If an actor spans to a removed row or column it gets removed from the table
+ * @brief Resize the TableView.
+ * @SINCE_1_0.0
* @param[in] rows for the table
* @param[in] columns for the table
+ * @note If the new size is smaller than old,
+ * superfluous actors get removed. If you want to relayout removed children,
+ * use the variant that returns the removed Actors and reinsert them into the table.
+ * If an actor spans to a removed row or column it gets removed from the table.
*/
void Resize( unsigned int rows, unsigned int columns );
/**
- * Resize the TableView. Note! if the new size is smaller than old,
- * superfluous actors get removed.
- * If an actor spans to a removed row or column it gets removed from the table
+ * @brief Resize the TableView.
+ * @SINCE_1_0.0
* @param[in] rows for the table
* @param[in] columns for the table
* @param[out] removed actor handles
+ * @note If the new size is smaller than old,
+ * superfluous actors get removed.
+ * If an actor spans to a removed row or column it gets removed from the table.
*/
void Resize( unsigned int rows, unsigned int columns, std::vector& removed );
/**
- * Set horizontal and vertical padding between cells
+ * @brief Set horizontal and vertical padding between cells
+ * @SINCE_1_0.0
* @param[in] padding width and height
*/
void SetCellPadding( Size padding );
/**
+ * @brief Get the current padding as width and height.
+ * @SINCE_1_0.0
* @return the current padding as width and height
*/
Size GetCellPadding();
@@ -274,6 +368,7 @@ public:
/**
* @brief Specify this row as fitting its height to its children
*
+ * @SINCE_1_0.0
* @param[in] rowIndex The row to set
*/
void SetFitHeight( unsigned int rowIndex );
@@ -281,6 +376,7 @@ public:
/**
* @brief Is the row a fit row
*
+ * @SINCE_1_0.0
* @param[in] rowIndex The row to check
* @return Return true if the row is fit
*/
@@ -289,6 +385,7 @@ public:
/**
* @brief Specify this column as fitting its width to its children
*
+ * @SINCE_1_0.0
* @param[in] columnIndex The column to set
*/
void SetFitWidth( unsigned int columnIndex );
@@ -296,115 +393,142 @@ public:
/**
* @brief Is the column a fit column
*
+ * @SINCE_1_0.0
* @param[in] columnIndex The column to check
* @return Return true if the column is fit
*/
bool IsFitWidth( unsigned int columnIndex ) const;
/**
- * Sets a row to have fixed height
+ * @brief Sets a row to have fixed height
* Setting a fixed height of 0 has no effect
- * @pre The row rowIndex must exist.
+ * @SINCE_1_0.0
* @param rowIndex for row with fixed height
* @param height in world coordinate units
+ * @pre The row rowIndex must exist.
*/
void SetFixedHeight( unsigned int rowIndex, float height );
/**
- * Gets a row's fixed height.
- * Note! The returned value is valid if it has been set before.
- * @pre The row rowIndex must exist.
+ * @brief Gets a row's fixed height.
+ * @SINCE_1_0.0
+ * @param[in] rowIndex The row index with fixed height
* @return height in world coordinate units.
+ * @pre The row rowIndex must exist.
+ * @note The returned value is valid if it has been set before.
*/
float GetFixedHeight( unsigned int rowIndex ) const;
/**
- * Sets a row to have relative height. Relative height means percentage of
+ * @brief Sets a row to have relative height. Relative height means percentage of
* the remainder of the table height after subtracting Padding and Fixed height rows
* Setting a relative height of 0 has no effect
- * @pre The row rowIndex must exist.
+ * @SINCE_1_0.0
* @param rowIndex for row with relative height
* @param heightPercentage between 0.0f and 1.0f
+ * @pre The row rowIndex must exist.
*/
void SetRelativeHeight( unsigned int rowIndex, float heightPercentage );
/**
- * Gets a row's relative height.
- * Note! The returned value is valid if it has been set before.
- * @pre The row rowIndex must exist.
+ * @brief Gets a row's relative height.
+ * @SINCE_1_0.0
+ * @param[in] rowIndex The row index with relative height
* @return height in percentage units, between 0.0f and 1.0f.
+ * @pre The row rowIndex must exist.
+ * @note The returned value is valid if it has been set before.
*/
float GetRelativeHeight( unsigned int rowIndex ) const;
/**
- * Sets a column to have fixed width
+ * @brief Sets a column to have fixed width
* Setting a fixed width of 0 has no effect
- * @pre The column columnIndex must exist.
+ * @SINCE_1_0.0
* @param columnIndex for column with fixed width
* @param width in world coordinate units
+ * @pre The column columnIndex must exist.
*/
void SetFixedWidth( unsigned int columnIndex, float width );
/**
- * Gets a column's fixed width.
- * Note! The returned value is valid if it has been set before.
- * @pre The column columnIndex must exist.
+ * @brief Gets a column's fixed width.
+ * @SINCE_1_0.0
+ * @param[in] columnIndex The column index with fixed width
* @return width in world coordinate units.
+ * @pre The column columnIndex must exist.
+ * @note The returned value is valid if it has been set before.
*/
float GetFixedWidth( unsigned int columnIndex ) const;
/**
- * Sets a column to have relative width. Relative width means percentage of
+ * @brief Sets a column to have relative width. Relative width means percentage of
* the remainder of table width after subtracting Padding and Fixed width columns
* Setting a relative width of 0 has no effect
- * @pre The column columnIndex must exist.
+ * @SINCE_1_0.0
* @param columnIndex for column with fixed width
* @param widthPercentage between 0.0f and 1.0f
+ * @pre The column columnIndex must exist.
*/
void SetRelativeWidth( unsigned int columnIndex, float widthPercentage );
/**
- * Gets a column's relative width.
- * Note! The returned value is valid if it has been set before.
- * @pre The column columnIndex must exist.
+ * @brief Gets a column's relative width.
+ * @SINCE_1_0.0
+ * @param[in] columnIndex The column index with relative width
* @return width in percentage units, between 0.0f and 1.0f.
+ * @pre The column columnIndex must exist.
+ * @note The returned value is valid if it has been set before.
*/
float GetRelativeWidth( unsigned int columnIndex ) const;
/**
+ * @brief Gets the amount of rows in the table.
+ * @SINCE_1_0.0
* @return the amount of rows in the table
*/
unsigned int GetRows();
/**
+ * @brief Gets the amount of columns in the table.
+ * @SINCE_1_0.0
* @return the amount of columns in the table
*/
unsigned int GetColumns();
/**
- * @brief Set the alignment on a cell
+ * @brief Set the alignment on a cell.
+ *
+ * Cells without calling this function have the default values of LEFT and TOP respectively.
*
- * @param[in] position The cell to set alignment on
- * @param[in] horizontal The horizontal alignment
- * @param[in] vertical The vertical alignment
+ * @SINCE_1_0.0
+ * @param[in] position The cell to set alignment on.
+ * @param[in] horizontal The horizontal alignment.
+ * @param[in] vertical The vertical alignment.
*/
void SetCellAlignment( CellPosition position, HorizontalAlignment::Type horizontal, VerticalAlignment::Type vertical );
public: // Not intended for application developers
+ /// @cond internal
/**
- * Creates a handle using the Toolkit::Internal implementation.
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ * @SINCE_1_0.0
* @param[in] implementation The Control implementation.
*/
DALI_INTERNAL TableView(Internal::TableView& implementation);
/**
- * Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL TableView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
+/**
+ * @}
+ */
} // namespace Toolkit
} // namespace Dali