Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::Overlay Class Reference

UI-owned overlay using the existing traversal, geometry and sibling stacking. Later siblings are above earlier siblings for normal paint order and EventRouter hit testing. Layout methods are pure and follow Layout's borrowed-span contract. Invalid settings/policies return INVALID_ARGUMENT, checked overflow INVALID_GEOMETRY, allocation failure NO_MEMORY. More...

#include <grid.hpp>

Inheritance diagram for portals::Overlay:
portals::Overlayportals::Overlay portals::SizedWidget portals::Layout portals::Widget portals::LayoutItem portals::OverlayHost

Public Member Functions

 Overlay (OverlayOptions options={}, SizePolicy policy={})
 Own settings and size policies.
OverlayOptions options () const
 Owning UI-thread copy.
std::expected< CellSize, TreeError > childAvailable (CellSize available) const override
 Checked inset bounds.
std::expected< CellSize, TreeError > measureChildren (std::span< const MeasuredChild > children) const override
 Maximum child extent on each axis.
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 void unmount ()
 Called once before destruction, children first; cleanup continues on exceptions.
virtual std::expected< CellSize, TreeError > measure (CellSize available)
 Default desired size is empty.
virtual std::expected< void, TreeError > arrange (CellRect local)
 Default accepts the owning rectangle.
virtual std::expected< void, TreeError > paint (PaintContext &context)
 Default emits no commands.
virtual ComputedStyle styleDefaults () const
 Read manual presentation defaults during style staging on UI.
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.
virtual std::expected< CellRect, TreeError > childClip (CellSize available) const
 Clip descendants within this container without changing allocation.
virtual std::expected< LayoutChildPolicy, TreeError > childLayoutFor (NodeId child, CellSize available) const
 Describe one child's clip and reveal policy after arrangeChildren.

Friends

std::expected< void, TreeError > setOverlayOptions (WidgetTree &tree, Node< Overlay > node, OverlayOptions options)
 Validate and replace settings on the UI owner between frames, then invalidate layout.

Detailed Description

UI-owned overlay using the existing traversal, geometry and sibling stacking. Later siblings are above earlier siblings for normal paint order and EventRouter hit testing. Layout methods are pure and follow Layout's borrowed-span contract. Invalid settings/policies return INVALID_ARGUMENT, checked overflow INVALID_GEOMETRY, allocation failure NO_MEMORY.

Constructor & Destructor Documentation

◆ Overlay()

portals::Overlay::Overlay ( OverlayOptions options = {},
SizePolicy policy = {} )
explicit

Own settings and size policies.

Parameters
optionsOwning padding and alignment applied independently to every child.
policySize policy of this overlay in its parent.

Member Function Documentation

◆ arrangeChildren()

std::expected< std::vector< CellRect >, TreeError > portals::Overlay::arrangeChildren ( std::span< const MeasuredChild > children,
CellSize available ) const
overridevirtual

Child-order local rectangles.

Parameters
childrenVisible child measurements, policies and identities in sibling order.
availableContainer-local extent in terminal cells.
Returns
Owning rectangles in child order, or INVALID_ARGUMENT, NODE_LIMIT, INVALID_GEOMETRY or NO_MEMORY as applicable.

Implements portals::Layout.

Reimplemented in portals::OverlayHost.

◆ childAvailable()

std::expected< CellSize, TreeError > portals::Overlay::childAvailable ( CellSize available) const
overridevirtual

Checked inset bounds.

Parameters
availableContainer extent offered by its parent, in cells.
Returns
Normalized inner extent after padding, or invalid settings/coordinate overflow.

Implements portals::Layout.

Reimplemented in portals::OverlayHost.

◆ measureChildren()

std::expected< CellSize, TreeError > portals::Overlay::measureChildren ( std::span< const MeasuredChild > children) const
overridevirtual

Maximum child extent on each axis.

Parameters
childrenVisible child measurements and policies, borrowed only for this calculation.
Returns
Aggregate intrinsic extent including gaps/padding, or a validation, geometry or allocation error.

Implements portals::Layout.

Reimplemented in portals::OverlayHost.

◆ options()

OverlayOptions portals::Overlay::options ( ) const

Owning UI-thread copy.

Returns
A value copy of the current padding and alignment.

◆ setOverlayOptions

std::expected< void, TreeError > setOverlayOptions ( WidgetTree & tree,
Node< Overlay > node,
OverlayOptions options )
friend

Validate and replace settings on the UI owner between frames, then invalidate layout.

Parameters
treeOwning tree, borrowed for the UI-only update.
nodeChecked observer of the overlay being updated.
optionsReplacement padding and alignment, copied by value.
Returns
Success after replacement and layout invalidation, or a validation/access error with old settings retained.

The documentation for this class was generated from the following file: