Documentation ¶
Index ¶
- func NewGrid(columns ...bool) func(rows ...bool) *Grid
- type Column
- func (column Column) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
- func (column Column) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
- func (column Column) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
- func (column Column) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
- type Contract
- func (contract Contract) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
- func (contract Contract) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
- func (contract Contract) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
- func (contract Contract) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
- type Flow
- func (flow Flow) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
- func (flow Flow) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
- func (flow Flow) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
- func (flow Flow) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
- type Grid
- func (this *Grid) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
- func (this *Grid) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
- func (this *Grid) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
- func (this *Grid) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
- type Row
- func (row Row) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
- func (row Row) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
- func (row Row) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
- func (row Row) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGrid ¶ added in v0.4.0
NewGrid creates a new grid layout. Rows and columns are specified as slices of booleans, where true means a row or column will expand and false means it 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.
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)
Types ¶
type Column ¶
type Column []bool
Column arranges boxes in a column. Boxes that share an index with a true value will expand, and others will contract.
func (Column) Arrange ¶
func (column Column) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
func (Column) MinimumSize ¶
func (column Column) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
func (Column) RecommendedHeight ¶ added in v0.18.0
func (column Column) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
func (Column) RecommendedWidth ¶ added in v0.18.0
func (column Column) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
type Contract ¶ added in v0.12.0
type Contract bool
Contract is a layout that arranges boxes in a simple row or column according to their minimum sizes.
func (Contract) Arrange ¶ added in v0.12.0
func (contract Contract) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
func (Contract) MinimumSize ¶ added in v0.12.0
func (contract Contract) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
func (Contract) RecommendedHeight ¶ added in v0.18.0
func (contract Contract) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
func (Contract) RecommendedWidth ¶ added in v0.18.0
func (contract Contract) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
type Flow ¶ added in v0.12.0
type Flow bool
Flow is a grid layout where the number of rows and columns changes depending on the size of the container. It is designed to be used with an overflowing container. If the container does not overflow in the correct direction, the layout will behave like Contract.
func (Flow) Arrange ¶ added in v0.12.0
func (flow Flow) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
func (Flow) MinimumSize ¶ added in v0.12.0
func (flow Flow) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
func (Flow) RecommendedHeight ¶ added in v0.18.0
func (flow Flow) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
func (Flow) RecommendedWidth ¶ added in v0.18.0
func (flow Flow) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
type Grid ¶ added in v0.4.0
type Grid struct {
// contains filtered or unexported fields
}
Grid is a layout that arranges boxes in a grid formation with distinct rows and columns. It is great for creating forms.
func (*Grid) Arrange ¶ added in v0.4.0
func (this *Grid) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
func (*Grid) MinimumSize ¶ added in v0.4.0
func (this *Grid) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
func (*Grid) RecommendedHeight ¶ added in v0.18.0
func (this *Grid) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
func (*Grid) RecommendedWidth ¶ added in v0.18.0
func (this *Grid) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int
type Row ¶
type Row []bool
Row arranges boxes in a row. Boxes that share an index with a true value will expand, and others will contract.
func (Row) Arrange ¶
func (row Row) Arrange(hints tomo.LayoutHints, boxes tomo.BoxArranger)
func (Row) MinimumSize ¶
func (row Row) MinimumSize(hints tomo.LayoutHints, boxes tomo.BoxQuerier) image.Point
func (Row) RecommendedHeight ¶ added in v0.18.0
func (row Row) RecommendedHeight(hints tomo.LayoutHints, boxes tomo.BoxQuerier, width int) int
func (Row) RecommendedWidth ¶ added in v0.18.0
func (row Row) RecommendedWidth(hints tomo.LayoutHints, boxes tomo.BoxQuerier, height int) int