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

MenuCell



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
initTextCell:
Setting the update action setUpdateAction:forMenu:
updateAction
Checking for a submenu hasSubmenu
Tracking the mouse trackMouse:inRect:ofView:
Setting user key equivalents + useUserKeyEquivalents:
userKeyEquivalent
Archiving read:
write:



Class Methods

useUserKeyEquivalents:
+ 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

hasSubmenu
(BOOL)hasSubmenu

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

See also:  setSubmenu:forItem: (Menu)



init
init

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

See also:  initTextCell:



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:
read:(NXTypedStream *)stream

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

See also:  write:



setUpdateAction:forMenu:
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)



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

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

See also:  mouseDown: (Menu)



updateAction
(SEL)updateAction

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

See also:  setUpdateAction:forMenu:



userKeyEquivalent
(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:
write:(NXTypedStream *)stream

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

See also:  read: