Protocol

NSMenuDelegate

The NSMenuDelegate protocol defines the optional methods implemented by delegates of NSMenu objects.

Symbols

Handling Keyboard Equivalents

Updating Menu Layout

func menu(NSMenu, update: NSMenuItem, at: Int, shouldCancel: Bool)

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

func confinementRect(for: NSMenu, on: NSScreen?)

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

Handling Highlighting

func menu(NSMenu, willHighlight: NSMenuItem?)

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

Handling Open and Close Events

func menuWillOpen(NSMenu)

Invoked when a menu is about to open.

func menuDidClose(NSMenu)

Invoked after a menu closed.

Handling Tracking

func numberOfItems(in: NSMenu)

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.

func menuNeedsUpdate(NSMenu)

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

Relationships

Inherits From

Adopted By