O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSMenuItem — Mac OS X 10.0

Synopsis

This class declares the interface to objects that make up commands in an NSMenu. NSMenuItems have an associated target and action, and may optionally have a key equivalent that the user can use to activate the menu item. Menu items are also capable of maintaining a state (on, off, or mixed).

image with no caption

@interface NSMenuItem : NSObject <NSMenuItem>
                                  // Initializers
   - (id)initWithTitle:(NSString *)aString 
                                 action:(SEL)aSelector 
                                 keyEquivalent:(NSString *)charCode;
                                  // Accessor Methods
   - (void)setAction:(SEL)aSelector;
   - (SEL)action;
   - (void)setRepresentedObject:(id)anObject;
   - (id)representedObject;
   - (void)setSubmenu:(NSMenu *)submenu;
   - (NSMenu *)submenu;
   - (void)setTag:(int)anInt;
   - (int)tag;
   - (void)setTitle:(NSString *)aString;
   - (NSString *)title;
   - (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
   - (void)setKeyEquivalent:(NSString *)aKeyEquivalent;
   - (NSString *)keyEquivalent;
   - (void)setTarget:(id)anObject;
   - (id)target;
   - (void)setKeyEquivalentModifierMask:(unsigned int)mask;
   - (unsigned int)keyEquivalentModifierMask;
   - (void)setEnabled:(BOOL)flag;
   - (void)setMixedStateImage:(NSImage *)image;
   - (NSImage *)mixedStateImage;
   - (void)setMnemonicLocation:(unsigned)location;
   - (unsigned)mnemonicLocation;
   - (void)setOffStateImage:(NSImage *)image;
   - (NSImage *)offStateImage;
   - (void)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required