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.
Assembly: DarkEffekt.Terminal.UI
Section titled “Assembly: DarkEffekt.Terminal.UI”public sealed class ScrollBar : ElementInheritance: System.Object -> DarkEffekt.Terminal.UI.Element
Properties
Section titled “Properties”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.
public int Value { get; set; }Maximum
Section titled “Maximum”The content’s extent along the axis, in cells.
public int Maximum { get; set; }Viewport
Section titled “Viewport”The viewport’s extent along the axis, in cells.
public int Viewport { get; set; }The cells one wheel notch moves.
public int Step { get; set; }OnChanged
Section titled “OnChanged”public Action<int> OnChanged { get; set; }This bar’s glyphs. Null takes the interface’s DarkEffekt.Terminal.UI.TerminalUI.ScrollBarStyle.
public ScrollBarStyle Style { get; set; }CanScroll
Section titled “CanScroll”True when the content is larger than the viewport, so the bar has somewhere to go.
public bool CanScroll { get; }Methods
Section titled “Methods”MeasureCore(CellSize)
Section titled “MeasureCore(CellSize)”The size this element wants, within the room given.
protected override CellSize MeasureCore(CellSize available)Returns
Section titled “Returns”DarkEffekt.Terminal.UI.CellSize
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellSize | available |
Thumb(int, int, int, int)
Section titled “Thumb(int, int, int, int)”The thumb’s first cell and length along a track of the given length.
public static (int start, int length) Thumb(int track, int value, int viewport, int maximum)Returns
Section titled “Returns”System.ValueTuple<System.Int32,System.Int32>
Parameters
Section titled “Parameters”| 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.
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)Parameters
Section titled “Parameters”| 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 |
RenderCore(CellCanvas)
Section titled “RenderCore(CellCanvas)”protected override void RenderCore(CellCanvas canvas)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellCanvas | canvas |
OnMouse(in TermMouseEvent)
Section titled “OnMouse(in TermMouseEvent)”A pointer event on this element. Return true when it was used.
public override bool OnMouse(in TermMouseEvent e)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.TermMouseEvent | e |