brick-0.68: A declarative terminal user interface library
Safe HaskellNone
LanguageHaskell2010

Brick.Widgets.Table

Description

Support for basic table drawing.

Synopsis

Types

data Table n Source #

A table data structure.

data ColumnAlignment Source #

Column alignment modes.

Constructors

AlignLeft

Align all cells to the left.

AlignCenter

Center the content horizontally in all cells in the column.

AlignRight

Align all cells to the right.

data RowAlignment Source #

Row alignment modes.

Constructors

AlignTop

Align all cells to the top.

AlignMiddle

Center the content vertically in all cells in the row.

AlignBottom

Align all cells to the bottom.

data TableException Source #

A table creation exception.

Constructors

TEUnequalRowSizes

Rows did not all have the same number of cells.

TEInvalidCellSizePolicy

Some cells in the table did not use the Fixed size policy for both horizontal and vertical sizing.

Construction

table :: [[Widget n]] -> Table n Source #

Construct a new table.

The argument is the list of rows, with each element of the argument list being the columns of the respective row.

By default, all columns are left-aligned. Use the alignment functions in this module to change that behavior.

By default, all rows are top-aligned. Use the alignment functions in this module to change that behavior.

By default, the table will draw borders between columns, between rows, and around the outside of the table. Border-drawing behavior can be configured with the API in this module. Note that tables always draw with joinBorders enabled.

All cells of all rows MUST use the Fixed growth policy for both horizontal and vertical growth. If the argument list contains any cells that use the Greedy policy, this will raise a TableException.

All rows must have the same number of cells. If not, this will raise a TableException.

Configuration

alignLeft :: Int -> Table n -> Table n Source #

Align the specified column to the left. The argument is the column index, starting with zero.

alignRight :: Int -> Table n -> Table n Source #

Align the specified column to the right. The argument is the column index, starting with zero.

alignCenter :: Int -> Table n -> Table n Source #

Align the specified column to center. The argument is the column index, starting with zero.

alignTop :: Int -> Table n -> Table n Source #

Align the specified row to the top. The argument is the row index, starting with zero.

alignMiddle :: Int -> Table n -> Table n Source #

Align the specified row to the middle. The argument is the row index, starting with zero.

alignBottom :: Int -> Table n -> Table n Source #

Align the specified row to bottom. The argument is the row index, starting with zero.

setColAlignment :: ColumnAlignment -> Int -> Table n -> Table n Source #

Set the alignment for the specified column index (starting at zero).

setRowAlignment :: RowAlignment -> Int -> Table n -> Table n Source #

Set the alignment for the specified row index (starting at zero).

setDefaultColAlignment :: ColumnAlignment -> Table n -> Table n Source #

Set the default column alignment for columns with no explicitly configured alignment.

setDefaultRowAlignment :: RowAlignment -> Table n -> Table n Source #

Set the default row alignment for rows with no explicitly configured alignment.

surroundingBorder :: Bool -> Table n -> Table n Source #

Configure whether the table draws a border on its exterior.

rowBorders :: Bool -> Table n -> Table n Source #

Configure whether the table draws borders between its rows.

columnBorders :: Bool -> Table n -> Table n Source #

Configure whether the table draws borders between its columns.

Rendering

renderTable :: Table n -> Widget n Source #

Render the table.