outlay

package
Version: v0.0.0-...-1978dde Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: MIT, Unlicense Imports: 11 Imported by: 5

README

outlay

Go Reference

This package provides extra layouts for gio.

State

This package has no stable API, and should always be locked to a particular commit with go modules.

Layouts

Grid

This layout allows placement of many items in a grid with to several different strategies for wrapping across lines. For examples, run:

Radial

The radial layout allows you to lay out a set of widgets along an arc. The width and oritentation of the arc are configurable to allow for everything from a hand of cards to a full circle of widgets.

Known issues:

  • The radial layout does not currently return correct dimensions for itself, which breaks most attempts to use it as part of a larger layout.

Documentation

Overview

Package outlay provides extra layouts for gio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	time.Duration
	StartTime time.Time
}

Animation holds state for an Animation between two states that is not invertible.

func (*Animation) Animating

func (n *Animation) Animating(gtx layout.Context) bool

func (*Animation) Progress

func (n *Animation) Progress(gtx layout.Context) float32

Progress returns the current progress through the animation as a value in the range [0,1]

func (*Animation) SetDuration

func (n *Animation) SetDuration(d time.Duration)

func (*Animation) Start

func (n *Animation) Start(now time.Time)

type Cell

type Cell func(gtx layout.Context, x, y int) layout.Dimensions

Cell lays out the Table cell located at column x and row y.

type Fan

type Fan struct {
	Animation

	// The width, in radians, of the full arc that items should occupy.
	// If zero, math.Pi/2 will be used (1/4 of a full circle).
	WidthRadians float32

	// The offset, in radians, above the X axis to apply before rendering the
	// arc. This can be used with a value of Pi/4 to center an arc of width
	// Pi/2. If zero, math.Pi/4 will be used (1/8 of a full circle). To get the
	// equivalent of specifying zero, specify a value of 2*math.Pi.
	OffsetRadians float32

	// The radius of the hollow circle at the center of the fan. Leave nil to
	// use the default heuristic of half the width of the widest item.
	HollowRadius *unit.Value
	// contains filtered or unexported fields
}

func (*Fan) Layout

func (f *Fan) Layout(gtx layout.Context, items ...FanItem) layout.Dimensions

type FanItem

type FanItem struct {
	W       layout.Widget
	Elevate bool
}

func Item

func Item(evelvate bool, w layout.Widget) FanItem

type Grid

type Grid struct {
	Num       int
	Axis      layout.Axis
	Alignment layout.Alignment
	// contains filtered or unexported fields
}

Grid lays out at most Num elements along the main axis. The number of cross axis elements depend on the total number of elements.

func (*Grid) Layout

func (g *Grid) Layout(gtx layout.Context, num int, el GridElement) layout.Dimensions

type GridElement

type GridElement func(gtx layout.Context, i int) layout.Dimensions

GridElement lays out the ith element of a Grid.

type GridWrap

type GridWrap struct {
	Axis      layout.Axis
	Alignment layout.Alignment
}

GridWrap lays out as many elements as possible along the main axis before wrapping to the cross axis.

func (GridWrap) Layout

func (g GridWrap) Layout(gtx layout.Context, num int, el GridElement) layout.Dimensions

type Table

type Table struct {
	// CellSize returns the size for the cell located at column x and row y.
	CellSize func(m unit.Metric, x, y int) image.Point
	// contains filtered or unexported fields
}

Table lays out cells by their coordinates. All cells within a column have the same width, and the same height within a row.

func (*Table) Layout

func (t *Table) Layout(gtx layout.Context, xn, yn int, el Cell) layout.Dimensions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL