MenuBar

A window menu bar — the horizontal strip of top-level menus.

Wraps an HMENU from CreateMenu. Build it with append, then attach it to a window with Window.setMenuBar, which also installs its accelerator table.

Constructors

this
this()

Create an empty menu bar.

Members

Functions

append
void append(Menu menu, string label)

Append a top-level menu under label.

buildAcceleratorTable
HACCEL buildAcceleratorTable()

Build an accelerator table from every accelerator-bearing item in the bar. Returns null when there are no accelerators.

dispose
void dispose()

Release the menu bar's native resources: drop every item from the command registry and destroy the bar's HMENU (which frees its menus' handles too).

findItem
MenuItem* findItem(int id)

Find a stored item by id across every menu in the bar.

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
void setItemText(int id, string label)

Change the label of item id anywhere in the bar (accelerator preserved). Call DrawMenuBar(window.handle) afterward if a top-level item changed.

setMenuTitle
void setMenuTitle(int index, string label)

Change the title of the top-level menu at index (e.g. retranslating "File"/"Edit"). Call DrawMenuBar(window.handle) afterward to repaint.

Meta