类型 ToggleGroup

API 文档由 Go 源码生成,内容为英文。

type ToggleGroup struct {

	// tabStop is the one item Tab reaches; arrows move among the others.

}

ToggleGroup paints compact Base UI-style toggles. The default treatment is borderless with eight logical pixels between items; Spacing(0) joins the items into one connected control, rounded only at its outer corners, with hairlines between outline items.

构造函数

BeginToggleGroup#

func BeginToggleGroup(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, options []ToggleGroupOption) ToggleGroup

BeginToggleGroup starts a horizontal toggle group.

方法

BoundsWidth#

func (group ToggleGroup) BoundsWidth() float32

BoundsWidth is the width the group paints at: the bounds', or with SizeToFit the width its items need.

Disabled#

func (group ToggleGroup) Disabled() ToggleGroup

Disabled renders every option as inert.

Large#

func (group ToggleGroup) Large() ToggleGroup

Large selects the large item size.

Outline#

func (group ToggleGroup) Outline() ToggleGroup

Outline selects the bordered item variant.

Paint#

func (group ToggleGroup) Paint() ToggleGroupResult

Paint draws stable per-option surfaces and hit regions.

SizeToFit#

func (group ToggleGroup) SizeToFit() ToggleGroup

SizeToFit sizes every item to its label (px-2.5, px-2 when joined, never narrower than tall) instead of splitting the bounds' width equally; the group is as wide as its items, or as the widest item when vertical. BoundsWidth reports it.

Small#

func (group ToggleGroup) Small() ToggleGroup

Small selects the compact item size.

Spacing#

func (group ToggleGroup) Spacing(spacing float32) ToggleGroup

Spacing sets logical pixels between items. Zero joins the items.

Vertical#

func (group ToggleGroup) Vertical() ToggleGroup

Vertical lays options out in a column.