Introduce new layouts.Grid construct

This commit is contained in:
2024-06-22 18:44:26 -04:00
parent ae1e62c1f2
commit e8a3a376ea
7 changed files with 17 additions and 12 deletions

View File

@@ -18,12 +18,18 @@ type Grid struct {
// will contract. Boxes are laid out left to right, then top to bottom. Boxes
// that go beyond the lengh of rows will be laid out according to columns, but
// they will not expand vertically.
func NewGrid (columns, rows []bool) *Grid {
this := &Grid {
xExpand: columns,
yExpand: rows,
//
// If you aren't sure how to use this constructor, here is an example:
//
// X0 X1 X2 Y0 Y1 Y2
// NewGrid(true, false, true)(false, true, true)
func NewGrid (columns ...bool) func (rows ...bool) *Grid {
return func (rows ...bool) *Grid {
return &Grid {
xExpand: columns,
yExpand: rows,
}
}
return this
}
func (this *Grid) MinimumSize (hints tomo.LayoutHints, boxes []tomo.Box) image.Point {