vgrep-0.2.2.0: A pager for grep

Safe HaskellNone
LanguageHaskell2010

Vgrep.Widget.Type

Contents

Synopsis

Documentation

data Widget s Source #

A Widget is a unit that is displayed on the screen. It is associated with a mutable state s. It provides an event handler with default keybindings and can generate a renderable Image.

Widget modules should provide a Widget instance and additionally a collection of actions that can be invoked by external event handlers:

widgetAction :: VgrepT s m Redraw

Constructors

Widget 

Fields

  • initialize :: s

    The initial state of the widget

  • draw :: forall m. Monad m => VgrepT s m Image

    Generate a renderable Image from the widget state. The state can be modified (e. g. for resizing).

Re-exports from Vgrep.Event

data Redraw Source #

Constructors

Redraw

Indicates that the state has been changed visibly, so the screen should be refreshed.

Unchanged

The state has not changed or the change would not be visible, so refreshing the screen is not required.

data Next a Source #

The type of action to be performed on an event.

Constructors

Skip

Do not handle the event (fall-through to other event handlers)

Continue a

Handle the event by performing an action

Interrupt Interrupt

Interrupt the application

Instances

Functor Next Source # 

Methods

fmap :: (a -> b) -> Next a -> Next b #

(<$) :: a -> Next b -> Next a #

Monoid (Next a) Source #

The first event handler that triggers (i. e. does not return Skip) handles the event.

Methods

mempty :: Next a #

mappend :: Next a -> Next a -> Next a #

mconcat :: [Next a] -> Next a #