vty-ui-0.1: A user interface composition library for VtySource codeContentsIndex
Graphics.Vty.Widgets.Base
Description

A collection of primitive user interface widgets for composing and laying out Graphics.Vty user interfaces. This module provides basic static and box layout widgets and a type class for rendering widgets to Vty Images.

Each widget type supplied by this library is exported as a type and an associated constructor function (e.g., Text and text, VBox and vBox).

Synopsis
class Widget w where
render :: DisplayRegion -> w -> Image
growthPolicy :: w -> GrowthPolicy
data GrowthPolicy
= Static
| GrowVertical
| GrowHorizontal
mkImage :: Widget a => Vty -> a -> IO Image
data AnyWidget
data Text
data HBox
data VBox
data HFill
data VFill
(<++>) :: (Widget a, Widget b) => a -> b -> HBox
(<-->) :: (Widget a, Widget b) => a -> b -> VBox
anyWidget :: Widget a => a -> AnyWidget
text :: Attr -> String -> Text
hBox :: (Widget a, Widget b) => a -> b -> HBox
vBox :: (Widget a, Widget b) => a -> b -> VBox
hFill :: Attr -> Char -> Int -> HFill
vFill :: Attr -> Char -> VFill
Documentation
class Widget w whereSource
The class of user interface widgets.
Methods
render :: DisplayRegion -> w -> ImageSource
Given a widget, render it with the given dimensions. The resulting Image should not be larger than the specified dimensions, but may be smaller.
growthPolicy :: w -> GrowthPolicySource
The growth policy of this widget.
show/hide Instances
data GrowthPolicy Source
The growth policy of a widget determines how its container will reserve space to render it.
Constructors
StaticStatic widgets have a fixed size that is not influenced by available space
GrowVerticalGrowVertical widgets may grow vertically with available space
GrowHorizontalGrowHorizontal widgets may grow horizontally with available space
show/hide Instances
mkImage :: Widget a => Vty -> a -> IO ImageSource
Given a Widget and a Vty object, render the widget using the current size of the terminal controlled by Vty. Returns the rendered Widget as an Image.
data AnyWidget Source
A wrapper for all widget types used in normalizing heterogeneous lists of widgets. See anyWidget.
show/hide Instances
data Text Source
A text widget consisting of a string rendered using an attribute. See text.
show/hide Instances
data HBox Source
A horizontal box layout widget capable of containing two Widgets. See hBox.
show/hide Instances
data VBox Source
A vertical box layout widget capable of containing two Widgets. See vBox.
show/hide Instances
data HFill Source
A horizontal fill widget for filling available horizontal space in a box layout. See hFill.
show/hide Instances
data VFill Source
A vertical fill widget for filling available vertical space in a box layout. See vFill.
show/hide Instances
(<++>) :: (Widget a, Widget b) => a -> b -> HBoxSource
An alias for hBox intended as sugar to chain widgets horizontally.
(<-->) :: (Widget a, Widget b) => a -> b -> VBoxSource
An alias for vBox intended as sugar to chain widgets vertically.
anyWidget :: Widget a => a -> AnyWidgetSource
Wrap a Widget in the AnyWidget type for normalization purposes.
textSource
:: AttrThe attribute to use to render the text
-> StringThe text to display
-> Text
Create a Text widget.
hBoxSource
:: (Widget a, Widget b)
=> aThe left widget
-> bThe right widget
-> HBox
Create a horizontal box layout widget containing two widgets side by side. Space consumed by the box will depend on its contents and the available space.
vBox :: (Widget a, Widget b) => a -> b -> VBoxSource
Create a vertical box layout widget containing two widgets. Space consumed by the box will depend on its contents and the available space.
hFillSource
:: AttrThe attribute to use to render the fill
-> CharThe character to fill
-> IntThe height, in rows, of the filled area; width of the fill depends on available space
-> HFill
Create an horizonal fill widget.
vFillSource
:: AttrThe attribute to use to render the fill
-> CharThe character to fill
-> VFill
Create a vertical fill widget. The dimensions of the widget will depend on available space.
Produced by Haddock version 2.4.2