5#include <portals/controls.hpp>
6#include <portals/numeric.hpp>
34 std::optional<SliderGlyphs>
glyphs{};
54 std::shared_ptr<const PropertyChange<NumericValue>>
initial;
89 return value_.value();
94 return value_.range();
99 return options_.readOnly;
104 return options_.readOnly;
112 void placeThumb() noexcept;
114 struct RuntimeOptions {
115 std::int32_t preferredWidth;
116 std::uint64_t pageSteps;
117 std::size_t maxPaintCells;
122 RuntimeOptions options_;
126 bool validGlyphs_{
true};
129 std::int32_t thumbColumn_{};
159 std::expected<void, TreeError>
sync();
163 friend class ManagedScene;
169 void retain(std::shared_ptr<void> record);
170 std::shared_ptr<void> retained()
const;
172 std::shared_ptr<State> state_;
Move-only scoped disconnect token; never owns a tree or widget. Disconnect/destruction may run on any...
Definition action.hpp:96
An owning, invariant-preserving half-open cell rectangle.
Definition geometry.hpp:81
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.
UI-owned focus and synchronous bubbling over an existing WidgetTree. Tree and Scheduler must outlive ...
Definition action.hpp:169
Owning validated UTF-8 and immutable extended grapheme measurements.
Definition text.hpp:145
Additive lifecycle owner over one existing Application subtree. UI affine and nonmovable....
Definition managed.hpp:530
Copyable typed observer; never owns or exposes an unchecked widget pointer.
Definition widget.hpp:92
Small owning numeric snapshot whose public operations preserve its finite range invariant....
Definition numeric.hpp:34
Borrowed synchronous command sink supplied by the frame owner. submit must consume commands immediate...
Definition widget_types.hpp:66
UI-owned typed value with node-scoped observers and explicit partial delivery. WidgetTree and its Sch...
Definition property.hpp:62
Own one native slider binding without a second scheduler or numeric model runtime....
Definition slider.hpp:143
SliderBinding(SliderBinding &&other) noexcept
SliderBinding & operator=(SliderBinding &&other) noexcept
~SliderBinding()
Retire future input and data delivery on UI; executing callbacks keep their captures.
std::expected< void, TreeError > sync()
Adopt the latest model and detect interrupted drags before a frame.
friend std::expected< SliderBinding, TreeError > bindSlider(WidgetTree &, EventRouter &, Node< Slider >, std::shared_ptr< Property< NumericValue > >, std::function< void(SliderResult)>, std::function< void(const SliderOperationEvent &)>)
NumericRange range() const noexcept
Definition slider.hpp:93
bool styleReadOnly() const noexcept override
Definition slider.hpp:98
Slider(WidthPolicy width={}, SliderOptions options={}, ControlStyle style={}, SizePolicy policy=DEFAULT_CONTENT_POLICY)
std::expected< void, TreeError > arrange(CellRect local) override
friend std::expected< void, TreeError > setSliderReadOnly(WidgetTree &, Node< Slider >, bool)
std::expected< void, TreeError > paint(PaintContext &context) override
bool readOnly() const noexcept
Definition slider.hpp:103
double value() const noexcept
Definition slider.hpp:88
std::expected< CellSize, TreeError > measure(CellSize available) override
UI-owned move-only cancellation token. Release before Scheduler. Disconnect is immediate logically; a...
Definition scheduler.hpp:121
Public Portals API.
Definition action.hpp:8
@ ROUNDED
Single lines and rounded corners.
Definition frame.hpp:12
SliderOperationStatus
One completed or interrupted numeric user operation.
Definition slider.hpp:38
@ COMPLETED
Normal matching release or one accepted keyboard action.
Definition slider.hpp:39
@ LINE
Join consecutive finite closes, leaving gaps disconnected.
Definition chart.hpp:50
SliderSkin
Built-in one-cell slider glyph sets.
Definition slider.hpp:11
@ BLOCKS
Shaded track and solid filled prefix.
Definition slider.hpp:15
@ ASCII
Compatible default, retaining the original unfilled appearance.
Definition slider.hpp:12
std::expected< PropertyUpdate< NumericValue >, TreeError > SliderResult
Exact numeric Property operation receipt; unexpected means no commit.
Definition slider.hpp:138
constexpr SizePolicy DEFAULT_CONTENT_POLICY
Intrinsic content on both axes; explicit policies remain authoritative.
Definition layout.hpp:44
SliderOperationKind
Origin of a local numeric operation, without a global command/history identity.
Definition slider.hpp:45
@ STEP
One keyboard press/repeat or a click on a host without capture support.
Definition slider.hpp:47
@ DRAG
One admitted mouse press and its captured continuation.
Definition slider.hpp:46
@ CANCELLED
Explicit cancellation or replacement stopped the invocation.
Definition async.hpp:29
@ ASCII
Portable vertical bar and hash brushes.
Definition chart.hpp:56
@ CONFLICT
The model revision changed since this draft began.
Definition line_edit.hpp:86
@ COMPLETED
Synchronous action/dispatch returned.
Definition diagnostics.hpp:34
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={})
std::expected< void, TreeError > setSliderReadOnly(WidgetTree &tree, Node< Slider > node, bool readOnly)
TreeError
Checked tree failures; rejected operations never start the requested callback.
Definition widget_types.hpp:26
An owning available extent in terminal columns/rows.
Definition geometry.hpp:44
Owning inclusive bounds and user increment; validated together with a numeric value.
Definition numeric.hpp:22
Owning custom one-cell printable graphemes used for slider parts. Each value is at most 64 UTF-8 byte...
Definition slider.hpp:21
std::string track
Unfilled track grapheme.
Definition slider.hpp:22
std::string thumb
Thumb grapheme.
Definition slider.hpp:24
std::string fill
Filled-prefix grapheme.
Definition slider.hpp:23
Owning operation observation; model revisions and live onChange calls can be numerous.
Definition slider.hpp:51
std::shared_ptr< const PropertyChange< NumericValue > > initial
Independent starting snapshot.
Definition slider.hpp:54
SliderOperationStatus status
Completion or interruption cause.
Definition slider.hpp:53
std::optional< PropertyUpdate< NumericValue > > lastUserUpdate
Exact last changed user receipt, if any.
Definition slider.hpp:55
SliderOperationKind kind
Input sequence being completed.
Definition slider.hpp:52
Horizontal slider presentation and user-input configuration.
Definition slider.hpp:28
std::uint64_t pageSteps
Positive increments applied by PageUp/PageDown.
Definition slider.hpp:30
std::int32_t preferredWidth
Nonnegative intrinsic width in cells; intrinsic height is one.
Definition slider.hpp:29
std::size_t maxPaintCells
Positive bound on the allocated background area, including extra rows.
Definition slider.hpp:31
bool readOnly
User mutation gate; programmatic model writes remain allowed.
Definition slider.hpp:32
std::optional< SliderGlyphs > glyphs
Owning custom one-cell glyphs, validated using the receiving width policy.
Definition slider.hpp:34
SliderSkin skin
Valid built-in set; custom glyphs override it, and incompatible built-ins fall back to ASCII.
Definition slider.hpp:33
Owning deterministic width policy; no font or terminal matching promise.
Definition text.hpp:42