Expand description
The NeXTSTEP application menu (spec Β§4.1): a vertical floating panel with a black title bar and beveled items, whose submenus cascade to the right.
The menu knows nothing about the app. show draws it and returns the
Command the user picked, and the caller runs it. key_command maps the
key equivalents (Ctrl on Linux and Windows, Cmd on macOS) to the same
commands. Everything is painted with painter shapes and text.
StructsΒ§
- Menu
State - Where the menu sits and which submenu is open. Lives on the app.
- Row π
- One row of a menu panel, as drawn.
EnumsΒ§
- Command
- Something the user can ask for from the menu or a key equivalent.
- Top π
- What a top-level item does.
ConstantsΒ§
- BORDER π
- FONT_
SIZE π - ITEM_
HEIGHT π - MENU π
- The menu tree. Top level per spec Β§4.1; submenus hold the commands the app can already run, plus disabled placeholders for File.
- MENU_W π
- Room the main menu takes from the workspaceβs left edge: its ~110 px panel plus its margin. A fresh worksheet window opens clear of it.
- MIN_
WIDTH π - MODEL_
BROWSER π - NO_
VIEWS π - PAD π
- RIGHT_
SLOT π - Room between a label and the right-hand marker, plus the marker itself.
- TITLE π
- TITLE_
HEIGHT π
FunctionsΒ§
- bold π
- font π
- key_
command - Map a key equivalent (pressed with Ctrl/Cmd) to its command, read off the
MENUtree so the two canβt disagree: a lowercase letter is the plain chord, an uppercase one the chord with Shift. Y is a Redo alias. - keyed_
items π - Every menu item with a key equivalent, top level and submenus.
- menu_id
- The menu panelβs area id.
- paint_
row π - Paint one beveled item:
face, 1 px white top-left, 1 px black bottom-right, label left and its marker right-aligned. - panel π
- Draw one menu panel (title bar plus rows) in its own foreground [
Area] atpos. Returns the panelβs outer rect and each rowβs response. - panel_
size π - Outer size of a menu panel titled
titleholdingrows. - show
- Draw the menu and return the command picked this frame, if any.
viewsfills the View submenu as(name, is_current); picking the n-th returnsCommand::OpenView(n).enabledgreys out commands that canβt run now. The menuβs top-left starts athome; after that it stays where itβs dragged. - sub_id π
Type AliasesΒ§
- Leaf π
- A submenu row: label, key equivalent, command.
Noneis not built yet and draws disabled.