mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-12-02 11:05:10 +03:00
table: raise exception if any contents use Greedy policy
This commit is contained in:
parent
1607de7ef8
commit
2182c80ab3
@ -38,7 +38,14 @@ data Table n =
|
||||
|
||||
table :: [[Widget n]] -> Table n
|
||||
table rows =
|
||||
Table { columnAlignments = mempty
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user