Class

NSMenuItemCell

An object that handles the measurement and display of a single menu item in its encompassing frame.

Overview

Topics

Configuring Menu-Item Attributes

var menuItem: NSMenuItem?

The menu item object associated with the cell.

Calculating the Size of a Menu Item

func calcSize()

Calculates the minimum required width and height of the receiver’s menu item.

var needsSizing: Bool

A Boolean value indicating whether the size of the menu needs to be calculated.

var imageWidth: CGFloat

The width of the image associated with the menu item.

var titleWidth: CGFloat

The width of the menu item’s text, measured in points.

var keyEquivalentWidth: CGFloat

The width of the menu item’s key equivalent string.

var stateImageWidth: CGFloat

The width of the image used to indicate the state of the menu item.

Getting the Menu Item’s Drawing Rectangle

func keyEquivalentRect(forBounds: NSRect)

Returns the rectangle into which the menu item’s key equivalent should be drawn.

func stateImageRect(forBounds: NSRect)

Returns the rectangle into which the menu item’s state image should be drawn.

func titleRect(forBounds: NSRect)

Returns the rectangle into which the menu item’s title should be drawn.

Drawing the Menu Item

func drawBorderAndBackground(withFrame: NSRect, in: NSView)

Draws the borders and background associated with the receiver’s menu item (if any).

func drawImage(withFrame: NSRect, in: NSView)

Draws the image associated with the menu item.

func drawKeyEquivalent(withFrame: NSRect, in: NSView)

Draws the key equivalent associated with the menu item.

func drawStateImage(withFrame: NSRect, in: NSView)

Draws the state image associated with the menu item.

func drawTitle(withFrame: NSRect, in: NSView)

Draws the title associated with the menu item.

var needsDisplay: Bool

A Boolean value indicating whether the menu item needs to be displayed.

Assigning a Tag

var tag: Int

The integer tag of the selected menu item.

Relationships

Inherits From

See Also

Views and Controls

class NSForm

An NSForm object is a vertical matrix of NSFormCell objects to implement the fields.

Deprecated
class NSFormCell

The NSFormCell class is used to implement text entry fields in a form. The left part of an NSFormCell object contains a title. The right part contains an editable text entry field.

func NSReleaseAlertPanel(Any!)

Disposes of an alert panel.

Deprecated