Documentation ¶
Overview ¶
Package layout provides helpers for laying out hierarchies of rectangular elements in two dimensional space.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element interface { // SizeHint returns this Element's desired size and whether it // can expand from that size in either direction. SizeHint() (w, h float64, flexw, flexh bool) // SetLayout sets this Element's layout relative to its parent // and, if this Element is a container, recursively lays out // this Element's children. // // w and h may be smaller than SizeHint() if the space is // constrained. They may also be larger, even if the element // isn't flexible, in which case the Element will position // itself within the assigned size using some gravity. // // TODO: Or should the parent be responsible for gravity if it // allocates too much space to a fixed element? // // TODO: Since an Element doesn't know its parent, it's // difficult to turn local coordinates into absolute // coordinates. These should either be absolute coordinates, // or Element should have a parent and it should be easy to // get absolute coordinates. SetLayout(x, y, w, h float64) // Layout returns this Element's layout. Layout() (x, y, w, h float64) }
An Element is a rectangular feature in a layout.
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid lays out elements in a two dimensional table. Each child is assigned to a cell in the table and may optionally span multiple rows and/or columns.
type Group ¶
type Group interface { Element // Children returns the child Elements laid out by this Group. Children() []Element }
A Group is an Element that manages the layout of child Elements.
Click to show internal directories.
Click to hide internal directories.