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

Independent one-axis projection of an owning controller, without a content offset. Initialization chooses a sole standalone metrics writer or an area-owned read projection. Before initialization paint is empty and checked commands fail with INVALID_ARGUMENT. No timers, virtual-view adapters, tree ownership or observer runtime are retained. More...

#include <scroll_controls.hpp>

Inheritance diagram for portals::ScrollBar:
portals::ScrollBarportals::ScrollBar portals::SizedWidget portals::Widget portals::LayoutItem

Public Member Functions

 ScrollBar (std::shared_ptr< ScrollController > controller={}, ScrollAxis axis=ScrollAxis::VERTICAL, WidthPolicy width={}, ScrollBarOptions options={}, ControlStyle style={})
 ScrollBar (std::shared_ptr< ScrollController > controller, ScrollAxis axis, WidthPolicy width, ScrollBarOptions options, ControlStyle style, SizePolicy policy)
 Use an explicit policy without applying orientation-dependent defaults.
 ~ScrollBar () override
 Release owning values without user callbacks or terminal operations.
void unmount () override
 Release this node's lease and pointer token.
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< void, TreeError > arrange (CellRect local) 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.

Friends

struct detail::ScrollWidgetAccess

Detailed Description

Independent one-axis projection of an owning controller, without a content offset. Initialization chooses a sole standalone metrics writer or an area-owned read projection. Before initialization paint is empty and checked commands fail with INVALID_ARGUMENT. No timers, virtual-view adapters, tree ownership or observer runtime are retained.

Constructor & Destructor Documentation

◆ ScrollBar() [1/2]

portals::ScrollBar::ScrollBar ( std::shared_ptr< ScrollController > controller = {},
ScrollAxis axis = ScrollAxis::VERTICAL,
WidthPolicy width = {},
ScrollBarOptions options = {},
ControlStyle style = {} )
explicit
Parameters
controllerShared values; empty creates a default controller on this UI thread.
axisHORIZONTAL or VERTICAL; invalid values fail initialization/measurement.
widthComplete owning glyph policy.
optionsOwning input/paint settings.
styleConstruction-only defaults beneath theme declarations.
Exceptions
std::bad_allocOn allocation; tree emplacement translates internal exceptions.

◆ ScrollBar() [2/2]

portals::ScrollBar::ScrollBar ( std::shared_ptr< ScrollController > controller,
ScrollAxis axis,
WidthPolicy width,
ScrollBarOptions options,
ControlStyle style,
SizePolicy policy )
explicit

Use an explicit policy without applying orientation-dependent defaults.

Parameters
controllerShared values; empty creates a default controller on this UI thread.
axisHORIZONTAL or VERTICAL; invalid values fail initialization/measurement.
widthComplete owning glyph policy.
optionsOwning input/paint settings.
styleConstruction-only defaults beneath theme declarations.
policyOwning layout constraints, including an explicit automatic policy.
Exceptions
std::bad_allocOn allocation; tree emplacement translates internal exceptions.

Member Function Documentation

◆ arrange()

std::expected< void, TreeError > portals::ScrollBar::arrange ( CellRect local)
overridevirtual
Parameters
localParent-local allocation; caches zero-origin track geometry and owning values.
Returns
Success or checked settings/controller/geometry error.

Reimplemented from portals::Widget.

◆ measure()

std::expected< CellSize, TreeError > portals::ScrollBar::measure ( CellSize available)
overridevirtual
Parameters
availableOffered extent; the intrinsic bar occupies one cell across its axis.
Returns
One-cell intrinsic size or invalid settings/controller error.

Reimplemented from portals::Widget.

◆ paint()

std::expected< void, TreeError > portals::ScrollBar::paint ( PaintContext & context)
overridevirtual
Parameters
contextSynchronous sink borrowing widget-owned glyphs through the frame.
Returns
Success, WOULD_BLOCK above budget before submission, or sink error.

Reimplemented from portals::Widget.

◆ styleDefaults()

ComputedStyle portals::ScrollBar::styleDefaults ( ) const
overridevirtual
Returns
Owning defaults beneath theme declarations.

Reimplemented from portals::Widget.

◆ unmount()

void portals::ScrollBar::unmount ( )
overridevirtual

Release this node's lease and pointer token.

Reimplemented from portals::Widget.


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