|
Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
|
UI-owned Grid implementing the existing pure Layout contract. Every visible child needs a placement. All spans are checked, including hidden/stale entries. Later siblings paint/hit above earlier siblings; placement order does not change stacking. Intrinsic tracks absorb child demand, then Row's allocation rules apply independently on each axis. Constructors own settings; invalid settings are reported by Layout methods. Layout errors are INVALID_ARGUMENT, NODE_LIMIT, INVALID_GEOMETRY or NO_MEMORY. No I/O, retained spans or tree traversal. More...
#include <grid.hpp>
Public Member Functions | |
| Grid (const GridOptions &options={}, SizePolicy policy={}) | |
| Own settings and size policies. | |
| Grid (const GridOptions &options, GridPlacementMode mode, SizePolicy policy={}, std::optional< GridScrollOptions > scroll={}, WidthPolicy width={}) | |
| Own resolved settings in a fixed construction-time placement mode. | |
| ~Grid () override | |
| Release owning caches without callbacks or terminal operations. | |
| void | unmount () override |
| Retire an optional scroll lease, pointer capture and intent before destruction. | |
| std::expected< void, TreeError > | arrange (CellRect local) override |
| std::expected< CellRect, TreeError > | childClip (CellSize available) const override |
| std::expected< LayoutChildPolicy, TreeError > | childLayoutFor (NodeId child, CellSize available) const override |
| std::expected< void, TreeError > | paint (PaintContext &context) override |
| ComputedStyle | styleDefaults () const override |
| GridOptions | options () const |
| Owning UI-thread copy; allocation may throw bad_alloc. | |
| bool | usesRegions () const noexcept |
| std::expected< CellSize, TreeError > | childAvailable (CellSize available) const override |
| Checked inset bounds. | |
| std::expected< CellSize, TreeError > | measureChildren (std::span< const MeasuredChild > children) const override |
| Aggregate tracks. | |
| std::expected< std::vector< CellRect >, TreeError > | arrangeChildren (std::span< const MeasuredChild > children, CellSize available) const override |
| Child-order local rectangles. | |
| Public Member Functions inherited from portals::SizedWidget | |
| SizedWidget (SizePolicy policy={}) | |
| Own the supplied policies; checked by layout. | |
| SizePolicy | sizePolicy () const override |
| Copy current policy without borrowing storage. | |
| Public Member Functions inherited from portals::Widget | |
| virtual | ~Widget ()=default |
| Destroy on UI after the last active tree borrow. | |
| virtual void | mount () |
| Called exactly once after attachment; exceptions are reported. | |
| virtual std::expected< CellSize, TreeError > | measure (CellSize available) |
| Default desired size is empty. | |
| virtual bool | styleReadOnly () const noexcept |
| Read actual view-only state during style staging; false by default. | |
| const std::shared_ptr< const StyleSnapshot > & | computedStyle () const noexcept |
| Inspect the last atomically installed theme inside tree.read/frame. | |
| std::uint64_t | styleRevision () const noexcept |
| Public Member Functions inherited from portals::LayoutItem | |
| virtual | ~LayoutItem ()=default |
| Destroy with the implementing widget. | |
| Public Member Functions inherited from portals::Layout | |
| virtual | ~Layout ()=default |
| Destroy with the implementing widget. | |
Friends | |
| struct | detail::ScrollWidgetAccess |
| std::expected< void, TreeError > | setGridOptions (WidgetTree &tree, Node< Grid > node, const GridOptions &options) |
| Validate and atomically copy settings on the UI owner between frames, then invalidate layout. Tree errors propagate; invalid configuration leaves the previous settings unchanged. Input is borrowed only for this call. Allocation failure returns NO_MEMORY. | |
| std::expected< void, TreeError > | setDeclarativeGridOptions (WidgetTree &tree, Node< Grid > node, const GridOptions &options) |
| Atomically replace resolved declarative settings between frames on the UI owner. | |
| std::expected< void, TreeError > | setGridPresentation (WidgetTree &tree, Node< Grid > node, const GridPresentation &presentation) |
| Replace owning backgrounds between frames on the UI owner. | |
UI-owned Grid implementing the existing pure Layout contract. Every visible child needs a placement. All spans are checked, including hidden/stale entries. Later siblings paint/hit above earlier siblings; placement order does not change stacking. Intrinsic tracks absorb child demand, then Row's allocation rules apply independently on each axis. Constructors own settings; invalid settings are reported by Layout methods. Layout errors are INVALID_ARGUMENT, NODE_LIMIT, INVALID_GEOMETRY or NO_MEMORY. No I/O, retained spans or tree traversal.
|
explicit |
Own settings and size policies.
| options | Tracks, sparse placements and limits copied into independent storage. |
| policy | Size policy of this grid in its parent. |
| std::bad_alloc | If copying the configuration cannot allocate storage. |
| portals::Grid::Grid | ( | const GridOptions & | options, |
| GridPlacementMode | mode, | ||
| SizePolicy | policy = {}, | ||
| std::optional< GridScrollOptions > | scroll = {}, | ||
| WidthPolicy | width = {} ) |
Own resolved settings in a fixed construction-time placement mode.
| options | Complete resolved tracks and identities, copied into independent storage. |
| mode | EXPLICIT permits overlap; DECLARATIVE rejects overlapping cell rectangles. |
| policy | Size policy of this grid in its parent. |
| scroll | Optional existing scroll owner, fixed before mounting; no additional widget is created. |
| width | Existing terminal width policy used to validate scroll chrome glyphs. |
| std::bad_alloc | If the configuration cannot be copied. |
| local | Parent-local allocation, used only to derive owning regional geometry. |
Reimplemented from portals::Widget.
|
overridevirtual |
Child-order local rectangles.
| children | Visible child measurements, policies and identities in sibling order. |
| available | Container-local extent in terminal cells. |
Implements portals::Layout.
|
overridevirtual |
Checked inset bounds.
| available | Container extent offered by its parent, in cells. |
Implements portals::Layout.
|
overridevirtual |
| available | Normalized complete allocation. |
Reimplemented from portals::Layout.
|
overridevirtual |
| child | Full identity of one measured direct child. |
| available | Complete allocation. |
Reimplemented from portals::Layout.
|
overridevirtual |
Aggregate tracks.
| children | Visible child measurements and policies, borrowed only for this calculation. |
Implements portals::Layout.
| GridOptions portals::Grid::options | ( | ) | const |
Owning UI-thread copy; allocation may throw bad_alloc.
| std::bad_alloc | If the owning copy cannot be allocated. |
|
overridevirtual |
| context | Synchronous sink borrowing grid-owned chrome text only through the enclosing frame. |
Reimplemented from portals::Widget.
|
overridevirtual |
Reimplemented from portals::Widget.
|
overridevirtual |
Retire an optional scroll lease, pointer capture and intent before destruction.
Reimplemented from portals::Widget.
|
noexcept |
|
friend |
Atomically replace resolved declarative settings between frames on the UI owner.
| tree | Owning tree, borrowed for checked access and layout invalidation. |
| node | Declarative grid; an explicit grid returns INVALID_ARGUMENT without changing mode. |
| options | Complete owning replacement; overlap is rejected and full identities remain authoritative. |
|
friend |
Validate and atomically copy settings on the UI owner between frames, then invalidate layout. Tree errors propagate; invalid configuration leaves the previous settings unchanged. Input is borrowed only for this call. Allocation failure returns NO_MEMORY.
| tree | Owning tree, borrowed for the UI-only update. |
| node | Checked observer of the grid being updated. |
| options | Complete replacement configuration; borrowed only while making an independent copy. |
|
friend |
Replace owning backgrounds between frames on the UI owner.
| tree | Owning tree borrowed for this checked update. |
| node | Grid receiving backgrounds. |
| presentation | Complete replacement with positive paint budget; borrowed only during this call. |