Documentation ¶
Index ¶
- Constants
- Variables
- func Cross(a Axis, pt *image.Point) *int
- func Main(a Axis, pt *image.Point) *int
- func MiddleAligned(gtx Context, w Widget) layout.Dimensions
- func Overlay(gtx Context, w1 Widget, w2 Widget) layout.Dimensions
- func RightAligned(gtx Context, w Widget) layout.Dimensions
- func Rigids(gtx Context, axis layout.Axis, ws ...Widget) layout.Dimensions
- func WithCursor(gtx Context, p pointer.Cursor, w Widget) layout.Dimensions
- type Alignment
- type Axis
- type Constraints
- type Context
- type Dimensions
- type Direction
- type Flex
- type FlexChild
- type Inset
- type List
- type ListElement
- type PixelInset
- type Position
- type SmallGrid
- type Spacer
- type Spacing
- type Stack
- type Widget
Constants ¶
View Source
const ( SpaceEnd = layout.SpaceEnd SpaceStart = layout.SpaceStart SpaceSides = layout.SpaceSides SpaceAround = layout.SpaceAround SpaceBetween = layout.SpaceBetween SpaceEvenly = layout.SpaceEvenly )
View Source
const ( Start = layout.Start End = layout.End Middle = layout.Middle Baseline = layout.Baseline )
View Source
const ( NW = layout.NW N = layout.N NE = layout.NE E = layout.E SE = layout.SE S = layout.S SW = layout.SW W = layout.W Center = layout.Center )
View Source
const ( Horizontal = layout.Horizontal Vertical = layout.Vertical )
Variables ¶
View Source
var Exact = layout.Exact
View Source
var Expanded = layout.Expanded
View Source
var Flexed = layout.Flexed
View Source
var NewContext = layout.NewContext
View Source
var Rigid = layout.Rigid
View Source
var Stacked = layout.Stacked
View Source
var UniformInset = layout.UniformInset
Functions ¶
func MiddleAligned ¶ added in v0.4.0
func MiddleAligned(gtx Context, w Widget) layout.Dimensions
func RightAligned ¶ added in v0.4.0
func RightAligned(gtx Context, w Widget) layout.Dimensions
func WithCursor ¶ added in v0.4.0
Types ¶
type Constraints ¶
type Constraints = layout.Constraints
func Normalize ¶
func Normalize(c Constraints) Constraints
type Dimensions ¶
type Dimensions = layout.Dimensions
type List ¶
type List struct { Axis Axis // ScrollToEnd instructs the list to stay scrolled to the far end position // once reached. A List with ScrollToEnd == true and Position.BeforeEnd == // false draws its content with the last item at the bottom of the list // area. ScrollToEnd bool // Alignment is the cross axis alignment of list elements. Alignment Alignment // Position is updated during Layout. To save the list scroll position, // just save Position after Layout finishes. To scroll the list // programmatically, update Position (e.g. restore it from a saved value) // before calling Layout. Position Position // contains filtered or unexported fields }
List displays a subsection of a potentially infinitely large underlying list. List accepts user input to scroll the subsection.
func (*List) Layout ¶ added in v0.4.0
func (l *List) Layout(gtx Context, len int, w ListElement) Dimensions
Layout a List of len items, where each item is implicitly defined by the callback w. Layout can handle very large lists because it only calls w to fill its viewport and the distance scrolled, if any.
type ListElement ¶
type ListElement = layout.ListElement
type PixelInset ¶
type PixelInset struct {
Top, Bottom, Left, Right int
}
PixelInset is like Inset, but using pixel coordinates instead of dp.
func (PixelInset) Layout ¶
func (in PixelInset) Layout(gtx Context, w Widget) Dimensions
type Position ¶
type Position struct { // BeforeEnd tracks whether the List position is before the very end. We // use "before end" instead of "at end" so that the zero value of a // Position struct is useful. // // When laying out a list, if ScrollToEnd is true and BeforeEnd is false, // then First and Offset are ignored, and the list is drawn with the last // item at the bottom. If ScrollToEnd is false then BeforeEnd is ignored. BeforeEnd bool // First is the index of the first visible child. First int // Offset is the distance in pixels from the leading edge to the child at index // First. Offset int // OffsetLast is the signed distance in pixels from the trailing edge to the // bottom edge of the child at index First+Count. OffsetLast int // Count is the number of visible children. Count int // Length is the estimated total size of all children, measured in pixels. Length int ForceEndAligned bool }
Position is a List scroll offset represented as an offset from the top edge of a child element.
Click to show internal directories.
Click to hide internal directories.