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

Shared owning, UI-affine scroll values built on the existing ScrollState. The controller owns no tree/widget/router references or observer runtime. Public access is read-only after checked creation; mounted commands must use their checked node/tree owner. Shared ownership does not permit concurrent mutation. Final destruction only releases values and may occur on any thread; checked queries require the creating UI thread. More...

#include <scroll_controller.hpp>

Public Member Functions

 ~ScrollController ()
 Release values; no callbacks, tree access or thread-affine cleanup occurs.
 ScrollController (const ScrollController &)=delete
ScrollController & operator= (const ScrollController &)=delete
std::expected< ScrollControllerSnapshot, TreeError > snapshot () const noexcept
 Observe both axes atomically on the creating UI thread.

Static Public Member Functions

static std::expected< std::shared_ptr< ScrollController >, TreeError > create (ScrollControllerOptions options=ScrollControllerOptions{})
 Validate and atomically create both initial axes on the current UI thread.

Friends

struct detail::ScrollControllerAccess

Detailed Description

Shared owning, UI-affine scroll values built on the existing ScrollState. The controller owns no tree/widget/router references or observer runtime. Public access is read-only after checked creation; mounted commands must use their checked node/tree owner. Shared ownership does not permit concurrent mutation. Final destruction only releases values and may occur on any thread; checked queries require the creating UI thread.

Member Function Documentation

◆ create()

std::expected< std::shared_ptr< ScrollController >, TreeError > portals::ScrollController::create ( ScrollControllerOptions options = ScrollControllerOptions{})
staticnodiscard

Validate and atomically create both initial axes on the current UI thread.

Parameters
optionsOwning metrics and intended offsets; all uint64 metrics are supported.
Returns
Shared controller, INVALID_ARGUMENT for an invalid fraction, or NO_MEMORY.
Note
Initial positions clamp to extent-viewport, with position zero for a zero viewport. No tree mutation, invalidation, callbacks or terminal I/O occur.

◆ snapshot()

std::expected< ScrollControllerSnapshot, TreeError > portals::ScrollController::snapshot ( ) const
nodiscardnoexcept

Observe both axes atomically on the creating UI thread.

Returns
Owning values from one revision, or WRONG_THREAD without reading mutable state.
Note
No allocation, mutation, invalidation, callbacks or borrowed result storage.

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