Class CliOverlayRenderers
Reusable CliOverlayRenderer factories for the common one-dimensional overlays
(vertical scrollbar, horizontal scroll indicators, time-/state-driven text such as a spinner or
clock). The renderers read only the already-measured CliGrid (scroll info) or a
caller-supplied content provider; they own no placement, measurement, or style. Callers (e.g.
InlineDialog) keep ownership of where each overlay is placed and what style it uses, and add
the resulting CliOverlay through AddOverlay(CliOverlay) as before.public static class CliOverlayRenderers
- Inheritance
-
CliOverlayRenderers
- Inherited Members
Methods
DynamicText(Func<string?>)
A generic text overlay driven by a content provider, suitable for spinners, clocks, or any small
dynamic indicator. The provider is read on every render: a
null/empty result, or content
that would overflow the reserved length, renders nothing (leaving the underlying cells intact);
otherwise the content is written. This is the shared mechanism behind activity/spinner overlays.public static CliOverlayRenderer DynamicText(Func<string?> provider)
Parameters
Returns
HorizontalIndicator(CliOverlayEdge)
A single-cell horizontal scroll indicator for the given
edge, driven by the
grid's active horizontal scroll info. The left indicator shows only when scrolled away from the
start; the right indicator shows only when more content remains to the right.public static CliOverlayRenderer HorizontalIndicator(CliOverlayEdge edge)
Parameters
edgeCliOverlayEdge
Returns
ProgressBar(Func<double>, CliOverlayGlyph, CliOverlayGlyph, CliOverlayGlyph?, char?, char?)
A horizontal multi-style progress-bar renderer, the styled counterpart to
ProgressBar(Func<double>, char, char, char?, char?). The leading
fraction of the
interior is drawn with done and the remainder with track; when
the fraction reaches 1.0 (100%) and completed is supplied, the whole filled
interior is drawn with completed instead of done — a
"completed state". Below 100% completed is never used, so a bar that merely rounds
up to a visually full interior (e.g. 0.99 on a tiny strip) is not treated as complete.
Each segment is a CliOverlayGlyph (glyph + optional style); a segment whose
Style is null falls back to the overlay's base
Style, exactly like any styled overlay. End caps
(leftCap/rightCap) behave as in the single-style factory: they
occupy the outer cell(s) and are dropped when the strip cannot also hold at least one interior cell;
caps carry no per-glyph style, so they use the overlay base style. The fraction is read on every
render and clamped to [0, 1]; the progress value calculation belongs to the caller's
provider. Styles are pre-resolved CliCharStyle values — this renderer stays
theme-agnostic.
public static CliStyledOverlayRenderer ProgressBar(Func<double> fractionProvider, CliOverlayGlyph done, CliOverlayGlyph track, CliOverlayGlyph? completed = null, char? leftCap = null, char? rightCap = null)
Parameters
fractionProviderFunc<double>doneCliOverlayGlyphtrackCliOverlayGlyphcompletedCliOverlayGlyph?leftCapchar?rightCapchar?
Returns
ProgressBar(Func<double>, char, char, char?, char?)
A horizontal progress-bar renderer. The leading
fraction of the bar uses
filled, the remainder track. When leftCap
and/or rightCap are supplied (e.g. '['/']'), those glyphs occupy
the end cell(s) and the bar fills the interior; caps are dropped when the strip is too short to also
hold at least one interior cell, so a tiny bar still fills. The fraction is read on every render from
fractionProvider and clamped to [0, 1]. Because overlays receive the post-layout
renderLength, placing the bar's column under Star lets
CliGrid own the width — no local measurement is needed. The progress value
calculation (current/max, clamping) belongs to the caller and is supplied through the provider.public static CliOverlayRenderer ProgressBar(Func<double> fractionProvider, char filled = '█', char track = '░', char? leftCap = null, char? rightCap = null)
Parameters
Returns
VerticalScrollBar()
A vertical scrollbar renderer: up/down arrows at the ends and a proportional thumb on the track,
driven by the grid's active vertical scroll info. Renders nothing when there is no visible
vertical scroll region or the strip is too short to hold both arrows.
public static CliOverlayRenderer VerticalScrollBar()