|
Etk_Table
Detailed Description
The Etk_Table widget is a container that can contain several children aligned on a grid.
To create a table, you have to call etk_table_new(). It requires the number of columns and rows of the table, and also the homogeneous property of the table. A table can be homogeneous horizontally, vertically, in both directions or not at all. If a table is homogeneous in a direction, it means that all its cells will have the same size in this direction. For example, ETK_TABLE_VHOMOGENEOUS would mean that all the cells of the table have the same height.
To pack a widget into the table, you have to call etk_table_attach(). It takes four attach-points that indicates where the widget should be packed (one attach-point for each side of the widget: left, right, top, bottom). For example, to attach a widget in the cell (2, 1), you'll have to call etk_table_attach(table, widget, 2, 2, 1, 1, ...). To make the widget span three columns (from column 2 to column 4), you'll have to call etk_table_attach(table, widget, 2, 4, 1, 1, ...).
A table can also be resized with etk_table_resize().
- Object Hierarchy:
-
- Properties:
- "num-cols": The number of columns of the table
Type: IntegerAccess: Read/WriteDefault Value: 0
- "num-rows": The number of rows of the table
Type: IntegerAccess: Read/WriteDefault Value: 0
- "homogeneous": A flag describing whether the table is homogenous horizontally, vertically, in both directions or not at all
Type: Integer (Etk_Table_Homogeneous)Access: Read/WriteDefault Value: ETK_TABLE_NOT_HOMOGENEOUS
|
Data Structures |
struct | Etk_Table |
| [Widget] a container that can contain several children aligned on a grid More...
|
Defines |
#define | ETK_TABLE_TYPE (etk_table_type_get()) |
#define | ETK_TABLE(obj) (ETK_OBJECT_CAST((obj), ETK_TABLE_TYPE, Etk_Table)) |
#define | ETK_IS_TABLE(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_TABLE_TYPE)) |
Enumerations |
enum | Etk_Table_Homogeneous {
ETK_TABLE_NOT_HOMOGENEOUS = 0,
ETK_TABLE_HHOMOGENEOUS = 1 << 0,
ETK_TABLE_VHOMOGENEOUS = 1 << 1,
ETK_TABLE_HOMOGENEOUS = ETK_TABLE_HHOMOGENEOUS | ETK_TABLE_VHOMOGENEOUS
} |
| Describes whether the table should be homogenous horizontally, vertically, in both directions or not at all. More...
|
enum | Etk_Table_Fill_Policy {
ETK_TABLE_NONE = 0,
ETK_TABLE_HFILL = 1 << 0,
ETK_TABLE_VFILL = 1 << 1,
ETK_TABLE_HEXPAND = 1 << 2,
ETK_TABLE_VEXPAND = 1 << 3,
ETK_TABLE_FILL = ETK_TABLE_HFILL | ETK_TABLE_VFILL,
ETK_TABLE_EXPAND = ETK_TABLE_HEXPAND | ETK_TABLE_VEXPAND,
ETK_TABLE_EXPAND_FILL = ETK_TABLE_EXPAND | ETK_TABLE_FILL
} |
| Describes how a child of the table should fill and expand the space allocated for it. More...
|
Functions |
Etk_Widget * | etk_table_new (int num_cols, int num_rows, Etk_Table_Homogeneous homogeneous) |
| Creates a new table.
|
void | etk_table_cell_clear (Etk_Table *table, int col, int row) |
| Clears the cell ( col, row ): it removes from the table the widget that is in this cell.
|
void | etk_table_resize (Etk_Table *table, int num_cols, int num_rows) |
| Resizes the table. The children that are attached to a row or a column that is removed will be unparented.
|
void | etk_table_attach (Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach, Etk_Table_Fill_Policy fill_policy, int x_padding, int y_padding) |
| Attachs a widget to the table.
|
void | etk_table_attach_default (Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach) |
| Same as etk_table_attach() but with default settings: padding is set to 0 and the fill policy is ETK_TABLE_EXPAND_FILL.
|
void | etk_table_homogeneous_set (Etk_Table *table, Etk_Table_Homogeneous homogeneous) |
| Changes the homogenous property of the table.
|
Etk_Table_Homogeneous | etk_table_homogeneous_get (Etk_Table *table) |
| Gets whether the table is homogenous horizontally, vertically, in both directions or not at all.
|
void | etk_table_child_position_get (Etk_Table *table, Etk_Widget *child, int *left_attach, int *right_attach, int *top_attach, int *bottom_attach) |
| Gets the col and row of the given child.
|
Define Documentation
#define ETK_TABLE_TYPE (etk_table_type_get()) |
#define ETK_TABLE |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_TABLE_TYPE, Etk_Table)) |
#define ETK_IS_TABLE |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_TABLE_TYPE)) |
Enumeration Type Documentation
Describes whether the table should be homogenous horizontally, vertically, in both directions or not at all.
- Enumerator:
-
ETK_TABLE_NOT_HOMOGENEOUS |
The table is not homogeneous: its cells could have different size |
ETK_TABLE_HHOMOGENEOUS |
The table is homogeneous horizontally. all its cells have the same width |
ETK_TABLE_VHOMOGENEOUS |
The table is homogeneous vertically. all its cells have the same height |
ETK_TABLE_HOMOGENEOUS |
Equivalent to ETK_TABLE_HHOMOGENEOUS | ETK_TABLE_VHOMOGENEOUS |
Describes how a child of the table should fill and expand the space allocated for it.
- Enumerator:
-
ETK_TABLE_NONE |
The child doesn't fill or expand |
ETK_TABLE_HFILL |
The child fills all the horizontal space allocated to it |
ETK_TABLE_VFILL |
The child fills all the vertical space allocated to it |
ETK_TABLE_HEXPAND |
The cell containing the child will expand horizontally |
ETK_TABLE_VEXPAND |
The cell containing the child will expand vertically |
ETK_TABLE_FILL |
Equivalent to ETK_TABLE_HFILL | ETK_TABLE_VFILL |
ETK_TABLE_EXPAND |
Equivalent to ETK_TABLE_HEXPAND | ETK_TABLE_VEXPAND |
ETK_TABLE_EXPAND_FILL |
Equivalent to ETK_TABLE_EXPAND | ETK_TABLE_FILL |
Function Documentation
Creates a new table.
- Parameters:
-
| num_cols | the number of columns of the new table |
| num_rows | the number of rows of the new table |
| homogeneous | a flag describing whether the table should be homogenous horizontally, vertically, in both directions or not at all |
- Returns:
- Returns the new table
void etk_table_cell_clear |
( |
Etk_Table * |
table, |
|
|
int |
col, |
|
|
int |
row | |
|
) |
| | |
Clears the cell ( col, row ): it removes from the table the widget that is in this cell.
- Parameters:
-
| table | a table |
| col | the column in which the widget to remove is (starting from 0) |
| row | the row in which the widget to remove is (starting from 0) |
void etk_table_resize |
( |
Etk_Table * |
table, |
|
|
int |
num_cols, |
|
|
int |
num_rows | |
|
) |
| | |
Resizes the table. The children that are attached to a row or a column that is removed will be unparented.
- Parameters:
-
| table | a table |
| num_rows | the new number of rows |
| num_cols | the new number of cols |
Attachs a widget to the table.
- Parameters:
-
| table | a table |
| child | the widget to attach |
| left_attach | the column where the left side of the child will be attached (starting from 0) |
| right_attach | the column where the right side of the child will be attached (starting from 0) |
| top_attach | the row where the top side of the child will be attached (starting from 0) |
| bottom_attach | the row where the bottom side of the child will be attached (starting from 0) |
| fill_policy | The fill policy of the child |
| x_padding | the amount of free space on the left and on the right sides of the child widget |
| y_padding | the amount of free space on the top and on the bottom sides of the child widget |
void etk_table_attach_default |
( |
Etk_Table * |
table, |
|
|
Etk_Widget * |
child, |
|
|
int |
left_attach, |
|
|
int |
right_attach, |
|
|
int |
top_attach, |
|
|
int |
bottom_attach | |
|
) |
| | |
Same as etk_table_attach() but with default settings: padding is set to 0 and the fill policy is ETK_TABLE_EXPAND_FILL.
- Parameters:
-
| table | a table |
| child | the widget to attach |
| left_attach | the column where the left side of the child will be attached (starting from 0) |
| right_attach | the column where the right side of the child will be attached (starting from 0) |
| top_attach | the row where the top side of the child will be attached (starting from 0) |
| bottom_attach | the row where the bottom side of the child will be attached (starting from 0) |
Changes the homogenous property of the table.
- Parameters:
-
| table | a table |
| homogeneous | a flag describing whether the table should be homogenous horizontally, vertically, in both directions or not at all |
Gets whether the table is homogenous horizontally, vertically, in both directions or not at all.
- Parameters:
-
- Returns:
- Returns the homogenous property of the table
void etk_table_child_position_get |
( |
Etk_Table * |
table, |
|
|
Etk_Widget * |
child, |
|
|
int * |
left_attach, |
|
|
int * |
right_attach, |
|
|
int * |
top_attach, |
|
|
int * |
bottom_attach | |
|
) |
| | |
Gets the col and row of the given child.
- Parameters:
-
| table | a table |
| left_attach | the variable to store the left_attach |
| right_attach | the variable to store the right_attach |
| top_attach | the variable to store the top_attach |
| bottom_attach | the variable to store the bottom_attach |
|
|