Copyright | (c) Mario Lang 2018 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | mlang@blind.guru |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data DropDownMenu s n
- dropDownMenu :: n -> [(String, n, Maybe Event, [(String, n, Maybe Event, s -> EventM n (Next s))])] -> DropDownMenu s n
- handleDropDownMenuEvent :: (Eq n, Ord n) => s -> Lens' s (DropDownMenu s n) -> (s -> s) -> Event -> EventM n (Next s)
- handleGlobalDropDownMenuEvent :: (Eq n, Ord n) => s -> Lens' s (DropDownMenu s n) -> (s -> s) -> Event -> Maybe (EventM n (Next s))
- renderDropDownMenu :: (Eq n, Ord n, Show n) => Bool -> DropDownMenu s n -> Widget n
- isDropDownMenuOpen :: DropDownMenu s n -> Bool
- closeDropDownMenu :: DropDownMenu s n -> DropDownMenu s n
- menuAttr :: AttrName
- menuSelectedAttr :: AttrName
Documentation
data DropDownMenu s n Source #
Drop-down menus present a menu bar with drop-down submenus.
Drop-down menus support the following events by default:
- Leftright arrow keys: Switch to previousnext submenu
- Up arrow key: Close submenu when already at top, otherwise move selection in submenu
- Down arrow key: Open submenu or move submenu selection downwards
- Escape: Close submenu
- Return: Open submenu or invoke selected submenu item
Instances
Named (DropDownMenu s n) n Source # | |
Defined in Brick.Widgets.DropDownMenu getName :: DropDownMenu s n -> n # |
Constructing a drop-down menu
Handling events
handleDropDownMenuEvent Source #
:: (Eq n, Ord n) | |
=> s | The application state |
-> Lens' s (DropDownMenu s n) | A lens for accessing the drop-down menu state |
-> (s -> s) | Sets focus to this drop-down menu widget if need be |
-> Event | Event received from Vty |
-> EventM n (Next s) |
Handle drop-down menu events. This should typically be called from the application event handler if this menu widget has focus.
handleGlobalDropDownMenuEvent Source #
:: (Eq n, Ord n) | |
=> s | The application state |
-> Lens' s (DropDownMenu s n) | A lens for accessing the drop-down menu state |
-> (s -> s) | Set application focus |
-> Event | Event received from Vty |
-> Maybe (EventM n (Next s)) |
Handle global events. This function will handle global events associated with submenus or menu items. It should typically be called from the main application event handler before any other more specific handlers.
Rendering drop-down menus
Accessors
isDropDownMenuOpen :: DropDownMenu s n -> Bool Source #
Manipulating a drop-down menu
closeDropDownMenu :: DropDownMenu s n -> DropDownMenu s n Source #
Close submenu.