gtkmm: Gtk::Grid Class Reference

gtkmm 3.4.0

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

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

Public Member Functions | Related Functions
Gtk::Grid Class Reference
Widgets | Container Widgets

A container which arranges its child widgets in rows and columns. More...

Inheritance diagram for Gtk::Grid:
[legend]

List of all members.

## Public Member Functions
virtual | ~Grid ()
GtkGrid* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkGrid* | gobj () const
| Provides access to the underlying C GtkObject.
| Grid ()
void | attach (Widget& child, int left, int top, int width, int height)
| Adds a widget to the grid.
void | attach_next_to (Widget& child, Widget& sibling, PositionType side, int width, int height)
| Adds a widget to the grid.
Widget* | get_child_at (int left, int top)
| Gets the child of grid whose area covers the grid cell whose upper left corner is at left, top.
const Widget* | get_child_at (int left, int top) const
| Gets the child of grid whose area covers the grid cell whose upper left corner is at left, top.
void | insert_row (int position)
| Inserts a row at the specified position.
void | insert_column (int position)
| Inserts a column at the specified position.
void | insert_next_to (Widget& sibling, PositionType side)
| Inserts a row or column at the specified position.
void | set_row_homogeneous (bool homogeneous=true)
| Sets whether all rows of grid will have the same height.
bool | get_row_homogeneous () const
| Returns whether all rows of grid have the same height.
void | set_row_spacing (guint spacing)
| Sets the amount of space between rows of grid.
guint | get_row_spacing () const
| Returns the amount of space between the rows of grid.
void | set_column_homogeneous (bool homogeneous)
| Sets whether all columns of grid will have the same width.
bool | get_column_homogeneous () const
| Returns whether all columns of grid have the same width.
void | set_column_spacing (guint spacing)
| Sets the amount of space between columns of grid.
guint | get_column_spacing () const
| Returns the amount of space between the columns of grid.
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< 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< bool > | property_row_homogeneous ()
| If TRUE, the rows are all the same height.
Glib::PropertyProxy_ReadOnly < bool > | property_row_homogeneous () const
| If TRUE, the rows are all the same height.
Glib::PropertyProxy< bool > | property_column_homogeneous ()
| If TRUE, the columns are all the same width.
Glib::PropertyProxy_ReadOnly < bool > | property_column_homogeneous () const
| If TRUE, the columns are all the same width.
## Related Functions
(Note that these are not member functions.)
Gtk::Grid* | wrap (GtkGrid* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A container which arranges its child widgets in rows and columns.

It is a very similar to Table and Box, but it consistently uses Widget's margin and expand properties instead of custom child properties, and it fully supports height-for-width geometry management.

Children are added using attach(). They can span multiple rows or columns. It is also possible to add a child next to an existing child, using attach_next_to().

Grid can be used like a Box by just using Gtk::Container::add(), which will place children next to each other in the direction determined by the orientation property.

Since gtkmm 3.0:

## Constructor & Destructor Documentation

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

Gtk::Grid::Grid | ( |  | ) |

## Member Function Documentation

void Gtk::Grid::attach | ( | Widget& | child,
|  | int | left,
|  | int | top,
|  | int | width,
|  | int | 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.

Parameters:

  child | The widget to add.
  left | The column number to attach the left side of child to.
  top | The row number to attach the top side of child to.
  width | The number of columns that child will span.
  height | The number of rows that child will span.

void Gtk::Grid::attach_next_to | ( | Widget& | child,
|  | Widget& | sibling,
|  | PositionType | side,
|  | int | width,
|  | int | height
| ) |  |

Adds a widget to the grid.

The widget is placed next to sibling, on the side determined by side. When sibling is `0`, the widget is placed in row (for left or right placement) or column 0 (for top or bottom placement), at the end indicated by side.

Attaching widgets labeled [1], [2], [3] with sibling == `0` and side == Gtk::POS_LEFT yields a layout of [3][2][1].

Parameters:

  child | The widget to add.
  sibling | The child of grid that child will be placed next to, or `0` to place child at the beginning or end.
  side | The side of sibling that child is positioned next to.
  width | The number of columns that child will span.
  height | The number of rows that child will span.

Widget* Gtk::Grid::get_child_at | ( | int | left,
|  | int | top
| ) |  |

Gets the child of grid whose area covers the grid cell whose upper left corner is at left, top.

Since gtkmm 3.2:

Parameters:

  left | The left edge of the cell.
  top | The top edge of the cell.

Returns:
  The child at the given position, or `0`.

const Widget* Gtk::Grid::get_child_at | ( | int | left,
|  | int | top
| ) |  | const

Gets the child of grid whose area covers the grid cell whose upper left corner is at left, top.

Since gtkmm 3.2:

Parameters:

  left | The left edge of the cell.
  top | The top edge of the cell.

Returns:
  The child at the given position, or `0`.

bool Gtk::Grid::get_column_homogeneous | ( |  | ) | const

Returns whether all columns of grid have the same width.

Returns:
  Whether all columns of grid have the same width.

guint Gtk::Grid::get_column_spacing | ( |  | ) | const

Returns the amount of space between the columns of grid.

Returns:
  The column spacing of grid.

bool Gtk::Grid::get_row_homogeneous | ( |  | ) | const

Returns whether all rows of grid have the same height.

Returns:
  Whether all rows of grid have the same height.

guint Gtk::Grid::get_row_spacing | ( |  | ) | const

Returns the amount of space between the rows of grid.

Returns:
  The row spacing of grid.

GtkGrid* Gtk::Grid::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

const GtkGrid* Gtk::Grid::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

void Gtk::Grid::insert_column | ( | int | position | ) |

Inserts a column at the specified position.

Children which are attached at or to the right of this position are moved one column to the right. Children which span across this position are grown to span the new column.

Since gtkmm 3.2:

Parameters:

  position | The position to insert the column at.

void Gtk::Grid::insert_next_to | ( | Widget& | sibling,
|  | PositionType | side
| ) |  |

Inserts a row or column at the specified position.

The new row or column is placed next to sibling, on the side determined by side. If side is Gtk::POS_TOP or Gtk::POS_BOTTOM, a row is inserted. If side is Gtk::POS_LEFT of Gtk::POS_RIGHT, a column is inserted.

Since gtkmm 3.2:

Parameters:

  sibling | The child of grid that the new row or column will be placed next to.
  side | The side of sibling that child is positioned next to.

void Gtk::Grid::insert_row | ( | int | position | ) |

Inserts a row at the specified position.

Children which are attached at or below this position are moved one row down. Children which span across this position are grown to span the new row.

Since gtkmm 3.2:

Parameters:

  position | The position to insert the row at.

Glib::PropertyProxy< bool > Gtk::Grid::property_column_homogeneous | ( |  | ) |

If TRUE, the columns are all the same width.

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::Grid::property_column_homogeneous | ( |  | ) | const

If TRUE, the columns are all the same width.

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::Grid::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::Grid::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< bool > Gtk::Grid::property_row_homogeneous | ( |  | ) |

If TRUE, the rows are all the same 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_ReadOnly< bool > Gtk::Grid::property_row_homogeneous | ( |  | ) | const

If TRUE, the rows are all the same 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::Grid::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::Grid::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::Grid::set_column_homogeneous | ( | bool | homogeneous | ) |

Sets whether all columns of grid will have the same width.

Parameters:

  homogeneous | `true` to make columns homogeneous.

void Gtk::Grid::set_column_spacing | ( | guint | spacing | ) |

Sets the amount of space between columns of grid.

Parameters:

  spacing | The amount of space to insert between columns.

void Gtk::Grid::set_row_homogeneous | ( | bool | homogeneous = `true` | ) |

Sets whether all rows of grid will have the same height.

Parameters:

  homogeneous | `true` to make rows homogeneous.

void Gtk::Grid::set_row_spacing | ( | guint | spacing | ) |

Sets the amount of space between rows of grid.

Parameters:

  spacing | The amount of space to insert between rows.

## Friends And Related Function Documentation

Gtk::Grid* wrap | ( | GtkGrid * | 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/grid.h