C++ GUI Library

class gui::grid

A grid is a rectangular set of cells, with the space available to it being divided up into rows and columns, and a cell being the intersection of a row and a column. Each cell may contain a widget, and each widget may occupy a span of one or more rows and columns. In this respect, a grid is very similar to an HTML table. The grid is automatically resized to accomodate the space requirements of the widgets it contains.

grid(const grid &other)

Copy-construct this grid from another; this does not create a new grid, but an additional reference to the existing grid.

grid(const widget &other)

Attempt to narrow a widget to a grid. If the widget is not a grid, std::bad_cast will be thrown.

swap(grid &other)

Exchange this reference to a grid with another.

operator=(grid other)

Assign this grid to refer to another grid.

operator widget()

Upcast to the widget base type.

grid(int columns, int rows)

Create a grid with the specified number of columns and rows.

set_size(int columns, int rows)

Change the size of the grid; any widgets excluded by the new grid size will be removed from the grid.

contain(const widget &child, int col, int row, int colspan=1, int rowspan=1)

Add a widget to a specified position in the grid. If this widget overlaps any existing widgets in the grid, the existing widgets will be removed. The colspan and rowspan parameters allow you to specify the number of columns and rows respectively that the new widget will occupy.

set_padding(int col_pad, int row_pad)

Set the padding (in pixels for now, this is likely to change) between columns and rows. The padding applies only to the spaces between two columns or two rows.

expand_row(int row, bool expand)

Specifies whether a row should be expanded. Expanded rows will attempt to use as much space as is possible. If there are no expanded rows, the available space will simply be divided up between the non-expanded rows.

expand_column(int col, bool expand)

Specifies whether a column should be expanded. Expanded columns will attempt to use as much space as is possible. If there are no expanded columns, the available space will simply be divided up between the non-expanded columns.