Safe Haskell | None |
---|---|
Language | Haskell98 |
This module provides the main event loop functionality for this library. All vty-ui applications must use runUi to get anything done usefully.
- type Collection = IORef CollectionData
- data CollectionError = BadCollectionIndex Int
- runUi :: Collection -> RenderContext -> IO ()
- schedule :: IO () -> IO ()
- shutdownUi :: IO ()
- newCollection :: IO Collection
- addToCollection :: Show a => Collection -> Widget a -> Widget FocusGroup -> IO (IO ())
- addToCollectionWithCallbacks :: Show a => Collection -> Widget a -> Widget FocusGroup -> EntryShow -> EntryHide -> IO (IO ())
- setCurrentEntry :: Collection -> Int -> IO ()
- type EntryHide = IO ()
- type EntryShow = IO ()
Documentation
type Collection = IORef CollectionData Source
The type of user interface collections.
data CollectionError Source
runUi :: Collection -> RenderContext -> IO () Source
Run the main vty-ui event loop using the specified interface
collection and initial rendering context. The rendering context
provides the default attributes and Skin
to use for the
application. Throws BadCollectionIndex
if the specified
Collection
is empty.
schedule :: IO () -> IO () Source
Schedule a widget-mutating IO
action to be run by the main event
loop. Use of this function is required to guarantee consistency
between interface presentation and internal state.
shutdownUi :: IO () Source
Schedule a vty-ui event loop shutdown. This event will preempt others so that it will be processed next.
newCollection :: IO Collection Source
Create a new collection.
addToCollection :: Show a => Collection -> Widget a -> Widget FocusGroup -> IO (IO ()) Source
Add a widget and its focus group to a collection. Returns an action which, when invoked, will switch to the interface specified in the call.
addToCollectionWithCallbacks :: Show a => Collection -> Widget a -> Widget FocusGroup -> EntryShow -> EntryHide -> IO (IO ()) Source
Add a widget and its focus group to a collection. In addition, two callbacks -- one to call when showing the widget and one to call when hiding it (i.e. showing some other widget) -- must be provided. Returns an action which, when invoked, will switch to the interface specified.
setCurrentEntry :: Collection -> Int -> IO () Source