Class ListBuilder
- Namespace
- MiniTui
- Assembly
- MiniTui.dll
A bordered, scrollable list with a selection.
public class ListBuilder
- Inheritance
-
ListBuilder
- Inherited Members
Examples
Widget.List().Title("Files").Items(files, f => f.Name).State(selection).Focused().Draw(buf, area);
Methods
Block(BlockBuilder)
The border around the list. By default, a single-line border on all sides.
public ListBuilder Block(BlockBuilder block)
Parameters
blockBlockBuilder
Returns
Draw(Buffer, Rect)
Draw the list to the buffer.
public void Draw(Buffer buf, Rect area)
Parameters
Focused(bool)
Set whether the list is focused: the border and selection use the focused styles.
public ListBuilder Focused(bool focused = true)
Parameters
focusedbool
Returns
HighlightStyle(Style)
A style patched over the theme's selection style.
public ListBuilder HighlightStyle(Style style)
Parameters
styleStyle
Returns
HighlightSymbol(string)
A marker drawn before the selected item, such as "> ". Other items are indented to match.
public ListBuilder HighlightSymbol(string symbol)
Parameters
symbolstring
Returns
Hover(Vec2?)
The pointer, usually Hover. Hover is patched over the row under it, unless it's the selected one (1.x spec §17.6).
public ListBuilder Hover(Vec2? position)
Parameters
positionVec2?
Returns
Items(IReadOnlyList<string>)
The items to display.
public ListBuilder Items(IReadOnlyList<string> items)
Parameters
itemsIReadOnlyList<string>
Returns
Items<T>(IReadOnlyList<T>, Func<T, Line>)
The items to display, formatted by format. Only visible items are formatted.
public ListBuilder Items<T>(IReadOnlyList<T> items, Func<T, Line> format)
Parameters
itemsIReadOnlyList<T>formatFunc<T, Line>
Returns
Type Parameters
T
ScrollOffset(int)
Set the scroll offset. The list adjusts it so the selection is visible.
public ListBuilder ScrollOffset(int offset)
Parameters
offsetint
Returns
Selected(int)
Set the selected item index.
public ListBuilder Selected(int index)
Parameters
indexint
Returns
ShowScrollInfo(bool)
Show or hide scroll position info in title (default: true).
public ListBuilder ShowScrollInfo(bool show = true)
Parameters
showbool
Returns
State(SelectionState)
The selection. The list clamps it and scrolls to keep it visible.
public ListBuilder State(SelectionState state)
Parameters
stateSelectionState
Returns
Style(Style)
A style patched over the theme's text style.
public ListBuilder Style(Style style)
Parameters
styleStyle
Returns
Title(string)
Set the list title. Scroll info such as [1-10 of 50] is appended unless turned off.
public ListBuilder Title(string title)
Parameters
titlestring