Class

NSMenuItemCell

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

Declaration

@interface NSMenuItemCell : NSButtonCell

Overview

Topics

Configuring Menu-Item Attributes

menuItem

The menu item object associated with the cell.

Calculating the Size of a Menu Item

- calcSize

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

needsSizing

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

imageWidth

The width of the image associated with the menu item.

titleWidth

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

keyEquivalentWidth

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

stateImageWidth

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

Getting the Menu Item’s Drawing Rectangle

- keyEquivalentRectForBounds:

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

- stateImageRectForBounds:

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

- titleRectForBounds:

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

Drawing the Menu Item

- drawBorderAndBackgroundWithFrame:inView:

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

- drawImageWithFrame:inView:

Draws the image associated with the menu item.

- drawKeyEquivalentWithFrame:inView:

Draws the key equivalent associated with the menu item.

- drawSeparatorItemWithFrame:inView:

Draws a menu item separator.

- drawStateImageWithFrame:inView:

Draws the state image associated with the menu item.

- drawTitleWithFrame:inView:

Draws the title associated with the menu item.

needsDisplay

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

Assigning a Tag

tag

The integer tag of the selected menu item.

Relationships

Inherits From