Expand description
The drop-down / pop-up menu box.
MenuBox is a framed, shadowed MenuView that lays its items out
vertically, one per row. The box-specific work is its layout: the static
menu_box_rect sizing helper, frame_line,
draw, and get_item_rect. Its
handle_event delegates to the shared passive
menu_view::handle_event; the interactive navigation runs in the menu
session that owns the open box.
§The inset frame (intentional, not a bug)
frame_line writes the corner/edge glyph at columns 1
and size.x-2, leaving column 0 and column size.x-1 blank. The menu-box
frame is deliberately inset one column on each side (those outer columns are
spaces in the frame-glyph table), and the snapshot captures it. Do not
“correct” it.
§The per-line colour fill
Each frame row fills the interior columns [2, size.x-2) with a per-line
colour (its lo style), while the border cells keep the normal box style. A
selected or disabled item row highlights its interior by passing that colour
into the middle frame row, then the name is drawn over it in the same colour.
As with MenuBar, MenuViewState embeds a
ViewState (not a View), so the differing View methods are
hand-written rather than generated.
§Turbo Vision heritage
Ports TMenuBox (tmenubox.cpp/menus.h). The TMenuView base becomes the
MenuView trait (deviation D2); TStreamable persistence is dropped
(deviation D12).
Structs§
- MenuBox
- The framed, shadowed vertical menu box. Holds the shared
MenuViewState; the box-specific layout lives in the methods below.
Functions§
- menu_
box_ rect - Compute the box bounds that fit
menuinsidebounds.