Pack widgets in regular patterns
Class GtkTable( [rows],[columns],[homogeneous] )
rows | The number of rows the new table should have (default 0). |
columns | The number of columns the new table should have (default 0). |
homogeneous | (default false) If set to true, all table cells are resized to the size of the cell containing the largest widget. |
The GtkTable functions allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.
Widgets can be added to a table using attach() or the more convenient (but slightly less flexible) attach_defaults().
To alter the space next to a specific row, use set_row_spacing(), and for a column, set_col_spacing().
The gaps between all rows or columns can be changed by calling set_row_spacings() or set_col_spacings() respectively.
set_homogeneous(), can be used to set whether all cells in the table will resize themselves to the size of the largest widget in the table.
Methods | |
attach | Adds a widget to a table. |
attach_defaults | Adds a widget to a table. |
get_col_spacing | Gets the amount of space between column col, and column col + 1. |
get_default_col_spacing | Gets the default column spacing for the table. |
get_default_row_spacing | Gets the default row spacing for the table. This is the spacing that will be used for newly added rows. |
get_homogeneous | Returns whether the table cells are all constrained to the same width and height. |
get_row_spacing | Gets the amount of space between row row, and row row + 1. |
resize | Resizes the table. |
set_col_spacing | Alters the amount of space between a given table column and the following column. |
set_col_spacings | Sets the space between every column in table equal to spacing. |
set_homogeneous | Changes the homogenous property of table cells, ie. whether all cells are an equal size or not. |
set_row_spacing | Changes the space between a given table row and the subsequent row. |
set_row_spacings | Sets the space between every row in table equal to spacing. |
Adds a widget to a table.
GtkTable.attach( child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding )
child | The widget to add. |
left_attach | the column number to attach the left side of a child widget to. |
right_attach | the column number to attach the right side of a child widget to. |
top_attach | the row number to attach the top of a child widget to. |
bottom_attach | the row number to attach the bottom of a child widget to. |
xoptions | (GtkAttachOptions) Used to specify the properties of the child widget when the table is resized. |
yoptions | (GtkAttachOptions) The same as xoptions, except this field determines behaviour of vertical resizing. |
xpadding | An integer value specifying the padding on the left and right of the widget being added to the table. |
ypadding | The amount of padding above and below the child widget. |
The number of 'cells' that a widget will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lowest column and row numbers of the table. (Columns and rows are indexed from zero).
Adds a widget to a table.
GtkTable.attach_defaults( child, left_attach, right_attach, top_attach, bottom_attach )
child | The widget to add. |
left_attach | the column number to attach the left side of a child widget to. |
right_attach | the column number to attach the right side of a child widget to. |
top_attach | the row number to attach the top of a child widget to. |
bottom_attach | the row number to attach the bottom of a child widget to. |
As there are many options associated with attach(), this convenience function provides the programmer with a means to add children to a table with identical padding and expansion options. The values used for the GtkAttachOptions are GTK_EXPAND | GTK_FILL, and the padding is set to 0.
Gets the amount of space between column col, and column col + 1.
GtkTable.get_col_spacing( column )
column | a column in the table, 0 indicates the first column |
Return | the column spacing |
Gets the default column spacing for the table.
GtkTable.get_default_col_spacing()
Return | the default column spacing |
This is the spacing that will be used for newly added columns.
Gets the default row spacing for the table. This is the spacing that will be used for newly added rows.
GtkTable.get_default_row_spacing()
Return | the default row spacing |
Returns whether the table cells are all constrained to the same width and height.
GtkTable.get_homogeneous()
Return | (boolean) true if the cells are all constrained to the same size |
Gets the amount of space between row row, and row row + 1.
GtkTable.get_row_spacing( row )
row | a row in the table, 0 indicates the first row |
Return | the row spacing |
Resizes the table.
GtkTable.resize( rows, columns )
rows | The new number of rows. |
columns | The new number of columns. |
If you need to change a table's size after it has been created, this function allows you to do so.
Alters the amount of space between a given table column and the following column.
GtkTable.set_col_spacing( column, spacing )
column | the column whose spacing should be changed. |
spacing | number of pixels that the spacing should take up. |
Sets the space between every column in table equal to spacing.
GtkTable.set_col_spacings( spacing )
spacing | the number of pixels of space to place between every column in the table. |
Changes the homogenous property of table cells, ie. whether all cells are an equal size or not.
GtkTable.set_homogeneous( homogeneous )
homogeneous | Set to true to ensure all table cells are the same size. Set to false if this is not your desired behaviour. |
Changes the space between a given table row and the subsequent row.
GtkTable.set_row_spacing( row, spacing )
row | row number whose spacing will be changed. |
spacing | number of pixels that the spacing should take up. |
Sets the space between every row in table equal to spacing.
GtkTable.set_row_spacings( spacing )
spacing | the number of pixels of space to place between every row in the table. |