matterhorn-50200.17.0: Terminal client for the Mattermost chat system
Safe HaskellNone
LanguageHaskell2010

Matterhorn.Types.TabbedWindow

Synopsis

Documentation

data TabbedWindow s m n a Source #

An instantiated tab window. This is based on a template and tracks the state of the tabbed window (current tab).

Parameterized over an abstract handle type (a) for the tabs so we can give each a unique handle.

Constructors

TabbedWindow 

Fields

data TabbedWindowEntry s m n a Source #

An entry in a tabbed window corresponding to a tab and its content. Parameterized over an abstract handle type (a) for the tabs so we can give each a unique handle.

Constructors

TabbedWindowEntry 

Fields

  • tweValue :: a

    The handle for this tab.

  • tweRender :: a -> s -> Widget n

    The rendering function to use when this tab is selected.

  • tweHandleEvent :: a -> Event -> m ()

    The event-handling function to use when this tab is selected.

  • tweTitle :: a -> Bool -> Text

    Title function for this tab, with a boolean indicating whether this is the current tab.

  • tweShowHandler :: a -> m ()

    A handler to be invoked when this tab is shown.

data TabbedWindowTemplate s m n a Source #

The definition of a tabbed window. Note that this does not track the *state* of the window; it merely provides a collection of tab window entries (see above). To track the state of a tabbed window, use a TabbedWindow.

Parameterized over an abstract handle type (a) for the tabs so we can give each a unique handle.

Constructors

TabbedWindowTemplate 

Fields

tabbedWindow Source #

Arguments

:: (Show a, Eq a) 
=> a

The handle corresponding to the tab that should be selected initially.

-> TabbedWindowTemplate s m n a

The template for the window to construct.

-> (Int, Int)

The window dimensions (width, height).

-> TabbedWindow s m n a 

Construct a new tabbed window from a template. This will raise an exception if the initially-selected tab does not exist in the window template, or if the window template has any duplicated tab handles.

Note that the caller is responsible for determining whether to call the initially-selected tab's on-show handler.

getCurrentTabbedWindowEntry :: (Show a, Eq a) => TabbedWindow s m n a -> TabbedWindowEntry s m n a Source #

Get the currently-selected tab entry for a tabbed window. Raise an exception if the window's selected tab handle is not found in its template (which is a bug in the tabbed window infrastructure).

tabbedWindowNextTab :: (Monad m, Show a, Eq a) => TabbedWindow s m n a -> m (TabbedWindow s m n a) Source #

Switch a tabbed window's selected tab to its next tab, cycling back to the first tab if the last tab is the selected tab. This also invokes the on-show handler for the newly-selected tab.

Note that this does nothing if the window has only one tab.

tabbedWindowPreviousTab :: (Monad m, Show a, Eq a) => TabbedWindow s m n a -> m (TabbedWindow s m n a) Source #

Switch a tabbed window's selected tab to its previous tab, cycling to the last tab if the first tab is the selected tab. This also invokes the on-show handler for the newly-selected tab.

Note that this does nothing if the window has only one tab.

runTabShowHandlerFor :: (Eq a, Show a) => a -> TabbedWindow s m n a -> m () Source #

Run the on-show handler for the window tab entry with the specified handle.