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

Horizontal numeric view using the existing control style, layout and input runtime. NumericValue remains authoritative through its binding. Paint reads only prepared presentation. More...

#include <slider.hpp>

Inheritance diagram for portals::Slider:
portals::Sliderportals::Slider portals::Control portals::SizedWidget portals::Widget portals::LayoutItem

Public Member Functions

 Slider (WidthPolicy width={}, SliderOptions options={}, ControlStyle style={}, SizePolicy policy=DEFAULT_CONTENT_POLICY)
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< void, TreeError > arrange (CellRect local) override
std::expected< void, TreeError > paint (PaintContext &context) override
double value () const noexcept
NumericRange range () const noexcept
bool styleReadOnly () const noexcept override
bool readOnly () const noexcept
Public Member Functions inherited from portals::Control
const GraphemeText & text () const
 Inspect the control's owning Unicode text on UI.
bool focused () const
 Inspect the last synchronized focus presentation on UI.
bool enabled () const
 Inspect the last synchronized subtree eligibility presentation on UI.
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 void unmount ()
 Called once before destruction, children first; cleanup continues on exceptions.
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

class SliderBinding
class ManagedScene
std::expected< void, TreeError > setSliderReadOnly (WidgetTree &tree, Node< Slider > node, bool readOnly)

Additional Inherited Members

Protected Member Functions inherited from portals::Control
 Control (GraphemeText text, std::string_view prefix, std::string_view suffix, ControlStyle style, SizePolicy policy)
 Own text/options and create fixed ASCII decorations under the text's validated width policy.
 Control (GraphemeText text, GraphemeText prefix, GraphemeText checkedPrefix, ControlStyle style, SizePolicy policy)
 Own explicitly validated equal-width boolean decorations; no additional retained fields.
bool booleanChromeMatches () const
std::expected< void, TreeError > paintCaption (PaintContext &context, bool stretchChrome)
 Paint the synchronized caption with intrinsic or allocated-width decorations.
void showChecked (bool checked)
 Select a same-width prefix between frames; used only by the checkbox binding.
bool shownChecked () const
 Inspect the single checked presentation flag on UI.
void showMixed (bool mixed)
 Select the fixed mixed decoration after caller-owned paint invalidation.

Detailed Description

Horizontal numeric view using the existing control style, layout and input runtime. NumericValue remains authoritative through its binding. Paint reads only prepared presentation.

Constructor & Destructor Documentation

◆ Slider()

portals::Slider::Slider ( WidthPolicy width = {},
SliderOptions options = {},
ControlStyle style = {},
SizePolicy policy = DEFAULT_CONTENT_POLICY )
explicit
Parameters
widthComplete receiving text policy used to prepare track, fill and thumb glyphs.
optionsIntrinsic extent, page increment, paint cap, user-mutation policy and owning glyph selection.
styleOwning manual appearances beneath ordinary theme rules.
policyOwning layout constraints validated by the layout owner. Constructor arguments and glyph construction may throw; tree emplacement translates internal failures.

Member Function Documentation

◆ arrange()

std::expected< void, TreeError > portals::Slider::arrange ( CellRect local)
overridevirtual
Parameters
localParent-local allocation; only the extent is retained.
Returns
Success or INVALID_GEOMETRY; no model reads or callbacks occur.

Reimplemented from portals::Control.

◆ measure()

std::expected< CellSize, TreeError > portals::Slider::measure ( CellSize available)
overridevirtual
Parameters
availableOffered extent, ignored for intrinsic width.
Returns
Configured width and height one, or INVALID_ARGUMENT for invalid options.

Reimplemented from portals::Control.

◆ paint()

std::expected< void, TreeError > portals::Slider::paint ( PaintContext & context)
overridevirtual
Parameters
contextSynchronous sink borrowing this widget's glyphs through the frame.
Returns
Success, WOULD_BLOCK above the paint cap, or the unchanged sink error.

Reimplemented from portals::Control.

◆ range()

NumericRange portals::Slider::range ( ) const
inlinenoexcept
Returns
Last synchronized validated bounds and user increment.

◆ readOnly()

bool portals::Slider::readOnly ( ) const
inlinenoexcept
Returns
Whether user mutation is currently prohibited; focus remains available.

◆ styleReadOnly()

bool portals::Slider::styleReadOnly ( ) const
inlineoverridevirtualnoexcept
Returns
Whether the read-only style selector matches this slider.

Reimplemented from portals::Widget.

◆ value()

double portals::Slider::value ( ) const
inlinenoexcept
Returns
Last synchronized finite numeric value; borrow the widget only inside checked tree access.

◆ setSliderReadOnly

std::expected< void, TreeError > setSliderReadOnly ( WidgetTree & tree,
Node< Slider > node,
bool readOnly )
friend
Parameters
treeBorrowed UI tree.
nodeLive slider.
readOnlyNew user-mutation policy.
Returns
Checked tree result; equal settings do not invalidate. Programmatic writes remain allowed.

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