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

Parameters:

  child | The widget to add.
  sibling | The child of grid that child will be placed next to.
  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.

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.

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

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

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

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

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

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.

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