Protocol

NSMenuDelegate

The optional methods implemented by delegates of NSMenu objects to manage menu display and handle some events.

Declaration

@protocol NSMenuDelegate

Topics

Handling Keyboard Equivalents

- menuHasKeyEquivalent:forEvent:target:action:

Invoked to allow the delegate to return the target and action for a key-down event.

Updating Menu Layout

- menu:updateItem:atIndex:shouldCancel:

Invoked to let the delegate update a menu item before it is displayed.

- confinementRectForMenu:onScreen:

Invoked to allow the delegate to specify a display location for the menu.

Handling Highlighting

- menu:willHighlightItem:

Invoked to indicate that a menu is about to highlight a given item.

Handling Open and Close Events

- menuWillOpen:

Invoked when a menu is about to open.

- menuDidClose:

Invoked after a menu closed.

Handling Tracking

- numberOfItemsInMenu:

Invoked when a menu is about to be displayed at the start of a tracking session so the delegate can specify the number of items in the menu.

- menuNeedsUpdate:

Invoked when a menu is about to be displayed at the start of a tracking session.

Relationships

Inherits From

Conforming Types

See Also

Menus

NSMenu

An object that manages an app’s menus.

NSMenuItem

A command item in an app menu.