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

Widget with owning policies, changed only through setSizePolicy on UI. More...

#include <layout.hpp>

Inheritance diagram for portals::SizedWidget:
portals::SizedWidgetportals::SizedWidget portals::Widget portals::LayoutItem portals::Border portals::Chart< T > portals::Control portals::Gauge portals::Grid portals::LineEdit portals::LinearLayout portals::Overlay portals::Password portals::RadioGroup portals::ScrollArea portals::ScrollBar portals::Spinner portals::VirtualList< T > portals::VirtualRows< T > portals::VirtualTable< T >

Public Member Functions

 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.

Friends

std::expected< void, TreeError > setSizePolicy (WidgetTree &tree, Node< SizedWidget > node, SizePolicy policy)
 Validate and edit policies between frames on the tree's UI owner; tree errors propagate. Changed policies invalidate layout; equal policies preserve geometry. The installed style minimum is a hard bound and a conflicting maximum rejects the update without changing the previous policy.

Detailed Description

Widget with owning policies, changed only through setSizePolicy on UI.

Constructor & Destructor Documentation

◆ SizedWidget()

portals::SizedWidget::SizedWidget ( SizePolicy policy = {})
explicit

Own the supplied policies; checked by layout.

Parameters
policyOwning width/height constraints; layout validates them before placement.

Member Function Documentation

◆ sizePolicy()

SizePolicy portals::SizedWidget::sizePolicy ( ) const
overridevirtual

Copy current policy without borrowing storage.

Returns
A value copy of the current width/height constraints; obtain it only inside tree.read.

Implements portals::LayoutItem.

◆ setSizePolicy

std::expected< void, TreeError > setSizePolicy ( WidgetTree & tree,
Node< SizedWidget > node,
SizePolicy policy )
friend

Validate and edit policies between frames on the tree's UI owner; tree errors propagate. Changed policies invalidate layout; equal policies preserve geometry. The installed style minimum is a hard bound and a conflicting maximum rejects the update without changing the previous policy.

Parameters
treeOwning UI tree, borrowed for this call.
nodeChecked observer of the SizedWidget to update.
policyReplacement width/height constraints; invalid values are rejected before mutation.
Returns
Success after requesting layout, or the validation/access/invalidation error.

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