vty-ui-1.4: An interactive terminal user interface library for Vty

Graphics.Vty.Widgets.Box

Contents

Description

This module provides vertical and horizontal box layout widgets using the Box type. Box widgets use their child widgets' size policies and their space allocation settings to determine layout.

Box widgets propagate key and focus events to their children.

For more details, see the Vty-ui User's Manual.

Synopsis

Documentation

data Box a b Source

Instances

Show (Box a b) 

data ChildSizePolicy Source

Child size policy applied to a box.

Constructors

PerChild IndividualPolicy IndividualPolicy

A per-child policy.

Percentage Int

Percentage, p, of space given to first child, which implies that (100 - p) percent given to the second.

data IndividualPolicy Source

Individual child widget policy applied to a child widget contained in a box.

Constructors

BoxAuto

The child's growth policy will be used to determine layout. The child widget layout will also be affected by the policy of the other widget in the box.

BoxFixed Int

A fixed number of rows or columns, depending on box type, will be allocated to the child.

data BoxError Source

Constructors

BadPercentage

Indicates that a given percentage value was invalid.

Box Constructors

hBox :: (Show a, Show b) => Widget a -> Widget b -> IO (Widget (Box a b))Source

Create a horizontal box widget containing two widgets side by side. Space consumed by the box will depend on its contents, available space, and the box child size policy.

vBox :: (Show a, Show b) => Widget a -> Widget b -> IO (Widget (Box a b))Source

Create a vertical box widget containing two widgets, one above the other. Space consumed by the box will depend on its contents, available space, and the box child size policy.

(<++>) :: (Show a, Show b) => IO (Widget a) -> IO (Widget b) -> IO (Widget (Box a b))Source

Create a horizontal box widget using monadic widget constructors.

(<-->) :: (Show a, Show b) => IO (Widget a) -> IO (Widget b) -> IO (Widget (Box a b))Source

Create a vertical box widget using monadic widget constructors.

Box Configuration

setBoxSpacing :: Widget (Box a b) -> Int -> IO ()Source

Set the spacing in between a box's child widgets in rows or columns, depending on the box type.

withBoxSpacing :: Int -> Widget (Box a b) -> IO (Widget (Box a b))Source

defaultChildSizePolicy :: ChildSizePolicySource

The default box child size policy, which defers to the children to determine layout.

setBoxChildSizePolicy :: Widget (Box a b) -> ChildSizePolicy -> IO ()Source

Set the box child size policy. Throws BadPercentage if the size policy uses an invalid percentage value, which must be between 0 and 100 inclusive.

getBoxChildSizePolicy :: Widget (Box a b) -> IO ChildSizePolicySource

Get the child size policy for a box.

Child Widget References

getFirstChild :: Widget (Box a b) -> IO (Widget a)Source

Get a reference to the first (left or top) widget in a box.

getSecondChild :: Widget (Box a b) -> IO (Widget b)Source

Get a reference to the second (right or bottom) widget in a box.