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

Retained label/editor/help/message composition using the ordinary vertical layout. The tree owns the field and its children. No model, scheduler or transaction is created by this widget. Read snapshots only inside tree.read; mutating free functions are UI-only outside frames. More...

#include <form_field.hpp>

Inheritance diagram for portals::FormField:
portals::FormFieldportals::FormField portals::Column portals::LinearLayout portals::SizedWidget portals::Layout portals::Widget portals::LayoutItem

Public Member Functions

 FormField (FormFieldAppearance options={})
 ~FormField () override
 Retire any borrowed validation bridge before child ownership is reclaimed.
FieldValidation validation () const
Node< Widget > editor () const
Public Member Functions inherited from portals::Column
 Column (LinearOptions options={}, SizePolicy policy={})
 Own settings and policies.
Public Member Functions inherited from portals::LinearLayout
std::expected< CellSize, TreeError > childAvailable (CellSize available) const override
 Checked inset extent.
std::expected< CellSize, TreeError > measureChildren (std::span< const MeasuredChild > children) const override
 Checked sum/max.
std::expected< std::vector< CellRect >, TreeError > arrangeChildren (std::span< const MeasuredChild > children, CellSize available) const override
 Deterministic bounded solve.
LinearOptions options () const
 Owning copy; no invalidation.
bool horizontal () const
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

struct ui::detail::Access
std::expected< void, TreeError > setFormFieldValidation (WidgetTree &tree, Node< FormField > node, FieldValidation value)

Additional Inherited Members

Protected Member Functions inherited from portals::LinearLayout
 LinearLayout (bool horizontal, LinearOptions options, SizePolicy policy)
 Initialize axis and owning settings.

Detailed Description

Retained label/editor/help/message composition using the ordinary vertical layout. The tree owns the field and its children. No model, scheduler or transaction is created by this widget. Read snapshots only inside tree.read; mutating free functions are UI-only outside frames.

Constructor & Destructor Documentation

◆ FormField()

portals::FormField::FormField ( FormFieldAppearance options = {})
explicit
Parameters
optionsOwning layout settings and manual defaults; child recipes supply the actual captions.

Member Function Documentation

◆ editor()

Node< Widget > portals::FormField::editor ( ) const
Returns
Observing editor root, possibly stale after a child is independently removed.

◆ validation()

FieldValidation portals::FormField::validation ( ) const
Returns
Most recent owning validation presentation; copying its message may allocate.

◆ setFormFieldValidation

std::expected< void, TreeError > setFormFieldValidation ( WidgetTree & tree,
Node< FormField > node,
FieldValidation value )
friend
Parameters
treeExisting UI tree, borrowed only during this call.
nodeLive field identity.
valueOwning explicit presentation; this is not an asynchronous completion endpoint.
Returns
Success after updating readable text, or the original tree/text/allocation failure. Pending never changes editor eligibility. Invalid UTF-8 is rejected before the old presentation changes.

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