Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.


Inherits From: ButtonCell : ActionCell : Cell : Object
Declared In: appkit/MenuCell.h

Class Description

MenuCell is a subclass of ButtonCell that appears in Menus.  MenuCells draw their text left-justified and show an optional key equivalent or submenu arrow on the right.  See the Menu class specification for more information.  PopUpList is a subclass of Menu that uses MenuCells for its entries.

Instance Variables

SEL updateAction;

updateAction Method to make the MenuCell reflect its applicability to the application's state

Method Types

Initializing a new MenuCell init
Setting the update action setUpdateAction:forMenu:
Checking for a submenu hasSubmenu
Tracking the mouse trackMouse:inRect:ofView:
Setting user key equivalents + useUserKeyEquivalents:
Archiving read:

Class Methods

+ useUserKeyEquivalents:(BOOL)flag

Sets whether MenuCells conform to user preferences for key equivalents.  If flag is YES, then MenuCells replace their key equivalents with those in the user's defaults.  If NO, the key equivalents originally assigned to the MenuCells are used.

See also:  userKeyEquivalent

Instance Methods


Return YES if the MenuCell brings up a submenu, NO otherwise.

See also:  setSubmenu:forItem: (Menu)


Initializes and returns the receiver, a new instance of MenuCell, with the default title "MenuItem".

See also:  initTextCell:

initTextCell:(const char *)aString

Initializes and returns the receiver, a new instance of MenuCell, with aString as its title.  This is the designated initializer for the MenuCell class; override this method if you create a subclass of MenuCell that performs its own initialization.  You should never use Cell's initIconCell: with MenuCells.

See also:  init

read:(NXTypedStream *)stream

Reads the MenuCell from the typed stream stream.  Returns self.

See also:  write:

setUpdateAction:(SEL)aSelector forMenu:aMenu

Sets the MenuCell's update action to aSelector, and sets aMenu to autoupdate.  A MenuCell's update action should be a method that takes one id, the MenuCell to be updated, as the argument, and returns YES if the MenuCell needs to be redrawn, NO if it doesn't.  The update action should alter the MenuCell if needed to reflect its applicability in the current state of the application. This may involve enabling or disable the MenuCell, changing its title, or setting its state.  The MenuCell's Menu sends the update action to the first of the following that responds to it:  the Menu's delegate, the Application object, or the Application object's delegate.  Returns self.

See also:  update (Menu), setAutoupdate: (Menu), updateWindows: (Application)

(BOOL)trackMouse:(NXEvent *)theEvent
inRect:(const NXRect *)cellFrame

Passes theEvent as the argument of a mouseDown: message to the receiver's Menu.  Menus handle all mouse tracking themselves.

See also:  mouseDown: (Menu)


Returns the update action used to update the receiver's state in response to an automatic application update.

See also:  setUpdateAction:forMenu:

(unsigned short)userKeyEquivalent

If the MenuCell class has been configured to use user key equivalents, returns the user-assigned key equivalent for the receiving MenuCell.

See also:  + useUserKeyEquivalents:

write:(NXTypedStream *)stream

Writes the receiving MenuCell to the typed stream stream.  Returns self.

See also:  read: