Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
GHCup.Brick.Widgets.SectionList
Synopsis
- data GenericSectionList n t e = GenericSectionList {
- sectionListFocusRing :: FocusRing n
- sectionListElements :: !(Vector (GenericList n t e))
- sectionListName :: n
- sectionListNameL :: forall n t e. Lens' (GenericSectionList n t e) n
- sectionListFocusRingL :: forall n t e. Lens' (GenericSectionList n t e) (FocusRing n)
- sectionListElementsL :: forall n t e t e. Lens (GenericSectionList n t e) (GenericSectionList n t e) (Vector (GenericList n t e)) (Vector (GenericList n t e))
- type SectionList n e = GenericSectionList n Vector e
- class ListItemSectionNameIndex n where
- getListItemSectionNameIndex :: n -> Maybe (n, Int)
- sectionList :: Foldable t => n -> [(n, t e)] -> Int -> GenericSectionList n t e
- sectionL :: Eq n => n -> Lens' (GenericSectionList n t e) (GenericList n t e)
- moveDown :: (Splittable t, Ord n, Foldable t) => EventM n (GenericSectionList n t e) ()
- moveUp :: (Splittable t, Ord n, Foldable t) => EventM n (GenericSectionList n t e) ()
- sectionListSelectItem :: (Splittable t, Eq n, ListItemSectionNameIndex n, Foldable t) => n -> EventM n (GenericSectionList n t e) ()
- handleGenericListEvent :: (Foldable t, Splittable t, Ord n, ListItemSectionNameIndex n) => BrickEvent n a -> EventM n (GenericSectionList n t e) ()
- renderSectionList :: forall n t e. (Traversable t, Ord n, Show n, Eq n, Splittable t, Semigroup (t e)) => (Int -> Bool -> e -> Widget n) -> Bool -> GenericSectionList n t e -> Widget n
- sectionListSelectedElement :: (Eq n, Splittable t, Traversable t, Semigroup (t e)) => GenericSectionList n t e -> Maybe (Int, e)
Documentation
data GenericSectionList n t e Source #
Constructors
GenericSectionList | |
Fields
|
sectionListNameL :: forall n t e. Lens' (GenericSectionList n t e) n Source #
sectionListFocusRingL :: forall n t e. Lens' (GenericSectionList n t e) (FocusRing n) Source #
sectionListElementsL :: forall n t e t e. Lens (GenericSectionList n t e) (GenericSectionList n t e) (Vector (GenericList n t e)) (Vector (GenericList n t e)) Source #
type SectionList n e = GenericSectionList n Vector e Source #
class ListItemSectionNameIndex n where Source #
To support selection by mouse click we need to obtain section name and item index from the name of the item that got clicked. This helper class is to get that
Methods
getListItemSectionNameIndex :: n -> Maybe (n, Int) Source #
Instances
sectionList :: Foldable t => n -> [(n, t e)] -> Int -> GenericSectionList n t e Source #
Build a SectionList from nonempty list. If empty we could not defined sectionL lenses.
sectionL :: Eq n => n -> Lens' (GenericSectionList n t e) (GenericList n t e) Source #
This lens constructor, takes a name and looks if a section has such a name. Used to dispatch events to sections. It is a partial function only meant to be used with the FocusRing inside GenericSectionList
moveDown :: (Splittable t, Ord n, Foldable t) => EventM n (GenericSectionList n t e) () Source #
moveUp :: (Splittable t, Ord n, Foldable t) => EventM n (GenericSectionList n t e) () Source #
sectionListSelectItem :: (Splittable t, Eq n, ListItemSectionNameIndex n, Foldable t) => n -> EventM n (GenericSectionList n t e) () Source #
handleGenericListEvent :: (Foldable t, Splittable t, Ord n, ListItemSectionNameIndex n) => BrickEvent n a -> EventM n (GenericSectionList n t e) () Source #
Handle events for list cursor movement. Events handled are:
- Up (up arrow key). If first element of section, then jump prev section
- Down (down arrow key). If last element of section, then jump next section
- Page Up (PgUp)
- Page Down (PgDown)
- Go to next section (Tab)
- Go to prev section (BackTab)
- Select an element via Mouse left click
Arguments
:: forall n t e. (Traversable t, Ord n, Show n, Eq n, Splittable t, Semigroup (t e)) | |
=> (Int -> Bool -> e -> Widget n) | Rendering function of the list element, True for the selected element |
-> Bool | Whether the section list has focus |
-> GenericSectionList n t e | The section list to render |
-> Widget n |
sectionListSelectedElement :: (Eq n, Splittable t, Traversable t, Semigroup (t e)) => GenericSectionList n t e -> Maybe (Int, e) Source #
Equivalent to listSelectedElement