Safe Haskell | None |
---|
Displays a single on-screen row. A row may contain multiple screen lines and multiple columns.
This module only deals with a single row at a time. Each cell in the row can have more than one screen line; this module will make sure that the cells have appropriate padding on the bottom so that the row appears nicely. This module will also justify each cell so that its left side or right side is ragged; however, you first have to specify how wide you want the cell to be.
This module is a little dumber than you might first think it could be. For instance it would be possible to write a function that takes a number of rows and automatically justifies all the cells by finding the widest cell in a column. Indeed I might eventually write such a function because it might be useful in, for example, the multi-commodity balance report. However, such a function would not be useful in all cases; in particular, the Posts report is very complicated to lay out, and the automatic function described above would not do the right thing.
So this module offers some useful automation, even if it is at a
level that is apparently lower that what is possible. Thus the
present row
function likely will not change, even if eventually I
add a table
function that automatically justifies many rows.
- data Justification
- data ColumnSpec = ColumnSpec {
- justification :: Justification
- width :: Width
- padSpec :: (Label, EvenOdd)
- bits :: [Chunk]
- newtype Width = Width {}
- row :: Changers -> [ColumnSpec] -> [Chunk]
Documentation
data Justification Source
How to justify cells. LeftJustify leaves the right side ragged. RightJustify leaves the left side ragged.
data ColumnSpec Source
A cell of text output. You tell the cell how to justify itself and how wide it is. You also tell it the background colors to use. The cell will be appropriately justified (that is, text aligned between left and right margins) and padded (with lines of blank text added on the bottom as needed) when joined with other cells into a Row.
ColumnSpec | |
|
row :: Changers -> [ColumnSpec] -> [Chunk]Source