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

Frame using the existing vertical LinearLayout with one-cell insets for each present side. Paint borrows only widget-owned glyphs until the enclosing tree.frame ends. The inner child clip prevents fixed/minimum-size children from painting or receiving input on edges. Manual style defaults are construction-only; dynamic styling uses the existing style resolver. No I/O, timer, retained command storage or allocation occurs inside paint itself. More...

#include <primitives.hpp>

Inheritance diagram for portals::Border:
portals::Borderportals::Border portals::SizedWidget portals::Layout portals::Widget portals::LayoutItem

Public Member Functions

 Border (WidthPolicy width={}, BorderOptions options={}, ControlStyle style={}, SizePolicy policy={})
 Border (WidthPolicy width, FrameOptions options, ControlStyle style, SizePolicy policy, std::in_place_t advanced)
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< CellSize, TreeError > childAvailable (CellSize available) const override
std::expected< std::vector< CellRect >, TreeError > arrangeChildren (std::span< const MeasuredChild > children, CellSize available) const override
std::expected< CellSize, TreeError > measureChildren (std::span< const MeasuredChild > children) const override
std::expected< void, TreeError > arrange (CellRect local) override
std::expected< CellRect, TreeError > childClip (CellSize available) const override
std::expected< void, TreeError > paint (PaintContext &context) override
ComputedStyle styleDefaults () const override
std::expected< void, TreeError > preparation () const noexcept
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 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< LayoutChildPolicy, TreeError > childLayoutFor (NodeId child, CellSize available) const
 Describe one child's clip and reveal policy after arrangeChildren.

Static Public Member Functions

static std::expected< void, TreeError > validate (BorderOptions options)
static std::expected< void, TreeError > validateFrame (const FrameOptions &options) noexcept

Friends

struct detail::GlyphProfileAccess
std::expected< void, TreeError > syncBorder (WidgetTree &tree, Node< Border > node)
std::expected< void, TreeError > syncBorder (WidgetTree &tree, Node< Border > node, Node< Widget > focused)
std::expected< void, TreeError > setBorderTitle (WidgetTree &tree, Node< Border > node, const GraphemeText &title)
 Replace a frame title through the existing checked tree mutation boundary.

Detailed Description

Frame using the existing vertical LinearLayout with one-cell insets for each present side. Paint borrows only widget-owned glyphs until the enclosing tree.frame ends. The inner child clip prevents fixed/minimum-size children from painting or receiving input on edges. Manual style defaults are construction-only; dynamic styling uses the existing style resolver. No I/O, timer, retained command storage or allocation occurs inside paint itself.

Constructor & Destructor Documentation

◆ Border() [1/2]

portals::Border::Border ( WidthPolicy width = {},
BorderOptions options = {},
ControlStyle style = {},
SizePolicy policy = {} )
explicit
Parameters
widthComplete owning text policy, shared with the receiving frame.
optionsOwning glyph mode and finite paint cap; checked by measure/paint.
styleConstruction-only owning manual normal/focused/disabled defaults beneath theme rules.
policyOwning size constraints, checked by the existing layout solver. Construction may allocate; tree emplacement translates allocation failures. preparation() reports invalid text policy.

◆ Border() [2/2]

portals::Border::Border ( WidthPolicy width,
FrameOptions options,
ControlStyle style,
SizePolicy policy,
std::in_place_t advanced )
Parameters
widthComplete receiving text-width policy.
optionsOwning advanced frame appearance and finite construction/paint limits.
styleConstruction-only manual style defaults.
policyOwning size constraints checked by the existing solver.
advancedExplicit tag preserving unambiguous legacy brace-initialized calls. Text compilation precedes painting; preparation() reports semantic errors without throwing.

Member Function Documentation

◆ arrange()

std::expected< void, TreeError > portals::Border::arrange ( CellRect local)
overridevirtual
Parameters
localParent-local allocation; only its extent is retained.
Returns
Success, or INVALID_GEOMETRY for an unrepresentable local extent.

Reimplemented from portals::Widget.

◆ arrangeChildren()

std::expected< std::vector< CellRect >, TreeError > portals::Border::arrangeChildren ( std::span< const MeasuredChild > children,
CellSize available ) const
overridevirtual
Parameters
childrenVisible child measurements and policies, borrowed only during placement.
availableAllocated outer extent in cells.
Returns
Existing Column placements with present-side insets, or unchanged layout error.

Implements portals::Layout.

