gtkmm: Gtk::Table Class Reference

gtkmm 3.1.90

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Related Functions

# Gtk::Table Class Reference
Widgets | Container Widgets

Pack widgets in regular patterns. More...

Inheritance diagram for Gtk::Table:
[legend]
Collaboration diagram for Gtk::Table:
[legend]

List of all members.

## Public Member Functions
virtual | ~Table ()
GtkTable* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkTable* | gobj () const
| Provides access to the underlying C GtkObject.
| Table (guint n_rows=1, guint n_columns=1, bool homogeneous=false)
void | attach (Widget& child, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, AttachOptions xoptions=FILL|EXPAND, AttachOptions yoptions=FILL|EXPAND, guint xpadding=0, guint ypadding=0)
| Adds a widget to a table.
void | resize (guint rows, guint columns)
| If you need to change a table's size after it has been created, this function allows you to do so.
void | set_row_spacing (guint row, guint spacing)
| Changes the space between a given table row and the subsequent row.
guint | get_row_spacing (guint row) const
| Gets the amount of space between row row, and row row + 1.
void | set_col_spacing (guint column, guint spacing)
| Alters the amount of space between a given table column and the following column.
guint | get_col_spacing (guint column) const
| Gets the amount of space between column col, and column col + 1.
void | set_row_spacings (guint spacing)
| Sets the space between every row in table equal to spacing.
void | set_col_spacings (guint spacing)
| Sets the space between every column in table equal to spacing.
void | set_spacings (guint spacing)
guint | get_default_row_spacing ()
| Gets the default row spacing for the table.
guint | get_default_col_spacing ()
| Gets the default column spacing for the table.
void | set_homogeneous (bool homogeneous=true)
| Changes the homogenous property of table cells, ie.
bool | get_homogeneous () const
| Returns whether the table cells are all constrained to the same width and height.
void | get_size (guint& rows, guint& columns) const
| Gets the number of rows and columns in the table.
Glib::PropertyProxy< guint > | property_n_rows ()
| The number of rows in the table.
Glib::PropertyProxy_ReadOnly < guint > | property_n_rows () const
| The number of rows in the table.
Glib::PropertyProxy< guint > | property_n_columns ()
| The number of columns in the table.
Glib::PropertyProxy_ReadOnly < guint > | property_n_columns () const
| The number of columns in the table.
Glib::PropertyProxy< guint > | property_column_spacing ()
| The amount of space between two consecutive columns.
Glib::PropertyProxy_ReadOnly < guint > | property_column_spacing () const
| The amount of space between two consecutive columns.
Glib::PropertyProxy< guint > | property_row_spacing ()
| The amount of space between two consecutive rows.
Glib::PropertyProxy_ReadOnly < guint > | property_row_spacing () const
| The amount of space between two consecutive rows.
Glib::PropertyProxy< bool > | property_homogeneous ()
| If TRUE, the table cells are all the same width/height.
Glib::PropertyProxy_ReadOnly < bool > | property_homogeneous () const
| If TRUE, the table cells are all the same width/height.
## Related Functions
(Note that these are not member functions.)
Gtk::Table* | wrap (GtkTable* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Pack widgets in regular patterns.

Gtk::Table is one of the primary ways of grouping widgets together. 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. The homogeneous property defaults to false.

Widgets can be attached to the table by specifying the top, bottom, left and right points corresponding to upper, lefthand lattice point and the lower, righthand lattice point which 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 options 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 | Gtk::EXPAND)`.

Table sizing:
  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 used in the table. Padding is added on either side of a widget, while spacing is placed between widgets.

A Table widget looks like this:

See also:
  Gtk::HBox, Gtk::VBox

## Constructor & Destructor Documentation

virtual Gtk::Table::~Table | ( |  | ) | `[virtual]`

Gtk::Table::Table | ( | guint | n_rows = `1`,
|  | guint | n_columns = `1`,
|  | bool | homogeneous = `false`
| ) |  | `[explicit]`

## Member Function Documentation

void Gtk::Table::attach | ( | Widget& | child,
|  | guint | left_attach,
|  | guint | right_attach,
|  | guint | top_attach,
|  | guint | bottom_attach,
|  | AttachOptions | xoptions = `FILL|EXPAND`,
|  | AttachOptions | yoptions = `FILL|EXPAND`,
|  | guint | xpadding = `0`,
|  | guint | ypadding = `0`
| ) |  |

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).

To make a button occupy the lower right cell of a 2x2 table, use

     gtk_table_attach (table, button,
     1, 2, // left, right attach
     1, 2, // top, bottom attach
     xoptions, yoptions,
     xpadding, ypadding);

If you want to make the button span the entire bottom row, use left_attach == 0 and right_attach = 2 instead.

Parameters:

  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 | Used to specify the properties of the child widget when the table is resized.
  yoptions | 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.

guint Gtk::Table::get_col_spacing | ( | guint | column | ) | const

Gets the amount of space between column col, and column col + 1.

See set_col_spacing().

Parameters:

  column | A column in the table, 0 indicates the first column.

Returns:
  The column spacing.

guint Gtk::Table::get_default_col_spacing | ( |  | ) |

Gets the default column spacing for the table.

This is the spacing that will be used for newly added columns. (See set_col_spacings())

Returns:
  The default column spacing.

guint Gtk::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. (See set_row_spacings())

Returns:
  The default row spacing.

bool Gtk::Table::get_homogeneous | ( |  | ) | const

Returns whether the table cells are all constrained to the same width and height.

(See set_homogenous())

Returns:
  `true` if the cells are all constrained to the same size.

guint Gtk::Table::get_row_spacing | ( | guint | row | ) | const

Gets the amount of space between row row, and row row + 1.

See set_row_spacing().

Parameters:

  row | A row in the table, 0 indicates the first row.

Returns:
  The row spacing.

void Gtk::Table::get_size | ( | guint & | rows,
|  | guint & | columns
| ) |  | const

Gets the number of rows and columns in the table.

Since gtkmm 2.22:

Parameters:

  rows | Return location for the number of rows, or `0`.
  columns | Return location for the number of columns, or `0`.

const GtkTable* Gtk::Table::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

GtkTable* Gtk::Table::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

Glib::PropertyProxy<guint> Gtk::Table::property_column_spacing | ( |  | ) |

The amount of space between two consecutive columns.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Table::property_column_spacing | ( |  | ) | const

The amount of space between two consecutive columns.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Table::property_homogeneous | ( |  | ) | const

If TRUE, the table cells are all the same width/height.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Table::property_homogeneous | ( |  | ) |

If TRUE, the table cells are all the same width/height.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<guint> Gtk::Table::property_n_columns | ( |  | ) |

The number of columns in the table.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Table::property_n_columns | ( |  | ) | const

The number of columns in the table.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<guint> Gtk::Table::property_n_rows | ( |  | ) |

The number of rows in the table.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Table::property_n_rows | ( |  | ) | const

The number of rows in the table.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<guint> Gtk::Table::property_row_spacing | ( |  | ) |

The amount of space between two consecutive rows.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Table::property_row_spacing | ( |  | ) | const

The amount of space between two consecutive rows.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Table::resize | ( | guint | rows,
|  | guint | columns
| ) |  |

If you need to change a table's size after it has been created, this function allows you to do so.

Parameters:

  rows | The new number of rows.
  columns | The new number of columns.

void Gtk::Table::set_col_spacing | ( | guint | column,
|  | guint | spacing
| ) |  |

Alters the amount of space between a given table column and the following column.

Parameters:

  column | The column whose spacing should be changed.
  spacing | Number of pixels that the spacing should take up.

void Gtk::Table::set_col_spacings | ( | guint | spacing | ) |

Sets the space between every column in table equal to spacing.

Parameters:

  spacing | The number of pixels of space to place between every column in the table.

void Gtk::Table::set_homogeneous | ( | bool | homogeneous = `true` | ) |

Changes the homogenous property of table cells, ie.

whether all cells are an equal size or not.

Parameters:

  homogeneous | Set to `true` to ensure all table cells are the same size. Set to `false` if this is not your desired behaviour.

void Gtk::Table::set_row_spacing | ( | guint | row,
|  | guint | spacing
| ) |  |

Changes the space between a given table row and the subsequent row.

Parameters:

  row | Row number whose spacing will be changed.
  spacing | Number of pixels that the spacing should take up.

void Gtk::Table::set_row_spacings | ( | guint | spacing | ) |

Sets the space between every row in table equal to spacing.

Parameters:

  spacing | The number of pixels of space to place between every row in the table.

void Gtk::Table::set_spacings | ( | guint | spacing | ) |

## Friends And Related Function Documentation

Gtk::Table* wrap | ( | GtkTable * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/table.h