Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
scroll_options.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <optional>
6#include <portals/primitives.hpp>
7#include <portals/scroll_geometry.hpp>
8
9// Keep the existing glyph defaults available under native Unicode headers, then restore their macro.
10#pragma push_macro("UNICODE")
11#undef UNICODE
12
13namespace portals {
18 double wheelStep{3};
19 std::uint64_t keyStep{1};
20 std::uint64_t pageOverlap{1};
21 std::int32_t minimumThumb{1};
23 std::size_t maxPaintCells{16384};
24 bool focusable{true};
25 bool readOnly{};
26 bool arrows{};
27 std::uint64_t arrowDelay{350};
28 std::uint64_t arrowRepeat{60};
29 std::uint16_t smoothDurationMs{120};
30};
31
40 std::optional<BorderOptions> frame;
41 double wheelStep{3};
42 std::uint64_t keyStep{1};
43 std::uint64_t pageOverlap{1};
44 std::int32_t minimumThumb{1};
46 std::size_t maxPaintCells{16384};
47 bool focusable{true};
48 bool readOnly{};
49 bool arrows{};
50 std::uint64_t arrowDelay{350};
51 std::uint64_t arrowRepeat{60};
52 std::uint16_t smoothDurationMs{120};
53};
54
60[[nodiscard]] std::expected<void, TreeError> validateScrollOptions(const ScrollBarOptions &options) noexcept;
61
67[[nodiscard]] std::expected<void, TreeError> validateScrollOptions(const ScrollAreaOptions &options) noexcept;
68} // namespace portals
69
70#pragma pop_macro("UNICODE")
Public Portals API.
Definition action.hpp:8
ScrollBarPolicy
Presence policy, independent of whether the content can scroll.
Definition scroll_geometry.hpp:21
@ AUTO
Show a bar only when its logical extent exceeds the viewport.
Definition scroll_geometry.hpp:23
PrimitiveGlyphs
One-cell decoration selection under the complete receiving WidthPolicy.
Definition primitives.hpp:20
@ UNICODE
Unicode lines/blocks, falling back to ASCII when a glyph is not one cell.
Definition primitives.hpp:21
ScrollPlacement
Explicit relationship between bars, content and an optional frame.
Definition scroll_geometry.hpp:28
@ RESERVED
Bars occupy one-cell gutters outside the logical viewport.
Definition scroll_geometry.hpp:29
std::expected< void, TreeError > validateScrollOptions(const ScrollBarOptions &options) noexcept
Validate standalone bar settings without mutation, allocation or callbacks.
Owning ordinary-area settings; content is retained rather than automatically virtualized....
Definition scroll_options.hpp:36
PrimitiveGlyphs glyphs
Existing one-cell Unicode/ASCII glyph policy.
Definition scroll_options.hpp:45
std::uint64_t arrowDelay
Positive milliseconds before the first held-arrow repeat.
Definition scroll_options.hpp:50
bool focusable
Whether the owning area participates in Tab traversal.
Definition scroll_options.hpp:47
std::optional< BorderOptions > frame
Optional existing one-cell outline, without a second inset.
Definition scroll_options.hpp:40
std::uint64_t pageOverlap
Shared cells between pages; values above viewport are supported.
Definition scroll_options.hpp:43
std::int32_t minimumThumb
Positive minimum thumb cells, capped by the actual track.
Definition scroll_options.hpp:44
std::uint64_t keyStep
Positive integral logical cells per arrow event.
Definition scroll_options.hpp:42
std::size_t maxPaintCells
Positive total outline-plus-track paint-work limit.
Definition scroll_options.hpp:46
ScrollPlacement placement
Explicit gutter/overlay/frame placement.
Definition scroll_options.hpp:39
bool readOnly
Reject user scrolling while permitting focus reveal/programmatic commands.
Definition scroll_options.hpp:48
bool arrows
Reserve functional end buttons on channels of at least three cells.
Definition scroll_options.hpp:49
std::uint16_t smoothDurationMs
Fractional input transition duration; zero keeps immediate movement.
Definition scroll_options.hpp:52
ScrollBarPolicy horizontal
Horizontal bar presence policy.
Definition scroll_options.hpp:37
ScrollBarPolicy vertical
Vertical bar presence policy.
Definition scroll_options.hpp:38
double wheelStep
Positive finite logical cells per decoded wheel event.
Definition scroll_options.hpp:41
std::uint64_t arrowRepeat
Positive milliseconds between held-arrow steps; no catch-up burst.
Definition scroll_options.hpp:51
Owning standalone bar settings, validated before mounting or replacement. No callbacks,...
Definition scroll_options.hpp:17
std::size_t maxPaintCells
Positive total track paint-work limit.
Definition scroll_options.hpp:23
bool arrows
Reserve functional end buttons when the actual channel has at least three cells.
Definition scroll_options.hpp:26
std::uint64_t arrowRepeat
Positive milliseconds between held-arrow steps; no catch-up burst.
Definition scroll_options.hpp:28
std::uint64_t pageOverlap
Shared cells between pages; values above viewport are supported.
Definition scroll_options.hpp:20
std::int32_t minimumThumb
Positive minimum thumb cells, capped by the actual track.
Definition scroll_options.hpp:21
std::uint64_t keyStep
Positive integral logical cells per arrow event.
Definition scroll_options.hpp:19
PrimitiveGlyphs glyphs
One-cell glyph mode with existing ASCII fallback.
Definition scroll_options.hpp:22
bool readOnly
Reject user offset changes; checked programmatic commands remain possible.
Definition scroll_options.hpp:25
std::uint16_t smoothDurationMs
Fractional input transition duration; zero keeps immediate movement.
Definition scroll_options.hpp:29
double wheelStep
Positive finite logical cells per decoded wheel event.
Definition scroll_options.hpp:18
std::uint64_t arrowDelay
Positive milliseconds before the first held-arrow repeat.
Definition scroll_options.hpp:27
bool focusable
Whether the standalone bar participates in Tab traversal.
Definition scroll_options.hpp:24