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 :: MonadIO m => Collection -> RenderContext -> m ()
- schedule :: MonadIO m => IO () -> m ()
- newCollection :: MonadIO m => m Collection
- addToCollection :: (MonadIO m, Show a) => Collection -> Widget a -> Widget FocusGroup -> m (m ())
- setCurrentEntry :: MonadIO m => Collection -> Int -> m ()
Documentation
type Collection = IORef CollectionDataSource
The type of user interface collections.
data CollectionError Source
runUi :: MonadIO m => Collection -> RenderContext -> m ()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 :: MonadIO m => IO () -> m ()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.
newCollection :: MonadIO m => m CollectionSource
Create a new collection.
addToCollection :: (MonadIO m, Show a) => Collection -> Widget a -> Widget FocusGroup -> m (m ())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.
setCurrentEntry :: MonadIO m => Collection -> Int -> m ()Source