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

Retained ordinary content owner with optional one-cell frame and embedded bars. Add one content root (a Row/Column/Grid for multiple controls). This is not virtualization. Initialize between frames before commands/preparation/binding. Before initialization paint is safe and empty; checked commands fail with INVALID_ARGUMENT. No callbacks or publication occur in layout or paint. Construct/mutate on the tree's UI thread; tree owns final widget destruction. More...

#include <scroll_controls.hpp>

Inheritance diagram for portals::ScrollArea:
portals::ScrollAreaportals::ScrollArea portals::SizedWidget portals::Layout portals::Widget portals::LayoutItem portals::DocumentView portals::LogView

Public Member Functions

 ScrollArea (std::shared_ptr< ScrollController > controller={}, WidthPolicy width={}, ScrollAreaOptions options={}, ControlStyle style={}, SizePolicy policy={})
 ScrollArea (std::shared_ptr< ScrollController > controller, WidthPolicy width, ScrollAreaOptions options, ControlStyle style, SizePolicy policy, FrameOptions frame, std::in_place_t advanced)
 Construct an area with an owning advanced frame, compiled before initialization.
 ~ScrollArea () override
 Release owning values; no user callback or terminal operation occurs.
void unmount () override
 Retire this node's lease and pointer token before destruction.
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< CellSize, TreeError > childAvailable (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< std::vector< CellRect >, TreeError > arrangeChildren (std::span< const MeasuredChild > children, CellSize available) const override
std::expected< void, TreeError > paint (PaintContext &context) override
ComputedStyle styleDefaults () const override
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 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.

Friends

struct detail::ScrollWidgetAccess

Detailed Description

Retained ordinary content owner with optional one-cell frame and embedded bars. Add one content root (a Row/Column/Grid for multiple controls). This is not virtualization. Initialize between frames before commands/preparation/binding. Before initialization paint is safe and empty; checked commands fail with INVALID_ARGUMENT. No callbacks or publication occur in layout or paint. Construct/mutate on the tree's UI thread; tree owns final widget destruction.

Constructor & Destructor Documentation

◆ ScrollArea() [1/2]

portals::ScrollArea::ScrollArea ( std::shared_ptr< ScrollController > controller = {},
WidthPolicy width = {},
ScrollAreaOptions options = {},
ControlStyle style = {},
SizePolicy policy = {} )
explicit
Parameters
controllerOwning shared values; empty creates a default controller on this UI thread.
widthComplete owning text policy for all glyphs.
optionsOwning placement/input settings, validated by initialization and measurement.
styleConstruction-only defaults beneath the existing theme resolver.
policyOwning layout constraints, validated by the layout solver.
Exceptions
std::bad_allocOn internal allocation; tree emplacement translates it to NO_MEMORY. Other text-policy constructor errors use the existing tree emplacement exception boundary.

◆ ScrollArea() [2/2]

portals::ScrollArea::ScrollArea ( std::shared_ptr< ScrollController > controller,
WidthPolicy width,
ScrollAreaOptions options,
ControlStyle style,
SizePolicy policy,
FrameOptions frame,
std::in_place_t advanced )

Construct an area with an owning advanced frame, compiled before initialization.

Parameters
controllerOwning shared values; empty creates a default controller on this UI thread.
widthComplete owning text policy for frame and scrollbar glyphs.
optionsOwning placement/input settings; its legacy frame is superseded by frame.
styleConstruction-only defaults beneath the existing theme resolver.
policyOwning layout constraints, validated by the layout solver.
frameOwning frame settings; retained text is independent of caller storage.
advancedRequired construction tag keeping legacy brace calls unambiguous.
Exceptions
std::bad_allocOn allocation; tree emplacement translates it to NO_MEMORY. Semantic frame errors are retained and returned by initialization and measurement before a lease is acquired.

Member Function Documentation

◆ arrange()

std::expected< void, TreeError > portals::ScrollArea::arrange ( CellRect local)
overridevirtual
Parameters
localParent-local allocation; only the normalized extent is cached.
Returns
Success or unchanged settings/controller/geometry error.

Reimplemented from portals::Widget.

◆ arrangeChildren()

std::expected< std::vector< CellRect >, TreeError > portals::ScrollArea::arrangeChildren ( std::span< const MeasuredChild > children,
CellSize available ) const
overridevirtual
Parameters
childrenVisible single content root, borrowed only during placement.
availableNormalized outer allocation.
Returns
Full intrinsic content rectangle translated by the locally clamped raster offset. Returns INVALID_ARGUMENT for multiple roots or INVALID_GEOMETRY on overflow.

Implements portals::Layout.

◆ childAvailable()

std::expected< CellSize, TreeError > portals::ScrollArea::childAvailable ( CellSize available) const
overridevirtual
Parameters
availableOffered outer extent, normalized for descendant measurement.
Returns
Offered extent minus optional frame inset, or invalid settings.

Implements portals::Layout.

◆ childClip()

std::expected< CellRect, TreeError > portals::ScrollArea::childClip ( CellSize available) const
overridevirtual
Parameters
availableNormalized allocated extent.
Returns
Viewport clip excluding owned bar cells, or a checked geometry error.

Reimplemented from portals::Layout.

◆ measure()

std::expected< CellSize, TreeError > portals::ScrollArea::measure ( CellSize available)
overridevirtual
Parameters
availableOffered allocation, not an intrinsic content limit.
Returns
Empty/frame minimum, or invalid settings/controller affinity error.

Reimplemented from portals::Widget.

◆ measureChildren()

std::expected< CellSize, TreeError > portals::ScrollArea::measureChildren ( std::span< const MeasuredChild > children) const
overridevirtual
Parameters
childrenVisible content roots; at most one is permitted.
Returns
Intrinsic content plus frame inset, or INVALID_ARGUMENT/INVALID_GEOMETRY.

Implements portals::Layout.

◆ paint()

std::expected< void, TreeError > portals::ScrollArea::paint ( PaintContext & context)
overridevirtual
Parameters
contextSynchronous sink borrowing widget-owned text through the enclosing frame.
Returns
Success, WOULD_BLOCK before submission above the whole paint budget, or sink error. Sink exceptions use WidgetTree::paint's existing exception boundary.

Reimplemented from portals::Widget.

◆ styleDefaults()

ComputedStyle portals::ScrollArea::styleDefaults ( ) const
overridevirtual
Returns
Owning manual normal/focused/disabled defaults beneath theme declarations.

Reimplemented from portals::Widget.

◆ unmount()

void portals::ScrollArea::unmount ( )
overridevirtual

Retire this node's lease and pointer token before destruction.

Reimplemented from portals::Widget.


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