Editor → Widget Kit → layout.h
kit::row_layout
| Type | Class |
| Namespace | conjure::editor::kit |
| Include File Path | engine/include/conjure/editor/kit/layout.h |
| Source File Path | engine/src/editor/kit/layout.cpp |
| API ↗ | The editor, The widget kit |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | explicit row_layout(
f32 gap = 0.0f,
f32 paddingStart = 0.0f,
f32 paddingEnd = 0.0f) noexcept; | An empty row; negative or non-finite gaps and paddings count as 0. |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mCount | usize | 0 | |
| private | mGap | f32 | 0.0f | |
| private | mPaddingEnd | f32 | 0.0f | |
| private | m | f32 | 0.0f | |
| private | mSlots | std:: | {} |
Functions
Public
arrange
arrange[[nodiscard]] row_arrangement arrange(
f32 origin,
f32 extent) const noexcept;Places the slots in the span from origin over extent: the padding, then each slot and a gap between neighbours. The free space (extent less padding, gaps and every slot's size, FILL slots counted at their least size) is shared among the FILL slots by weight on top of their least size; when it is negative every FILL slot keeps its least size and overflow reports the excess. Without FILL slots the free space stays at the end. Positions are exact (no rounding): callers snap to pixels where they draw.
at
atThe slot at index, in the order the slots were added. Asserts past the last slot; in a build without asserts it returns the first slot (a default one in an empty row).
empty
empty[[nodiscard]] bool empty() const noexcept;True when the row holds no slot.
fill
fillAppends a slot that takes weight shares of the free space (weights at or below 0 count as 1), never less than minimum.
fit
fitAppends a slot whose size is its measured content (as fixed()).
fixed
fixedAppends a slot of exactly size (negative or non-finite: 0). Asserts when the row is full; in a build without asserts the slot is dropped. Returns the slot's index.
from_template
from_template[[nodiscard]] static core::result<row_layout> from_template(
std::string_view tracks,
f32 gap = 0.0f,
f32 paddingStart = 0.0f,
f32 paddingEnd = 0.0f);Parses a CSS-like track list, the form tables use: lengths in pixels ("150"), fractions ("1fr", "2.5fr") and "fit:<pixels>" for a measured column, separated by spaces, with the given gap and padding. Fails with INVALID_ARGUMENT for an empty list, a track that is none of these forms, a negative or non-finite number or more than MAX_ROW_SLOTS tracks; the message names the offending track and its position.
gap
gap[[nodiscard]] f32 gap() const noexcept;The gap between neighbouring slots (0 for a negative or non-finite one given).
minimum_extent
minimum_extent[[nodiscard]] f32 minimum_extent() const noexcept;The least extent the row needs: padding, gaps and every slot's size (FILL at its least size).
size
size[[nodiscard]] usize size() const noexcept;How many slots the row holds (at most MAX_ROW_SLOTS).