vty-4.0.0.1: A simple terminal access librarySource codeContentsIndex
Graphics.Vty
Synopsis
data Vty = Vty {
update :: Picture -> IO ()
next_event :: IO Event
terminal :: TerminalHandle
refresh :: IO ()
shutdown :: IO ()
}
mkVty :: IO Vty
mkVtyEscDelay :: Int -> IO Vty
module Graphics.Vty.Terminal
module Graphics.Vty.Picture
module Graphics.Vty.DisplayRegion
data Key
= KEsc
| KFun Int
| KBackTab
| KPrtScr
| KPause
| KASCII Char
| KBS
| KIns
| KHome
| KPageUp
| KDel
| KEnd
| KPageDown
| KNP5
| KUp
| KMenu
| KLeft
| KDown
| KRight
| KEnter
data Modifier
= MShift
| MCtrl
| MMeta
| MAlt
data Button
= BLeft
| BMiddle
| BRight
data Event
= EvKey Key [Modifier]
| EvMouse Int Int Button [Modifier]
| EvResize Int Int
Documentation
data Vty Source

The main object. At most one should be created. An alternative is to use unsafePerformIO to automatically create a singleton Vty instance when required.

This does not assure any thread safety. In theory, as long as an update action is not executed when another update action is already then it's safe to call this on multiple threads.

todo: Once the Terminal interface encompasses input this interface will be deprecated. Currently, just using the Terminal interface there is no support for input events.

Constructors
Vty
update :: Picture -> IO ()Outputs the given Picture. Equivalent to output_picture applied to a display context implicitly managed by Vty.
next_event :: IO EventGet one Event object, blocking if necessary.
terminal :: TerminalHandle

Handle to the terminal interface. See Terminal

The use of Vty typically follows this process:

0. initialize vty

1. use the update equation of Vty to display a picture

2. repeat

3. shutdown vty.

todo: provide a similar abstraction to Graphics.Vty.Terminal for input. Use haskeline's input backend for implementation.

todo: remove explicit shutdown requirement.

refresh :: IO ()Refresh the display. Normally the library takes care of refreshing. Nonetheless, some other program might output to the terminal and mess the display. In that case the user might want to force a refresh.
shutdown :: IO ()Clean up after vty.
mkVty :: IO VtySource
Set up the state object for using vty. At most one state object should be created at a time.
mkVtyEscDelay :: Int -> IO VtySource
module Graphics.Vty.Terminal
module Graphics.Vty.Picture
module Graphics.Vty.DisplayRegion
data Key Source
Representations of non-modifier keys.
Constructors
KEsc
KFun Int
KBackTab
KPrtScr
KPause
KASCII Char
KBS
KIns
KHome
KPageUp
KDel
KEnd
KPageDown
KNP5
KUp
KMenu
KLeft
KDown
KRight
KEnter
show/hide Instances
data Modifier Source
Modifier keys. Key codes are interpreted such that users are more likely to have Meta than Alt; for instance on the PC Linux console, MMeta will generally correspond to the physical Alt key.
Constructors
MShift
MCtrl
MMeta
MAlt
show/hide Instances
data Button Source
Mouse buttons. Not yet used.
Constructors
BLeft
BMiddle
BRight
show/hide Instances
data Event Source
Generic events.
Constructors
EvKey Key [Modifier]
EvMouse Int Int Button [Modifier]
EvResize Int Int
show/hide Instances
Produced by Haddock version 2.4.2