mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-12-02 01:45:50 +03:00
table: raise exception if any contents use Greedy policy
This commit is contained in:
parent
1607de7ef8
commit
2182c80ab3
@ -38,12 +38,19 @@ data Table n =
|
||||
|
||||
table :: [[Widget n]] -> Table n
|
||||
table rows =
|
||||
Table { columnAlignments = mempty
|
||||
, tableRows = rows
|
||||
, drawSurroundingBorder = True
|
||||
, drawRowBorders = True
|
||||
, drawColumnBorders = True
|
||||
}
|
||||
if not allFixed
|
||||
then error "table: all cells must have Fixed horizontal and vertical growth policies"
|
||||
else t
|
||||
where
|
||||
allFixed = all (== Fixed) $ concat $ getPolicies <$> rows
|
||||
getPolicies row = concat $ getCellPolicies <$> row
|
||||
getCellPolicies w = [hSize w, vSize w]
|
||||
t = Table { columnAlignments = mempty
|
||||
, tableRows = rows
|
||||
, drawSurroundingBorder = True
|
||||
, drawRowBorders = True
|
||||
, drawColumnBorders = True
|
||||
}
|
||||
|
||||
surroundingBorder :: Bool -> Table n -> Table n
|
||||
surroundingBorder b t =
|
||||
|
Loading…
Reference in New Issue
Block a user