Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides a scrollable list type and functions for manipulating and rendering it.
- data List e
- list :: Name -> Vector e -> Int -> List e
- renderList :: List e -> (Bool -> e -> Widget) -> Widget
- listElementsL :: forall e e. Lens (List e) (List e) (Vector e) (Vector e)
- listSelectedL :: forall e. Lens' (List e) (Maybe Int)
- listNameL :: forall e. Lens' (List e) Name
- listItemHeightL :: forall e. Lens' (List e) Int
- listMoveBy :: Int -> List e -> List e
- listMoveTo :: Int -> List e -> List e
- listMoveUp :: List e -> List e
- listMoveDown :: List e -> List e
- listInsert :: Int -> e -> List e -> List e
- listRemove :: Int -> List e -> List e
- listReplace :: Eq e => Vector e -> List e -> List e
- listSelectedElement :: List e -> Maybe (Int, e)
- listAttr :: AttrName
- listSelectedAttr :: AttrName
Documentation
List state. Lists have an element type e
that is the data stored
by the list. Lists handle the following events by default:
- Up/down arrow keys: move cursor of selected item
- Page up / page down keys: move cursor of selected item by one page at a time (based on the number of items shown)
- Home/end keys: move cursor of selected item to beginning or end of list
HandleEvent (List e) Source |
Consructing a list
:: Name | The list name (must be unique) |
-> Vector e | The initial list contents |
-> Int | The list item height in rows (all list item widgets must be this high) |
-> List e |
Construct a list in terms of an element type e
.
Rendering a list
renderList :: List e -> (Bool -> e -> Widget) -> Widget Source
Turn a list state value into a widget given an item drawing function.
Lenses
listItemHeightL :: forall e. Lens' (List e) Int Source
Manipulating a list
listMoveBy :: Int -> List e -> List e Source
Move the list selected index by the specified amount, subject to validation.
listMoveTo :: Int -> List e -> List e Source
Set the selected index for a list to the specified index, subject to validation.
listMoveUp :: List e -> List e Source
Move the list selected index up by one. (Moves the cursor up, subtracts one from the index.)
listMoveDown :: List e -> List e Source
Move the list selected index down by one. (Moves the cursor down, adds one to the index.)
Insert an item into a list at the specified position.
Remove an element from a list at the specified position.
listReplace :: Eq e => Vector e -> List e -> List e Source
Replace the contents of a list with a new set of elements but preserve the currently selected index.
listSelectedElement :: List e -> Maybe (Int, e) Source
Return a list's selected element, if any.
Attributes
listSelectedAttr :: AttrName Source
The attribute used only for the currently-selected list item.
Extends listAttr
.