Layout#

class Layout#

Arranges the elements of a panel automatically, so that they do not have to be positioned one by one. See Panel::add_horizontal_layout(), Panel::add_vertical_layout() and Panel::add_grid_layout().

float spacing()#
void set_spacing(float value)#

The gap left between the elements, in pixels. A grid layout uses it in both directions.

Padding padding()#
void set_padding(Padding value)#

The gap left inside the edges of the panel.

TextAnchor child_alignment()#
void set_child_alignment(TextAnchor value)#

Where the elements are placed within the space the layout has to fill.

std::tuple<double, double> cell_size()#
void set_cell_size(std::tuple<double, double> value)#

The size of each cell of a grid layout, in pixels.

Note

Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements.

GridConstraint constraint()#
void set_constraint(GridConstraint value)#

What fixes the shape of a grid layout.

Note

Only applies to a grid layout. Throws an exception for the other layouts.

int32_t constraint_count()#
void set_constraint_count(int32_t value)#

The number of columns or rows that Layout::constraint() fixes, ignored when the constraint is GridConstraint::flexible.

Note

Only applies to a grid layout. Throws an exception for the other layouts.

struct Padding#

The gap left inside each edge of a layout, in whole pixels.

Note

See Layout::padding().

int32_t left#

The gap inside the left edge.

int32_t right#

The gap inside the right edge.

int32_t top#

The gap inside the top edge.

int32_t bottom#

The gap inside the bottom edge.

enum struct GridConstraint#

What fixes the shape of a grid layout.

enumerator flexible#

Fit as many columns and rows as the size of the panel allows.

enumerator fixed_column_count#

Use a fixed number of columns, and as many rows as are needed.

enumerator fixed_row_count#

Use a fixed number of rows, and as many columns as are needed.