Type DropdownMenu

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

DropdownMenu paints a source-owned menu surface. Selection, open state, placement, and keyboard routing remain application/runtime state.

Constructors

BeginDropdownMenu#

func BeginDropdownMenu(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, options DropdownMenuOptions) DropdownMenu

BeginDropdownMenu paints an open menu using caller-owned layer, focus scope, and Escape action identities. Bounds are normalized to Vega's 8rem minimum (6rem for a submenu).

Methods

AddItem#

func (menu *DropdownMenu) AddItem(item DropdownMenuItem) ui.Rect

AddItem paints one action, checkbox, radio option, or submenu trigger. The rectangle is empty when the row is scrolled out of the menu.

AddItemSlot#

func (menu *DropdownMenu) AddItemSlot(item DropdownMenuItem) (row, slot ui.Rect)

AddItemSlot paints an item like AddItem and also returns the rectangle its TrailingWidth reserved, vertically centered in the row and ending 8px from its edge. The slot is empty when the item has no TrailingWidth or is scrolled out of the menu. Paint into it between BeginContent and EndContent.

AddLabel#

func (menu *DropdownMenu) AddLabel(label string, inset bool) ui.Rect

AddLabel paints one medium-weight group label and returns its row geometry.

AddSeparator#

func (menu *DropdownMenu) AddSeparator() ui.Rect

AddSeparator paints the official -mx-1/my-1 divider geometry.

BeginContent#

func (menu *DropdownMenu) BeginContent()

BeginContent enters the menu's layer and focus scope so the caller's own components, painted until EndContent, belong to the menu: above the page, inside its focus trap, and hit-tested over the row beneath.

Bounds#

func (menu DropdownMenu) Bounds() ui.Rect

Bounds returns the normalized overlay geometry.

End#

func (menu *DropdownMenu) End()

End paints the scrollbar of a menu whose items did not all fit, after the last item, and ends the menu's entrance and exit: call it once the last item is painted, or the menu appears and disappears at once.

EndContent#

func (menu *DropdownMenu) EndContent()

EndContent leaves the layer and focus scope BeginContent entered.

NextItemBounds#

func (menu DropdownMenu) NextItemBounds() ui.Rect

NextItemBounds returns the next 32px keyboard-navigation row without advancing the declaration cursor.