| GTK+ 3 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <gtk/gtk.h> struct GtkGrid; GtkWidget * gtk_grid_new (void); void gtk_grid_attach (GtkGrid *grid,GtkWidget *child,gint left,gint top,gint width,gint height); void gtk_grid_attach_next_to (GtkGrid *grid,GtkWidget *child,GtkWidget *sibling,GtkPositionType side,gint width,gint height); void gtk_grid_set_row_homogeneous (GtkGrid *grid,gboolean homogeneous); gboolean gtk_grid_get_row_homogeneous (GtkGrid *grid); void gtk_grid_set_row_spacing (GtkGrid *grid,guint spacing); guint gtk_grid_get_row_spacing (GtkGrid *grid); void gtk_grid_set_column_homogeneous (GtkGrid *grid,gboolean homogeneous); gboolean gtk_grid_get_column_homogeneous (GtkGrid *grid); void gtk_grid_set_column_spacing (GtkGrid *grid,guint spacing); guint gtk_grid_get_column_spacing (GtkGrid *grid);
GtkGrid is a container which arranges its child widgets in rows and columns. It is a very similar to GtkTable and GtkBox, but it consistently uses GtkWidget's "margin" and "expand" properties instead of custom child properties, and it fully supports height-for-width geometry management.
Children are added using gtk_grid_attach(). They can span multiple
rows or columns. It is also possible to add a child next to an
existing child, using gtk_grid_attach_next_to().
GtkGrid can be used like a GtkBox by just using gtk_container_add(),
which will place children next to each other in the direction determined
by the "orientation" property.
GtkWidget * gtk_grid_new (void);
Creates a new grid widget.
Returns : |
the new GtkGrid |
void gtk_grid_attach (GtkGrid *grid,GtkWidget *child,gint left,gint top,gint width,gint height);
Adds a widget to the grid.
The position of child is determined by left and top. The
number of 'cells' that child will occupy is determined by
width and height.
|
a GtkGrid |
|
the widget to add |
|
the column number to attach the left side of child to |
|
the row number to attach the top side of child to |
|
the number of columns that child will span |
|
the number of rows that child will span |
void gtk_grid_attach_next_to (GtkGrid *grid,GtkWidget *child,GtkWidget *sibling,GtkPositionType side,gint width,gint height);
Adds a widget to the grid.
The widget is placed next to sibling, on the side determined by
side.
|
a GtkGrid |
|
the widget to add |
|
the child of grid that child will be placed next to |
|
the side of sibling that child is positioned next to |
|
the number of columns that child will span |
|
the number of rows that child will span |
void gtk_grid_set_row_homogeneous (GtkGrid *grid,gboolean homogeneous);
Sets whether all rows of grid will have the same height.
gboolean gtk_grid_get_row_homogeneous (GtkGrid *grid);
Returns whether all rows of grid have the same height.
|
a GtkGrid |
Returns : |
whether all rows of grid have the same height. |
void gtk_grid_set_row_spacing (GtkGrid *grid,guint spacing);
Sets the amount of space between rows of grid.
|
a GtkGrid |
|
the amount of space to insert between rows |
guint gtk_grid_get_row_spacing (GtkGrid *grid);
Returns the amount of space between the rows of grid.
|
a GtkGrid |
Returns : |
the row spacing of grid
|
void gtk_grid_set_column_homogeneous (GtkGrid *grid,gboolean homogeneous);
Sets whether all columns of grid will have the same width.
gboolean gtk_grid_get_column_homogeneous (GtkGrid *grid);
Returns whether all columns of grid have the same width.
|
a GtkGrid |
Returns : |
whether all columns of grid have the same width. |
void gtk_grid_set_column_spacing (GtkGrid *grid,guint spacing);
Sets the amount of space between columns of grid.
|
a GtkGrid |
|
the amount of space to insert between columns |