Safe Haskell | None |
---|---|
Language | Haskell2010 |
Support for basic table drawing.
Synopsis
- data Table n
- data ColumnAlignment
- data RowAlignment
- data TableException
- table :: [[Widget n]] -> Table n
- alignLeft :: Int -> Table n -> Table n
- alignRight :: Int -> Table n -> Table n
- alignCenter :: Int -> Table n -> Table n
- alignTop :: Int -> Table n -> Table n
- alignMiddle :: Int -> Table n -> Table n
- alignBottom :: Int -> Table n -> Table n
- setColAlignment :: ColumnAlignment -> Int -> Table n -> Table n
- setRowAlignment :: RowAlignment -> Int -> Table n -> Table n
- setDefaultColAlignment :: ColumnAlignment -> Table n -> Table n
- setDefaultRowAlignment :: RowAlignment -> Table n -> Table n
- surroundingBorder :: Bool -> Table n -> Table n
- rowBorders :: Bool -> Table n -> Table n
- columnBorders :: Bool -> Table n -> Table n
- renderTable :: Table n -> Widget n
Types
data ColumnAlignment Source #
Column alignment modes.
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. |
Instances
Eq ColumnAlignment Source # | |
Defined in Brick.Widgets.Table (==) :: ColumnAlignment -> ColumnAlignment -> Bool # (/=) :: ColumnAlignment -> ColumnAlignment -> Bool # | |
Read ColumnAlignment Source # | |
Defined in Brick.Widgets.Table | |
Show ColumnAlignment Source # | |
Defined in Brick.Widgets.Table showsPrec :: Int -> ColumnAlignment -> ShowS # show :: ColumnAlignment -> String # showList :: [ColumnAlignment] -> ShowS # |
data RowAlignment Source #
Row alignment modes.
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. |
Instances
Eq RowAlignment Source # | |
Defined in Brick.Widgets.Table (==) :: RowAlignment -> RowAlignment -> Bool # (/=) :: RowAlignment -> RowAlignment -> Bool # | |
Read RowAlignment Source # | |
Defined in Brick.Widgets.Table readsPrec :: Int -> ReadS RowAlignment # readList :: ReadS [RowAlignment] # | |
Show RowAlignment Source # | |
Defined in Brick.Widgets.Table showsPrec :: Int -> RowAlignment -> ShowS # show :: RowAlignment -> String # showList :: [RowAlignment] -> ShowS # |
data TableException Source #
A table creation exception.
TEUnequalRowSizes | Rows did not all have the same number of cells. |
TEInvalidCellSizePolicy | Some cells in the table did not use the |
Instances
Eq TableException Source # | |
Defined in Brick.Widgets.Table (==) :: TableException -> TableException -> Bool # (/=) :: TableException -> TableException -> Bool # | |
Read TableException Source # | |
Defined in Brick.Widgets.Table readsPrec :: Int -> ReadS TableException # readList :: ReadS [TableException] # | |
Show TableException Source # | |
Defined in Brick.Widgets.Table showsPrec :: Int -> TableException -> ShowS # show :: TableException -> String # showList :: [TableException] -> ShowS # | |
Exception TableException Source # | |
Defined in Brick.Widgets.Table |
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.