◆ childAvailable()

std::expected< CellSize, TreeError > portals::Border::childAvailable ( CellSize available) const
overridevirtual
Parameters
availableAllocated outer extent offered by the parent, in cells.
Returns
Existing Column calculation with one-cell padding per present side, or unchanged layout error.

Implements portals::Layout.

◆ childClip()

std::expected< CellRect, TreeError > portals::Border::childClip ( CellSize available) const
overridevirtual
Parameters
availableAllocated normalized outer extent in cells.
Returns
Container-local inner clip, possibly empty at zero/one/two-cell extents.

Reimplemented from portals::Layout.

◆ measure()

std::expected< CellSize, TreeError > portals::Border::measure ( CellSize available)
overridevirtual
Parameters
availableOffered extent; titles do not enlarge intrinsic frame width.
Returns
Present-side decoration size (two by two by default), or INVALID_ARGUMENT for invalid options/text.

Reimplemented from portals::Widget.

◆ measureChildren()

std::expected< CellSize, TreeError > portals::Border::measureChildren ( std::span< const MeasuredChild > children) const
overridevirtual
Parameters
childrenVisible child measurements and policies, borrowed only for this calculation.
Returns
Existing linear aggregate plus the resolved theme minimum width, or unchanged layout error.

Implements portals::Layout.

◆ paint()

std::expected< void, TreeError > portals::Border::paint ( PaintContext & context)
overridevirtual
Parameters
contextSynchronous sink; borrowed glyph text remains widget-owned through this frame.
Returns
Success, INVALID_ARGUMENT, WOULD_BLOCK above the paint cap before submission, or unchanged sink error. The cap counts perimeter glyph cells and the complete submitted title bytes plus graphemes, including clipped tails. Sink exceptions propagate to the existing WidgetTree::paint boundary; discard a failed frame.

Reimplemented from portals::Widget.

◆ preparation()

std::expected< void, TreeError > portals::Border::preparation ( ) const
noexcept
Returns
Construction-time text validation result, without allocation or callbacks. Checked factories call this before constructing framed descendants.

◆ styleDefaults()

ComputedStyle portals::Border::styleDefaults ( ) const
overridevirtual
Returns
Owning manual appearances beneath the existing style resolver.

Reimplemented from portals::Widget.

◆ validate()

std::expected< void, TreeError > portals::Border::validate ( BorderOptions options)
static
Parameters
optionsOwning settings to validate without allocation or mutation.
Returns
Success for a recognized glyph mode and positive cap, otherwise INVALID_ARGUMENT.

◆ validateFrame()

std::expected< void, TreeError > portals::Border::validateFrame ( const FrameOptions & options)
staticnoexcept
Parameters
optionsBorrowed owning settings; no text segmentation or allocation occurs.
Returns
Success for valid scalar/byte bounds, otherwise INVALID_ARGUMENT; call preparation() for text errors.

◆ setBorderTitle

std::expected< void, TreeError > setBorderTitle ( WidgetTree & tree,
Node< Border > node,
const GraphemeText & title )
friend

Replace a frame title through the existing checked tree mutation boundary.

Parameters
treeBorrowed UI owner, between frames.
nodeLive passive frame, without changing its size policy or title decoration.
titleValidated text borrowed only during this call, using this frame's width policy.
Returns
Checked boundary/text/capacity error without changing the old title, or success. Preparation precedes paint invalidation and publication; equal bytes request no redraw. Title text is clipped to the current allocation and never enlarges intrinsic frame width.

◆ syncBorder [1/2]

std::expected< void, TreeError > syncBorder ( WidgetTree & tree,
Node< Border > node )
friend
Parameters
treeBorrowed UI owner, between frames.
nodeLive frame whose input eligibility is copied for disabled presentation; focus projection is cleared.
Returns
Tree boundary error or success; unchanged presentation requests no redraw.

◆ syncBorder [2/2]

std::expected< void, TreeError > syncBorder ( WidgetTree & tree,
Node< Border > node,
Node< Widget > focused )
friend
Parameters
treeBorrowed UI owner; synchronization is allowed only between frames.
nodeLive frame receiving disabled/focused/normal presentation without becoming a focus target.
focusedEmpty observer, this frame, or another live node in tree; descendants project focused appearance.
Returns
Checked boundary/identity error without mutation, or success; only changed appearance invalidates PAINT. Disabled presentation takes precedence over focus. The focus observer is borrowed only during this call.

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