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

Own one native slider binding without a second scheduler or numeric model runtime. Tree/router/scheduler must outlive this UI-affine token. Admitted callbacks retain their state. More...

#include <slider.hpp>

Public Member Functions

 ~SliderBinding ()
 Retire future input and data delivery on UI; executing callbacks keep their captures.
 SliderBinding (SliderBinding &&other) noexcept
SliderBinding & operator= (SliderBinding &&other) noexcept
 SliderBinding (const SliderBinding &)=delete
SliderBinding & operator= (const SliderBinding &)=delete
std::expected< void, TreeError > sync ()
 Adopt the latest model and detect interrupted drags before a frame.

Friends

class ManagedScene
std::expected< SliderBinding, TreeError > bindSlider (WidgetTree &tree, EventRouter &router, Node< Slider > node, std::shared_ptr< Property< NumericValue > > model, std::function< void(SliderResult)> changed, std::function< void(const SliderOperationEvent &)> finished={})

Detailed Description

Own one native slider binding without a second scheduler or numeric model runtime. Tree/router/scheduler must outlive this UI-affine token. Admitted callbacks retain their state.

Constructor & Destructor Documentation

◆ SliderBinding()

portals::SliderBinding::SliderBinding ( SliderBinding && other)
noexcept
Parameters
otherUI-owned token emptied by this transfer.

Member Function Documentation

◆ operator=()

SliderBinding & portals::SliderBinding::operator= ( SliderBinding && other)
noexcept
Parameters
otherUI-owned token installed before old captures are retired.
Returns
This token; callbacks cannot observe a partially replaced binding.

◆ sync()

std::expected< void, TreeError > portals::SliderBinding::sync ( )

Adopt the latest model and detect interrupted drags before a frame.

Returns
Success or typed tree/model/publication error; user callbacks are deferred to the data lane.

◆ bindSlider

std::expected< SliderBinding, TreeError > bindSlider ( WidgetTree & tree,
EventRouter & router,
Node< Slider > node,
std::shared_ptr< Property< NumericValue > > model,
std::function< void(SliderResult)> changed,
std::function< void(const SliderOperationEvent &)> finished = {} )
friend
Parameters
treeBorrowed UI tree, required to outlive the binding and model.
routerBorrowed router for this tree, required to outlive the binding.
nodeLive slider receiving input and synchronized presentation.
modelRequired shared owner of an invariant-preserving numeric Property.
changedRequired exact user-commit observation; external writes and no-ops never invoke it.
finishedOptional owning operation observation, once per completed/cancelled/conflicted gesture.
Returns
Scoped native binding or existing tree/router/model admission/allocation errors. Callbacks may remove their node or destroy the token. Removal suppresses subsequent delivery. Callback construction before entry can throw. Notification rejection never rolls back a model commit.

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