vty-3.1.0: A simple terminal access library

Graphics.Vty

Synopsis

Documentation

data Vty Source

The main object. At most one should be created.

Constructors

Vty 

Fields

update :: Picture -> IO ()

Update the screen to reflect the contents of a Picture. This is not currently threadsafe.

getEvent :: IO Event

Get one Event object, blocking if necessary.

getSize :: IO (Int, Int)

Get the size of the display.

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.

beep :: IO ()Source

Make the terminal beep.

mkVty :: IO VtySource

Set up the state object for using vty. At most one state object should be created at a time.

data Cursor Source

This type represents the visible cursor state.

Constructors

NoCursor

Hide the cursor.

Cursor Int Int

Display the cursor at the given XY position.

newtype Attr Source

Opaque data type representing character attributes.

Constructors

Attr Int 

Instances

setFG :: Color -> Attr -> AttrSource

Set the foreground color of an Attr.

setBG :: Color -> Attr -> AttrSource

Set the background color of an Attr.

setBold :: Attr -> AttrSource

Set bold attribute of an Attr.

setBlink :: Attr -> AttrSource

Set blink attribute of an Attr.

setRV :: Attr -> AttrSource

Set reverse-video attribute of an Attr.

setHalfBright :: Attr -> AttrSource

Set half-bright attribute of an Attr.

setUnderline :: Attr -> AttrSource

Set underline attribute of an Attr.

attr :: AttrSource

Attr with all default values.

newtype Color Source

Abstract data type representing a color.

Constructors

Color Int 

Instances

red :: ColorSource

Basic color definitions.

data Image Source

A two-dimensional array of (Char,Attr) pairs.

Constructors

Image (Int -> Ptr Int -> IO ()) !Int !Int 

imgWidth :: Image -> IntSource

Access the width of an Image.

imgHeight :: Image -> IntSource

Access the height of an Image.

empty :: ImageSource

The empty image.

(<|>) :: Image -> Image -> ImageSource

Compose two images side by side. The images must of the same height, or one must be empty.

(<->) :: Image -> Image -> ImageSource

Compose two images vertically. The images must of the same width, or one must be empty.

fillSeg :: Attr -> Char -> Ptr Int -> Ptr Int -> IO ()Source

Helper - fill a buffer segment with a char/attr.

horzcat :: [Image] -> ImageSource

Compose any number of images horizontally.

vertcat :: [Image] -> ImageSource

Compose any number of images vertically.

renderBS :: Attr -> ByteString -> ImageSource

Create an Image from a ByteString with a single uniform Attr.

renderChar :: Attr -> Char -> ImageSource

Create a 1x1 image. Warning, this is likely to be inefficient.

renderHFill :: Attr -> Char -> Int -> ImageSource

Create an image by repeating a single character and attribute horizontally.

renderFill :: Attr -> Char -> Int -> Int -> ImageSource

Create an image by repeating a single character and attribute.

data Picture Source

The type of images to be displayed using update. You probably shouldn't create this directly if you care about compatibility with future versions of vty; instead use pic and record update syntax.

Constructors

Pic 

Fields

pCursor :: Cursor

The position and visibility status of the virtual cursor.

pImage :: Image

A 2d array of (character,attribute) pairs, representing the screen image.

pic :: PictureSource

Create a Picture object with all default values. By using this and record update, rather than directly using the Pic constructor, your code will be compatible with additions to the Picture object. You must specify at least pImage.

data Key Source

Representations of non-modifier keys.

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 

data Button Source

Mouse buttons. Not yet used.

Constructors

BLeft 
BMiddle 
BRight 

Instances

data Event Source

Generic events.

Instances