Skip to main content

Module menu

Module menu 

Source
Expand description

Item — a row in a dropped menu — and card, the panel that paints a list of them plus the panels its Item::Submenu rows drop.

Every menu in the system is those two over the caller’s own open state: the bar’s dropped panel (crate::menubar), the ··· on a row, the picker under a chip. The state stays with the caller because only it knows what opening means — a crate::popover::Popup for one, a field for another.

Cursor is the one piece of state the card asks for: which submenus are down and which row is live. Pointer and keyboard both move it, so the two can never disagree about which row an open submenu hangs off. What the pointer did comes back as a Hit; acting on it stays the caller’s.

Structs§

Cursor
Where an open menu is being worked: open is the chain of submenu rows currently down, outermost first, and row is the live row in the menu that chain ends at.

Enums§

Hit
What the pointer did to a menu. Every variant is a request: the caller’s Cursor and open state are what answer it.
Item
A row in a menu.

Functions§

at
The item path names — one row index per level, outermost first.
card
The panel a menu drops: every Item as a row, in a popover::popover_card, with a further panel hanging off each submenu row the Cursor holds open. id prefixes the rows’ element ids, so two menus open at once keep their hover state apart.
items_at
The menu path opens into: items itself for an empty path, else the rows of the submenu each index names. None as soon as one of them does not name an open-able submenu.
next_selectable
The next row the keyboard can land on, delta deciding the direction: separators and disabled rows are stepped straight over, and both ends wrap. from of None enters the menu at the edge the direction comes from.