Skip to content

Box

box · Containers · container

The general container, the way <div> is one.

Import

cpp
#include "gbui/widgets/box.hpp"

Example

Nothing is downloaded until you press it.

cpp
Ui::Scope box(Ui& ui, const BoxOptions& options = {});

Opens a container. Everything until the returned scope dies is inside it.

API

BoxOptions

OptionTypeDefaultWhat it does
directionDirectionDirection::Row
justifyJustifyJustify::Start
alignAlignAlign::Stretch
gapfloat0.0f
paddingEdges
marginEdges
widthfloatkAuto
heightfloatkAuto
minWidthfloatkAuto
minHeightfloatkAuto
maxWidthfloatstd::numeric_limits<float>::infinity()
maxHeightfloatstd::numeric_limits<float>::infinity()
growfloat0.0f
shrinkfloat1.0f
basisfloatkAuto
backgroundFill
backgroundGradientGradient
border optionalstd::optional<Token>
borderWidthfloat1.0f
radiusfloatkAuto
opacityfloat1.0f
overflowOverflowOverflow::Visible
layerLayerLayer::Content
cursorCursorCursor::Default
idstd::string_view
focusableboolfalse
roleRoleRole::NoneWhat this container is to a reader who cannot see it. None by default, and that is the right default for the general container: most boxes are layout, and a tree full of anonymous groups is a tree a reader has to walk through rather than one they can navigate. Set it where the box is something — a Form, a List, a named Group, a Figure around a drawing.
namestd::string_viewWhat it is called. A Group with no name is not worth announcing, and the tree treats it as though the role were None.

Released under the LGPL-3.0-or-later licence.