SplitPane
splitPane · Containers · interactive
Two panes and a divider the reader can drag.
Import
cpp
#include "gbui/widgets/splitPane.hpp"Example
cpp
SplitPaneResult splitPane(Ui& ui, const Interaction& input, std::string_view id, float position, const std::function<void(Ui&)>& leading, const std::function<void(Ui&)>& trailing, const SplitPaneOptions& options = {});Draws leading, a divider, and trailing. position is the share the leading pane asks for, 0 to 1. It is a request: the minimums win over it, so a container too narrow for both gives each what it needs and the fraction stops being reachable — which is the right answer and the one a caller does not have to write.
API
SplitPaneOptions
| Option | Type | Default | What it does |
|---|---|---|---|
orientation | SplitOrientationHorizontal · Vertical | SplitOrientation::Horizontal | Which way the panes sit, and therefore which pair of arrow keys moves the divider. |
minLeading | float | 120.0f | The smallest each pane may become, in pixels. Enforced by the layout rather than by the drag, which is what makes it hold when the window shrinks as well as when the divider moves — the case a clamp in the drag handler silently misses. |
minTrailing | float | 120.0f | As above, for the other one. |
dividerWidth | float | 7.0f | How wide the grab strip is. Wider than the hairline drawn in it: a one-pixel target is a target nobody hits. |
name | std::string_view | What the divider is called. "Sidebar width" says more than "Resize", and it is the only thing a reader has to know which of two panes the arrow keys are about to change. | |
leadingLabel | std::string_view | What each side is, announced as a group around it. Empty leaves the pane's own contents to speak for it. | |
trailingLabel | std::string_view | As above, for the other one. | |
width | float | kAuto | |
height | float | kAuto | |
grow | float | 1.0f |