CPObjectCPMenuItem
@implementation CPMenuItem : CPObject
A CPMenuItem
is added to a CPMenu
.
It has an action and a target for that action to be sent to
whenever the item is 'activated'.
Method Summary | |
---|---|
+(CPMenuItem) | separatorItem Returns a new menu item separator. |
-(id) | initWithCoder:(CPCoder)aCoder Initializes the menu item from a coder. |
-(id) | initWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent Initializes the menu item with a title, action, and keyboard equivalent. |
-(SEL) | action Returns the item's action. |
-(CPImage) | alternateImage Returns the menu item's alternate image. |
-(void) | encodeWithCoder:(CPCoder)aCoder Writes the menu item out to a coder. |
-(CPFont) | font Returns the menu item's font. |
-(BOOL) | hasSubmenu Returns YES if the menu item has a submenu. |
-(CPImage) | image Returns the menu item's image. |
-(unsigned) | indentationLevel Returns the menu item's indentation level. |
-(BOOL) | isAlternate Returns YES if the menu item is an alternate for the previous item. |
-(BOOL) | isEnabled Returns YES if the item is enabled. |
-(BOOL) | isHidden Returns YES if the item is hidden. |
-(BOOL) | isHiddenOrHasHiddenAncestor Returns YES if the item is hidden or if one of it's supermenus is hidden. |
-(BOOL) | isHighlighted Returns YES if the menu item is highlighted. |
-(BOOL) | isSeparatorItem Returns YES if the menu item is a separator. |
-(CPString) | keyEquivalent Returns the keyboard shortcut for this menu item. |
-(unsigned) | keyEquivalentModifierMask Returns the item's keyboard shortcut modifier mask. |
-(CPMenu) | menu Returns the container menu of this item. |
-(CPImage) | mixedStateImage Returns the image shown when the menu item is in the 'mixed' state. |
-(CPString) | mnemonic Returns the menu items mnemonic character. |
-(unsigned) | mnemonicLocation Returns the index of the mnemonic character in the title. |
-(CPImage) | offStateImage Returns the image shown when the menu item is in the 'off' state. |
-(CPImage) | onStateImage Returns the image shown when the menu item is in the 'on' state. |
-(id) | representedObject Returns the item's represented object. |
-(void) | setAction:(SEL)anAction Sets the action that gets sent to the item's target when triggered. |
-(void) | setAlternate:(BOOL)isAlternate Sets whether this item is an alternate for the previous menu item. |
-(void) | setAlternateImage:(CPImage)anImage Sets the menu item's alternate image. |
-(void) | setEnabled:(BOOL)isEnabled Sets whether the menu item is enabled or not. |
-(void) | setFont:(CPFont)aFont Sets the font for the text of this menu item. |
-(void) | setHidden:(BOOL)isHidden Sets whether the item should be hidden. |
-(void) | setImage:(CPImage)anImage Sets the menu item's image. |
-(void) | setIndentationLevel:(unsigned)aLevel Sets the indentation level of the menu item. |
-(void) | setKeyEquivalent:(CPString)aString Sets the keyboard shortcut for this menu item. |
-(void) | setKeyEquivalentModifierMask:(unsigned)aMask Sets the modifier mask used for the item's keyboard shortcut. |
-(void) | setMenu:(CPMenu)aMenu Set the container menu of this item. |
-(void) | setMixedStateImage:(CPImage)anImage Sets the image that is shown when the menu item is in the 'mixed' state. |
-(void) | setMnemonicLocation:(unsigned)aLocation Sets the index of the mnemonic character in the title. |
-(void) | setOffStateImage:(CPImage)anImage Sets the image that is shown when the menu item is in the 'off' state. |
-(void) | setOnStateImage:(CPImage)anImage Sets the image that is shown when the menu item is in the 'on' state. |
-(void) | setRepresentedObject:(id)anObject Sets the menu item's represented object. |
-(void) | setState:(int)aState Sets the state of the menu item. |
-(void) | setSubmenu:(CPMenu)aMenu Sets the submenu for this item. |
-(void) | setTag:(int)aTag Sets the menu item's tag. |
-(void) | setTarget:(id)aTarget Sets the menu item's action target. |
-(void) | setTitle:(CPString)aTitle Sets the item's title. |
-(void) | setTitleWithMnemonicLocation:(CPString)aTitle Sets the title of the menu item and the mnemonic character. |
-(void) | setToolTip:(CPString)aToolTip Sets the tooltip for the menu item. |
-(void) | setView:(CPView)aView Sets the view for the menu item. |
-(int) | state Returns the menu item's current state. |
-(CPMenu) | submenu Returns the submenu of the item. |
-(int) | tag Returns the item's tag. |
-(id) | target Returns the item's action target. |
-(CPString) | title Returns the menu item's title. |
-(CPString) | toolTip Returns the item's tooltip. |
-(CPView) | view Returns the menu item's view. |
Method Detail |
---|
+(CPMenuItem)separatorItem
-(id)initWithCoder:(CPCoder)aCoder
aCoder
- the coder from which to initialize-(id)initWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent
aTitle
- the menu item's titleanAction
- the action that gets triggered when the item is selectedaKeyEquivalent
- the keyboard shortcut for the item-(SEL)action
-(CPImage)alternateImage
-(void)encodeWithCoder:(CPCoder)aCoder
aCoder
- the coder to write the menu item out to-(CPFont)font
-(BOOL)hasSubmenu
YES
if the menu item has a submenu.-(CPImage)image
-(unsigned)indentationLevel
-(BOOL)isAlternate
YES
if the menu item is an alternate for the previous item.-(BOOL)isEnabled
YES
if the item is enabled.-(BOOL)isHidden
YES
if the item is hidden.-(BOOL)isHiddenOrHasHiddenAncestor
YES
if the item is hidden or if one of it's supermenus is hidden.-(BOOL)isHighlighted
YES
if the menu item is highlighted.-(BOOL)isSeparatorItem
YES
if the menu item is a separator.-(CPString)keyEquivalent
-(unsigned)keyEquivalentModifierMask
CPShiftKeyMask
CPAlternateKeyMask
CPCommandKeyMask
CPControlKeyMask
-(CPMenu)menu
-(CPImage)mixedStateImage
-(CPString)mnemonic
-(unsigned)mnemonicLocation
-(CPImage)offStateImage
-(CPImage)onStateImage
-(id)representedObject
-(void)setAction:(SEL)anAction
anAction
- the action to send-(void)setAlternate:(BOOL)isAlternate
isAlternate
- YES
denotes that this menu item is an alternate-(void)setAlternateImage:(CPImage)anImage
anImage
- the menu item's alternate image-(void)setEnabled:(BOOL)isEnabled
isEnabled
- YES
enables the item. NO
disables it.-(void)setFont:(CPFont)aFont
aFont
- the font for the menu item-(void)setHidden:(BOOL)isHidden
isHidden
- YES
hides the item. NO
reveals it.-(void)setImage:(CPImage)anImage
anImage
- the menu item's image-(void)setIndentationLevel:(unsigned)aLevel
aLevel
- the item's new indentation levelCPInvalidArgumentException
- if aLevel is less than 0-(void)setKeyEquivalent:(CPString)aString
aString
- the keyboard shortcut-(void)setKeyEquivalentModifierMask:(unsigned)aMask
CPShiftKeyMask
CPAlternateKeyMask
CPCommandKeyMask
CPControlKeyMask
aMask
-(void)setMenu:(CPMenu)aMenu
aMenu
- the item's container menu-(void)setMixedStateImage:(CPImage)anImage
anImage
- the image to show-(void)setMnemonicLocation:(unsigned)aLocation
aLocation
- the index of the character in the title-(void)setOffStateImage:(CPImage)anImage
anImage
- the image to show-(void)setOnStateImage:(CPImage)anImage
anImage
- the image to show-(void)setRepresentedObject:(id)anObject
anObject
- the represented object-(void)setState:(int)aState
CPMixedState
CPOnState
CPOffState
aState
-(void)setSubmenu:(CPMenu)aMenu
aMenu
- the submenu-(void)setTag:(int)aTag
aTag
- the tag for the item-(void)setTarget:(id)aTarget
aTarget
- the target for the action-(void)setTitle:(CPString)aTitle
aTitle
- the item's new title-(void)setTitleWithMnemonicLocation:(CPString)aTitle
aTitle
- the title string with a denoted mnemonic-(void)setToolTip:(CPString)aToolTip
aToolTip
- the tool tip for the item-(void)setView:(CPView)aView
aView
- the menu's item's view-(int)state
CPMixedState
CPOnState
CPOffState
-(CPMenu)submenu
nil
if there is no submenu.-(int)tag
-(id)target
-(CPString)title
-(CPString)toolTip
-(CPView)view
Created on Sat Sep 13 14:15:43 PDT 2008