Name
GtkTable -- Pack widgets in regular patterns.
Synopsis
#include <gtk/gtk.h>
struct GtkTable;
struct GtkTableChild;
struct GtkTableRowCol;
GtkWidget* gtk_table_new (guint rows,
guint columns,
gboolean homogeneous);
void gtk_table_resize (GtkTable *table,
guint rows,
guint columns);
void gtk_table_attach (GtkTable *table,
GtkWidget *child,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach,
GtkAttachOptions xoptions,
GtkAttachOptions yoptions,
guint xpadding,
guint ypadding);
void gtk_table_attach_defaults (GtkTable *table,
GtkWidget *widget,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach);
void gtk_table_set_row_spacing (GtkTable *table,
guint row,
guint spacing);
void gtk_table_set_col_spacing (GtkTable *table,
guint column,
guint spacing);
void gtk_table_set_row_spacings (GtkTable *table,
guint spacing);
void gtk_table_set_col_spacings (GtkTable *table,
guint spacing);
void gtk_table_set_homogeneous (GtkTable *table,
gboolean homogeneous);
|
Details
struct GtkTable
The GtkTable structure holds the data for the actual table itself.
children is a GList of all the widgets the table contains. rows and columns are pointers to GtkTableRowCol structures, which contain the default spacing and expansion details for the GtkTable's rows and columns, respectively.
nrows and ncols are 16bit integers storing the number of rows and columns the table has.
struct GtkTableChild
struct GtkTableChild
{
GtkWidget *widget;
guint16 left_attach;
guint16 right_attach;
guint16 top_attach;
guint16 bottom_attach;
guint16 xpadding;
guint16 ypadding;
guint xexpand : 1;
guint yexpand : 1;
guint xshrink : 1;
guint yshrink : 1;
guint xfill : 1;
guint yfill : 1;
}; |
The widget field is a pointer to the widget that
this GtkTableChild structure is keeping track of.
The left_attach,
right_attach,
top_attach, and
bottom_attach fields specify the row and column
numbers which make up the invisible rectangle that the child widget is packed into.
xpadding and ypadding
specify the space between this widget and the surrounding table cells.
struct GtkTableRowCol
struct GtkTableRowCol
{
guint16 requisition;
guint16 allocation;
guint16 spacing;
guint need_expand : 1;
guint need_shrink : 1;
guint expand : 1;
guint shrink : 1;
guint empty : 1;
}; |
These fields should be considered read-only and not be modified directly.
gtk_table_new ()
Used to create a new table widget. An initial size must be given by specifying how many rows and columns the table should have, although this can be changed later with gtk_table_resize().
gtk_table_resize ()
If you need to change a table's size after it has been created, this function allows you to do so.
gtk_table_attach ()
Adds a widget to a table. 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).
gtk_table_attach_defaults ()
As there are many options associated with gtk_table_attach(), this convenience function provides the programmer with a means to add children to a table with identical padding and expansion options.
gtk_table_set_row_spacing ()
changes the space between a given table row and its surrounding rows.
gtk_table_set_col_spacing ()
alters the amount of space between a given table column and the adjacent columns.
gtk_table_set_row_spacings ()
void gtk_table_set_row_spacings (GtkTable *table,
guint spacing); |
sets the space between every row in table equal to spacing.
gtk_table_set_col_spacings ()
void gtk_table_set_col_spacings (GtkTable *table,
guint spacing); |
sets the space between every column in table equal to spacing.
gtk_table_set_homogeneous ()
changes the homogenous property of table cells. Ie. whether all cells are an equal size or not.
Properties
- "n-rows" (guint : Read / Write)
- "n-columns" (guint : Read / Write)
- "row-spacing" (guint : Read / Write)
- "column-spacing" (guint : Read / Write)
- "homogeneous" (gboolean : Read / Write)
whether each cell in the table should be the same size or not.
See Also
- GtkVBox
For packing widgets vertically only.
- GtkHBox
For packing widgets horizontally only.