vxlayout

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlexDirection

type FlexDirection int
const (
	FlexHorizontal FlexDirection = iota
	FlexVertical
)

type FlexItem

type FlexItem struct {
	vxfw.Widget

	// Flex determines how much space the widget takes in the layout.
	// Flex of 0 means the widget will be its inherent size.
	// Remaining space is divided proportionally to all FlexItems with Flex > 0
	Flex uint8
}

FlexItem is a vxfw.Widget used in a FlexLayout

func MustSpacer

func MustSpacer(flex uint8) *FlexItem

MustSpacer is like NewSpacer, but panics if flex is less than 1.

func NewSpacer

func NewSpacer(flex uint8) (*FlexItem, error)

NewSpacer returns a FlexItem that fills available flex space based on the value of flex. It is an error to pass a flex less than 1.

type FlexLayout

type FlexLayout struct {
	Children  []*FlexItem
	Direction FlexDirection
}

func (*FlexLayout) Draw

func (w *FlexLayout) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error)

func (*FlexLayout) HandleEvent

func (w *FlexLayout) HandleEvent(_ vaxis.Event, _ vxfw.EventPhase) (vxfw.Command, error)

type Spacer

type Spacer struct{}

Spacer is a vxfw.Widget that takes up available space. It should be used in a FlexItem with a flex of at least 1. Use NewSpacer or MustSpacer for a FlexItem that can be passed directly to FlexLayout

func (Spacer) Draw

func (s Spacer) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error)

func (Spacer) HandleEvent

func (s Spacer) HandleEvent(_ vaxis.Event, _ vxfw.EventPhase) (vxfw.Command, error)

Jump to

Keyboard shortcuts

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