Containers now share a bunch of code

This commit is contained in:
Sasha Koshka 2023-04-19 00:29:25 -04:00
parent ac58a43220
commit afdecc2c8b
4 changed files with 95 additions and 202 deletions

View File

@ -21,19 +21,12 @@ func (space Space) Includes (sub Space) bool {
return (space & sub) > 0 return (space & sub) > 0
} }
type scratchEntry struct {
expand bool
minSize float64
minBreadth float64
}
// Box is a container that lays out its children horizontally or vertically. // Box is a container that lays out its children horizontally or vertically.
// Child elements can be set to contract to their minimum size, or expand to // Child elements can be set to contract to their minimum size, or expand to
// fill remaining space. Boxes can be nested and used together to create more // fill remaining space. Boxes can be nested and used together to create more
// complex layouts. // complex layouts.
type Box struct { type Box struct {
entity tomo.ContainerEntity container
scratch map[tomo.Element] scratchEntry
theme theme.Wrapped theme theme.Wrapped
padding bool padding bool
margin bool margin bool