类型 Combobox

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

type Combobox struct {
	// contains filtered or unexported fields
}

Combobox paints an editable trigger and its optional popup snapshot.

构造函数

BeginCombobox#

func BeginCombobox(canvas *ui.Canvas, theme ui.Theme, inputBounds ui.Rect, options ComboboxOptions) Combobox

BeginCombobox paints the input group and optional popup surface.

方法

AddEmpty#

func (combobox *Combobox) AddEmpty(label string) ui.Rect

AddEmpty paints the centered empty-result state.

AddItem#

func (combobox *Combobox) AddItem(item ComboboxItem) ui.Rect

AddItem paints one option and its selected indicator.

AddLabel#

func (combobox *Combobox) AddLabel(label string) ui.Rect

AddLabel paints one compact group label.

AddSeparator#

func (combobox *Combobox) AddSeparator() ui.Rect

AddSeparator paints the official one-pixel divider.

ContentBounds#

func (combobox Combobox) ContentBounds() ui.Rect

ContentBounds returns the normalized open popup geometry.

End#

func (combobox Combobox) End()

End ends the popup's entrance and exit: call it once the last item is painted, or the popup appears and disappears at once. A closed combobox needs no End, and is not harmed by one.

InputBounds#

func (combobox Combobox) InputBounds() ui.Rect

InputBounds returns the normalized input geometry.

Match#

func (combobox Combobox) Match(prefix string, from ui.ID) (ui.ID, bool)

Match is MenuScroll.Match for the open options.

Navigate#

func (combobox Combobox) Navigate(key ui.Key, from ui.ID, loop bool) (ui.ID, bool)

Navigate moves the keyboard through the open options and scrolls the one it reaches into view; see MenuScroll.Navigate.

NextItemBounds#

func (combobox Combobox) NextItemBounds() ui.Rect

NextItemBounds returns the next option row without mutating state.

PaintChip#

func (combobox Combobox) PaintChip(bounds ui.Rect, chip ComboboxChip) ui.Rect

PaintChip paints one source-owned multi-selection token. The caller provides both geometry and a stable remove action ID; PaintChips lays chips out and paints them in a container instead.