|
Graphics.Vty.Widgets.List |
|
|
|
|
Description |
This module provides a List widget for rendering a list of
arbitrary widgets. A List has the following features:
- A style for the list elements
- A styled cursor indicating which element is selected
- A window size indicating how many elements should be visible to
the user
- An internal pointer to the start of the visible window, which
automatically shifts as the list is scrolled
|
|
Synopsis |
|
|
|
Documentation |
|
|
The list widget type. Lists are parameterized over the internal
identifier type a, the type of internal identifiers used to
refer to the visible representations of the list contents, and the
widget type b, the type of widgets used to represent the list
visually.
| Instances | |
|
|
|
|
type ListItem a b = (a, b) | Source |
|
A list item. Each item contains an arbitrary internal identifier
a and a widget b representing it.
|
|
List creation
|
|
|
:: Widget b | | => Attr | The attribute of normal, non-selected items
| -> Attr | The attribute of the selected item
| -> Int | The scrolling window size, i.e., the number of items
which should be visible to the user at any given time
| -> [ListItem a b] | The list items
| -> List a b | | Create a new list. Emtpy lists and empty scrolling windows are
not allowed.
|
|
|
|
:: Attr | The attribute of normal, non-selected items
| -> Attr | The attribute of the selected item
| -> Int | The scrolling window size, i.e., the number of
items which should be visible to the user at
any given time
| -> [String] | The list items
| -> SimpleList | | A convenience function to create a new list using Strings as the
internal identifiers and Text widgets to represent those strings.
|
|
|
List manipulation
|
|
|
Scroll a list up or down by the specified number of positions and
return the new scrolled list. Scrolling by a positive amount
scrolls downward and scrolling by a negative amount scrolls upward.
This automatically takes care of managing internal list state:
- Moves the cursor by the specified amount and clamps the cursor
position to the beginning or the end of the list where
appropriate
- Moves the scrolling window position if necessary (i.e., if the
cursor moves to an item not currently in view)
|
|
|
Scroll a list up by one position.
|
|
|
Scroll a list down by one position.
|
|
|
Scroll a list up by one page from the current cursor position.
|
|
|
Scroll a list down by one page from the current cursor position.
|
|
|
Set the window size of the list. This automatically adjusts the
window position to keep the selected item visible.
|
|
List inspection
|
|
|
The items in the list.
|
|
|
Get the currently selected list item.
|
|
|
The currently selected list index.
|
|
|
The start index of the window of visible list
items.
|
|
|
The size of the window of visible list items.
|
|
|
Given a List, return the items that are currently visible
according to the state of the list. Returns the visible items and
flags indicating whether each is selected.
|
|
Produced by Haddock version 2.4.2 |