vty-3.1.8.4: A simple terminal access librarySource codeContentsIndex
Graphics.Vty
Synopsis
data Vty = Vty {
update :: Picture -> IO ()
getEvent :: IO Event
getSize :: IO (Int, Int)
refresh :: IO ()
shutdown :: IO ()
}
beep :: IO ()
mkVty :: IO Vty
mkVtyEscDelay :: Int -> IO Vty
data Cursor
= NoCursor
| Cursor Int Int
data TermState = TS {
_tsRow :: !Int
_tsColumn :: !Int
_tsAttr :: !Attr
}
newtype Attr = Attr Int
setFG :: Color -> Attr -> Attr
setBG :: Color -> Attr -> Attr
setFGVivid :: Color -> Attr -> Attr
setBGVivid :: Color -> Attr -> Attr
setBold :: Attr -> Attr
setBlink :: Attr -> Attr
setRV :: Attr -> Attr
setHalfBright :: Attr -> Attr
setUnderline :: Attr -> Attr
attr :: Attr
newtype Color = Color Int
red :: Color
green :: Color
yellow :: Color
blue :: Color
magenta :: Color
cyan :: Color
white :: Color
def :: Color
black :: Color
data Image = Image (Int -> Ptr Int -> IO ()) !Int !Int
imgWidth :: Image -> Int
imgHeight :: Image -> Int
empty :: Image
(<|>) :: Image -> Image -> Image
(<->) :: Image -> Image -> Image
fillSeg :: Attr -> Char -> Ptr Int -> Ptr Int -> IO ()
horzcat :: [Image] -> Image
vertcat :: [Image] -> Image
renderBS :: Attr -> ByteString -> Image
renderChar :: Attr -> Char -> Image
renderHFill :: Attr -> Char -> Int -> Image
renderFill :: Attr -> Char -> Int -> Int -> Image
data Picture = Pic {
pCursor :: Cursor
pImage :: Image
}
pic :: Picture
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.
Constructors
Vty
update :: Picture -> IO ()Update the screen to reflect the contents of a Picture. This is not currently threadsafe.
getEvent :: IO EventGet 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.
mkVtyEscDelay :: Int -> IO VtySource
data Cursor Source
This type represents the visible cursor state.
Constructors
NoCursorHide the cursor.
Cursor Int IntDisplay the cursor at the given XY position.
data TermState Source
An object representing the current state of the terminal.
Constructors
TS
_tsRow :: !Int
_tsColumn :: !Int
_tsAttr :: !Attr
newtype Attr Source
Opaque data type representing character attributes.
Constructors
Attr Int
setFG :: Color -> Attr -> AttrSource
Set the foreground color of an Attr.
setBG :: Color -> Attr -> AttrSource
Set the background color of an Attr.
setFGVivid :: Color -> Attr -> AttrSource
Set the foreground color of an Attr.
setBGVivid :: 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
red :: ColorSource
Basic color definitions.
green :: ColorSource
yellow :: ColorSource
blue :: ColorSource
magenta :: ColorSource
cyan :: ColorSource
white :: ColorSource
def :: ColorSource
black :: ColorSource
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
pCursor :: CursorThe position and visibility status of the virtual cursor.
pImage :: ImageA 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.
Constructors
KEsc
KFun Int
KBackTab
KPrtScr
KPause
KASCII Char
KBS
KIns
KHome
KPageUp
KDel
KEnd
KPageDown
KNP5
KUp
KMenu
KLeft
KDown
KRight
KEnter
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
data Event Source
Generic events.
Constructors
EvKey Key [Modifier]
EvMouse Int Int Button [Modifier]
EvResize Int Int
Produced by Haddock version 2.6.1