Skip to content

Class ScrollBar

A track with a thumb that shows where a viewport sits over content larger than it. One cell wide across its axis. The thumb drags, a click on the track pages, and the wheel steps. A DarkEffekt.Terminal.UI.ScrollView, a DarkEffekt.Terminal.UI.ListView, and a DarkEffekt.Terminal.UI.LogView carry their own; use one directly for a region you scroll yourself.

Declaration
public sealed class ScrollBar : Element

Inheritance: System.Object -> DarkEffekt.Terminal.UI.Element

Declaration
public Axis Axis { get; set; }

The first cell of the content the viewport shows, from 0 to DarkEffekt.Terminal.UI.ScrollBar.Maximum - DarkEffekt.Terminal.UI.ScrollBar.Viewport.

Declaration
public int Value { get; set; }

The content’s extent along the axis, in cells.

Declaration
public int Maximum { get; set; }

The viewport’s extent along the axis, in cells.

Declaration
public int Viewport { get; set; }

The cells one wheel notch moves.

Declaration
public int Step { get; set; }
Declaration
public Action<int> OnChanged { get; set; }

This bar’s glyphs. Null takes the interface’s DarkEffekt.Terminal.UI.TerminalUI.ScrollBarStyle.

Declaration
public ScrollBarStyle Style { get; set; }

True when the content is larger than the viewport, so the bar has somewhere to go.

Declaration
public bool CanScroll { get; }

The size this element wants, within the room given.

Declaration
protected override CellSize MeasureCore(CellSize available)

DarkEffekt.Terminal.UI.CellSize

Type Name
DarkEffekt.Terminal.UI.CellSize available

The thumb’s first cell and length along a track of the given length.

Declaration
public static (int start, int length) Thumb(int track, int value, int viewport, int maximum)

System.ValueTuple<System.Int32,System.Int32>

Type Name
System.Int32 track
System.Int32 value
System.Int32 viewport
System.Int32 maximum

Draw(CellCanvas, CellRect, Axis, int, int, int, TermColor, TermColor, TermColor, ScrollBarStyle)

Section titled “Draw(CellCanvas, CellRect, Axis, int, int, int, TermColor, TermColor, TermColor, ScrollBarStyle)”

Draws a bar in a rectangle one cell wide or tall, for an element that scrolls on its own.

Declaration
public static void Draw(CellCanvas canvas, CellRect rect, Axis axis, int value, int viewport, int maximum, TermColor thumb, TermColor track, TermColor bg, ScrollBarStyle style = null)
Type Name
DarkEffekt.Terminal.UI.CellCanvas canvas
DarkEffekt.Terminal.UI.CellRect rect
DarkEffekt.Terminal.UI.Axis axis
System.Int32 value
System.Int32 viewport
System.Int32 maximum
DarkEffekt.Terminal.TermColor thumb
DarkEffekt.Terminal.TermColor track
DarkEffekt.Terminal.TermColor bg
DarkEffekt.Terminal.UI.ScrollBarStyle style
Declaration
protected override void RenderCore(CellCanvas canvas)
Type Name
DarkEffekt.Terminal.UI.CellCanvas canvas

A pointer event on this element. Return true when it was used.

Declaration
public override bool OnMouse(in TermMouseEvent e)

System.Boolean

Type Name
DarkEffekt.Terminal.TermMouseEvent e