Class BoxLayout

Inheritance Relationships

Base Type

Class Documentation

class BoxLayout : public nanogui::Layout

Simple horizontal/vertical box layout.

This widget stacks up a bunch of widgets horizontally or vertically. It adds margins around the entire container and a custom spacing between adjacent widgets.

Public Functions

BoxLayout(Orientation orientation, Alignment alignment = Alignment::Middle, int margin = 0, int spacing = 0)

Construct a box layout which packs widgets in the given Orientation.

Parameters
  • orientation: The Orientation this BoxLayout expands along

  • alignment: Widget alignment perpendicular to the chosen orientation

  • margin: Margin around the layout container

  • spacing: Extra spacing placed between widgets

Orientation orientation() const

The Orientation this BoxLayout is using.

void setOrientation(Orientation orientation)

Sets the Orientation of this BoxLayout.

Alignment alignment() const

The Alignment of this BoxLayout.

void setAlignment(Alignment alignment)

Sets the Alignment of this BoxLayout.

int margin() const

The margin of this BoxLayout.

void setMargin(int margin)

Sets the margin of this BoxLayout.

int spacing() const

The spacing this BoxLayout is using to pad in between widgets.

void setSpacing(int spacing)

Sets the spacing of this BoxLayout.

virtual Vector2i preferredSize(NVGcontext *ctx, const Widget *widget) const

See Layout::preferredSize.

virtual void performLayout(NVGcontext *ctx, Widget *widget) const

See Layout::performLayout.

Protected Attributes

Orientation mOrientation

The Orientation of this BoxLayout.

Alignment mAlignment

The Alignment of this BoxLayout.

int mMargin

The margin of this BoxLayout.

int mSpacing

The spacing between widgets of this BoxLayout.