Menu

A popup menu — a list of items, separators and submenus.

Wraps an HMENU from CreatePopupMenu. Use as a window menu's child (via MenuBar.append), as a submenu (via appendSubmenu), or as a standalone context menu (via showPopupMenu).

Constructors

this
this()

Create an empty popup menu.

Members

Functions

append
MenuItem* append(MenuItem item)

Append a command item.

appendSeparator
void appendSeparator()

Append a separator line.

appendSubmenu
void appendSubmenu(Menu submenu, string label)

Append a submenu under label.

dispose
void dispose()

Release the menu's native resources: drop its items from the command registry and destroy its HMENU (which frees any submenu handles too).

findItem
MenuItem* findItem(int id)

Find a stored item by id, searching this menu and its submenus.

handle
HMENU handle()

The native menu handle.

setChecked
void setChecked(int id, bool checked)

Set (or clear) the check mark on item id.

setEnabled
void setEnabled(int id, bool enabled)

Enable or disable item id.

setItemText
bool setItemText(int id, string label)

Change the visible label of item id (its accelerator text is preserved), searching this menu and its submenus. Returns true if the item was found. Useful for retranslating menus when the UI language changes at runtime.

Meta