Gtk-- Reference: Gtk::Table

Class Index | Cross Index | Namespace Index

# Class Gtk::Table

Table Packing Widget
Contained in: Gtk
Derived from: Gtk::Container
Derived by: none

#include <gtk--/table.h>

### public function member index:
``explicit`` | `Table` | `(`gint` `rows`=1, `gint` `columns`=1, `gint` `homogeneous`=FALSE)`;
``void`` | `attach` | `(`Widget`& `child`, `guint` `left_attach`, `guint` `right_attach`, `guint` `top_attach`, `guint` `bottom_attach`, `gint` `xoptions`=(GTK_FILL|GTK_EXPAND), `gint` `yoptions`=(GTK_FILL|GTK_EXPAND), `guint` `xpadding`=0, `guint` `ypadding`=0)`;
`TableList&` | `children` | `()`;
``const` TableList&` | `children` | `() `const``;
``GtkTable`*` | `gtkobj` | `()`;
``const` `GtkTable`*` | `gtkobj` | `() `const``;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``void`` | `resize` | `(`guint` `rows`, `guint` `columns`)`;
``void`` | `set_col_spacing` | `(`gint` `column`, `gint` `spacing`)`;
``void`` | `set_col_spacings` | `(`gint` `spacing`)`;
``void`` | `set_homogeneous` | `(`bool` `homogeneous`)`;
``void`` | `set_row_spacing` | `(`gint` `row`, `gint` `spacing`)`;
``void`` | `set_row_spacings` | `(`gint` `spacing`)`;
``void`` | `set_spacings` | `(`gint` `spacing`)`;
``virtual`` | `~Table` | `()`;

## Description:

`Gtk::Table` is one of the primary methods for construction of grouped widgets. It consists of a set of lattice points to to which widgets can be attached. There are (rows+1) lattice points vertically and (columns+1) lattice points horizontally. Lattice points start counting from 0. Lattice points can either be specified to be ``homogeneous`` meaning equally spaced or not ``homogeneous`` meaning each cell should be calculated based on the widgets contained in the row and column. Homogeneous defaults to FALSE.

Widgets can be attached to the table at by specifying the top, bottom, left and right points corresponding to upper, lefthand lattice point and the lower, righthand lattice point with the widget should span. Widgets can either be contained in a cell or may span cells. A number of options control the resizing behavior of widgets contained in the table.

Packing options:

There are a number of packing objections that can be specified when adding a widget. With `GTK_EXPAND`, the lattice is allowed to grow to fill space. With `GTK_SHRINK`, the lattice is allowed to shrink when resized. It is also possible to specify the behaviour of the widgets allocation within the table. The flag `GTK_FILL` declares the widget should grow to fill lattice. If this is not set any extra space is used as padding. The default is `GTK_FILL` and `GTK_EXPAND`.

The table size is calculated based on the size of the widgets contained within and the restrictions imposed by specified options.

Padding and spacing can be use in the table. Padding is added on either side of a widget, while spacing is placed between widgets.

The other generic packing widgets are: ``Gtk`::`Box``, ``Gtk`::`HBox``, ``Gtk`::`VBox``

## Function Member Descriptions:

Gtk::Table::attach - Binds a widget to a set of lattice points.

``void`` `attach``(`Widget`& `child`, `guint` `left_attach`, `guint` `right_attach`, `guint` `top_attach`, `guint` `bottom_attach`, `gint` `xoptions`=(GTK_FILL|GTK_EXPAND), `gint` `yoptions`=(GTK_FILL|GTK_EXPAND), `guint` `xpadding`=0, `guint` `ypadding`=0)`;

> At minumum specification of the lattice points is required. Additionally, the cell options as described above and paddings may be specified. Default paddings are 0 pixels in both dimensions.

Gtk::Table::gtkobj - Returns the underlaying gtk+ object.

``GtkTable`*` `gtkobj``()`;
Gtk::Table::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::Table::resize - (Gtk 1.1) This function allows for dynamic resizing of a Table.

``void`` `resize``(`guint` `rows`, `guint` `columns`)`;
Gtk::Table::set_col_spacings - This function sets the number of pixels to a appear between every column of cells. Default is 0 pixels.

``void`` `set_col_spacings``(`gint` `spacing`)`;
Gtk::Table::set_row_spacing - This function sets the number of pixels to appear between one row of cells and the next.

``void`` `set_row_spacing``(`gint` `row`, `gint` `spacing`)`;

> `row` is the lattice row counted without the edges starting from 0. Therefore, row 0 would denote between the first and second row of cells. row has a range from 0 and (rows-2) Default spacing is 0 pixels.

Gtk::Table::set_row_spacings - This function sets the number of pixels to a appear between every row of cells. Default is 0 pixels.

``void`` `set_row_spacings``(`gint` `spacing`)`;