Graphics.Vty.Widgets.Table
Description
This module provides a table layout widget capable of laying out columns of widgets with various padding and alignment properties. For complete details, please see the Vty-ui User's Manual.
- data Table
- data TableCell
- data ColumnSize
- data BorderStyle
- = BorderPartial [BorderFlag]
- | BorderFull
- | BorderNone
- data BorderFlag
- class RowLike a where
- mkRow :: a -> TableRow
- data TableError
- data ColumnSpec = ColumnSpec {}
- data Alignment
- = AlignCenter
- | AlignLeft
- | AlignRight
- class Alignable a where
- (.|.) :: (RowLike a, RowLike b) => a -> b -> TableRow
- newTable :: [ColumnSpec] -> BorderStyle -> IO (Widget Table)
- setDefaultCellAlignment :: Widget Table -> Alignment -> IO ()
- setDefaultCellPadding :: Widget Table -> Padding -> IO ()
- addRow :: RowLike a => Widget Table -> a -> IO ()
- addHeadingRow :: Widget Table -> Attr -> [String] -> IO [Widget FormattedText]
- addHeadingRow_ :: Widget Table -> Attr -> [String] -> IO ()
- column :: ColumnSize -> ColumnSpec
- customCell :: Show a => Widget a -> TableCell
- emptyCell :: TableCell
Documentation
The wrapper type for all table cells; stores the widgets themselves in addition to alignment and padding settings. Alignment and padding settings on a cell override the column- and table-wide defaults.
data ColumnSize Source
The type of column size policies.
Constructors
ColFixed Int | The column has the specified fixed width in columns. |
ColAuto | The column's width is a function of space available to the table at rendering time. |
Instances
data BorderStyle Source
The border configuration of a table.
Constructors
BorderPartial [BorderFlag] | |
BorderFull | A partial set of border flags. |
BorderNone | Don't draw any borders anywhere. |
Instances
data BorderFlag Source
The types of borders we can have in a table.
Constructors
Rows | Borders between rows. |
Columns | Borders between columns. |
Edges | Borders around the outside edges of the table. |
Instances
The class of types whose values can be used to construct table rows.
data TableError Source
Constructors
ColumnCountMismatch | A row added to the table did not have the same number of widgets as the table has columns. |
CellImageTooBig | The image rendered by a cell widget exceeded the size permitted by the cell. |
BadTableWidgetSizePolicy Int | A table cell contains a widget which grows vertically, which is not permitted. |
Instances
data ColumnSpec Source
The specification of a column's settings. The alignment and padding of a column specification override the table-wide default.
Constructors
ColumnSpec | |
Fields |
Instances
Column alignment values.
Constructors
AlignCenter | |
AlignLeft | |
AlignRight |
The class of types whose values can be aligned.
Instances
newTable :: [ColumnSpec] -> BorderStyle -> IO (Widget Table)Source
Create a table widget using a list of column specifications and a border style.
setDefaultCellAlignment :: Widget Table -> Alignment -> IO ()Source
Set the default table-wide cell alignment.
setDefaultCellPadding :: Widget Table -> Padding -> IO ()Source
Set the default table-wide cell padding.
addRow :: RowLike a => Widget Table -> a -> IO ()Source
Add a row to the table. Use RowLike
instances to populate the
row. Throws BadTableWidgetSizePolicy
if any widgets in the row
grow vertically; throws ColumnCountMismatch
if the row's number
of columns does not match the table's column count.
addHeadingRow :: Widget Table -> Attr -> [String] -> IO [Widget FormattedText]Source
Add a heading row to a table. Adds a row using the specified |labels and attribute. Returns the widgets it constructed as a |side-effect in case you want to do something with them.
addHeadingRow_ :: Widget Table -> Attr -> [String] -> IO ()Source
Add a heading row to a table. Adds a row using the specified |labels and attribute.
column :: ColumnSize -> ColumnSpecSource
Create a column.