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§
- Confirm
- Cursor
- Where an open menu is being worked:
openis the chain of submenu rows currently down, outermost first,rowis the live row in the menu that chain ends at, andsegmentthe live segment when that row is anItem::Segmented. - Dismiss
- Menu
Indent - How far each
Item::indentedlevel moves a row’s content in, app-wide. - Menu
Width - How wide a menu’s panels sit, app-wide.
- Segment
- One option of an
Item::Segmentedrow. - Select
Child - Select
Next - Select
Parent - Select
Previous
Enums§
- Described
- How a panel holding a described row is sized. A description is one line, cut at the panel’s edge.
- Edit
- A row of a text surface’s right-click menu, in the order
edit_itemslists them. - Hit
- What the pointer did to a menu. Every variant is a request: the caller’s
Cursorand open state are what answer it. - Item
- A row in a menu.
Constants§
- SEARCH_
CONTEXT - The key context around a searchable submenu’s query field. Typing goes to the field; the arrows, enter and escape fall through to the menu.
Functions§
- at
- The item
pathnames — one row index per level, outermost first.Nonefor a path to a segment of anItem::Segmentedrow; its path less the last index names the row. - bindings
- The keymap a searchable submenu and a
crate::context_menuanswer to, as data — seecrate::keys. - card
- The panel a menu drops: every
Itemas a row, in apopover::popover_card, with a further panel hanging off each submenu row theCursorholds open.idprefixes the rows’ element ids, so two menus open at once keep their hover state apart. In a test build each action and submenu row answers to the debug selector{id}/{label}. - edit_
items - The rows of a text surface’s right-click menu.
actionsare the surface’s own Cut, Copy, Paste and Select All, read for the chord each row prints. - glyph_
slot - The leading column: the row’s glyph, or the room one would have taken, so a menu of mixed rows keeps its labels on one edge.
- init
- Install
bindings. Call once at startup. - items_
at - The menu
pathopens into:itemsitself for an empty path, else the rows of the submenu each index names.Noneas soon as one of them does not name an open-able submenu. - next_
selectable - The next row the keyboard can land on,
deltadeciding the direction: separators and disabled rows are stepped straight over, and both ends wrap.fromofNoneenters the menu at the edge the direction comes from.