类型 SubmenuState

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

type SubmenuState ui.ID

SubmenuState is caller-owned open submenu identity: the ID of the row whose submenu is open, or zero when none is. A submenu has its own state so Escape and Left can close it without closing the menu around it, and so a hover intent can move between siblings.

构造函数

SubmenuHover#

func SubmenuHover(state SubmenuState, hovered ui.ID, pointer ui.Point, hoveredRect, openTriggerRect, panelRect ui.Rect, now time.Time, intent *HoverIntent, delay time.Duration) (SubmenuState, time.Duration)

SubmenuHover advances one submenu's hover intent. state is the open submenu, pointer the current pointer, and triggerRect/panelRect their geometry when it is open. A pointer over another trigger row opens that row's submenu after delay; a pointer in the grace area between the open trigger and its panel (see SubmenuSafe) keeps it open; a pointer outside both closes it at once, as Base UI's default close delay does. It returns the state and how long to wait before asking again (zero when nothing is pending).

方法

Close#

func (SubmenuState) Close() SubmenuState

Close returns the state with no submenu open.

IsAnyOpen#

func (state SubmenuState) IsAnyOpen() bool

IsAnyOpen reports whether any submenu is open.

IsOpen#

func (state SubmenuState) IsOpen(trigger ui.ID) bool

IsOpen reports whether trigger's submenu is open.

Open#

func (state SubmenuState) Open(trigger ui.ID) SubmenuState

Open returns the state with trigger's submenu open. Zero is ignored.

Trigger#

func (state SubmenuState) Trigger() ui.ID

Trigger returns the row whose submenu is open, or zero.