API  1.0.0
CPMenuItem Class Reference

#import <CPMenuItem.h>

+ Inheritance diagram for CPMenuItem:

Instance Methods

(SEL) - action
 
(CPImage- alternateImage
 
(id) - copy
 
(CPString- description
 
(void) - encodeWithCoder:
 
(CPFont- font
 
(BOOL) - hasSubmenu
 
(CPImage- image
 
(unsigned) - indentationLevel
 
(id) - init
 
(id) - initWithCoder:
 
(id) - initWithTitle:action:keyEquivalent:
 
(BOOL) - isAlternate
 
(BOOL) - isEnabled
 
(BOOL) - isHidden
 
(BOOL) - isHiddenOrHasHiddenAncestor
 
(BOOL) - isHighlighted
 
(BOOL) - isSeparatorItem
 
(CPString- keyEquivalent
 
(unsigned) - keyEquivalentModifierMask
 
(CPString- keyEquivalentStringRepresentation
 
(CPMenu- menu
 
(CPImage- mixedStateImage
 
(CPString- mnemonic
 
(unsigned) - mnemonicLocation
 
(id) - mutableCopy
 
(CPImage- offStateImage
 
(CPImage- onStateImage
 
(id) - representedObject
 
(void) - setAction:
 
(void) - setAlternate:
 
(void) - setAlternateImage:
 
(void) - setEnabled:
 
(void) - setFont:
 
(void) - setHidden:
 
(void) - setImage:
 
(void) - setIndentationLevel:
 
(void) - setKeyEquivalent:
 
(void) - setKeyEquivalentModifierMask:
 
(void) - setMenu:
 
(void) - setMixedStateImage:
 
(void) - setMnemonicLocation:
 
(void) - setOffStateImage:
 
(void) - setOnStateImage:
 
(void) - setRepresentedObject:
 
(void) - setState:
 
(void) - setSubmenu:
 
(void) - setTag:
 
(void) - setTarget:
 
(void) - setTextColor:
 
(void) - setTitle:
 
(void) - setTitleWithMnemonicLocation:
 
(void) - setToolTip:
 
(void) - setView:
 
(int) - state
 
(CPMenu- submenu
 
(int) - tag
 
(id) - target
 
(CPString- title
 
(CPString- toolTip
 
(CPView- view
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(void) - dealloc
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(CPMenuItem+ separatorItem
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

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'.

Definition at line 2 of file CPMenuItem.h.

Method Documentation

◆ action()

- (SEL) action
implementation

Returns the item's action.

Definition at line 246 of file CPMenuItem.j.

◆ alternateImage()

- (CPImage) alternateImage
implementation

Returns the menu item's alternate image

Definition at line 408 of file CPMenuItem.j.

◆ copy()

- (id) copy
implementation

Returns a copy of the item. The copy does not belong If the item has a submenu, it is NOT copied.

Reimplemented from CPObject.

Definition at line 825 of file CPMenuItem.j.

◆ description()

- (CPString) description
implementation

Returns a human readable string describing the receiver

Reimplemented from CPObject.

Definition at line 884 of file CPMenuItem.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Writes the menu item out to a coder.

Parameters
aCoderthe coder to write the menu item out to

Provided by category CPMenuItem(CPCoding).

Definition at line 979 of file CPMenuItem.j.

◆ font()

- (CPFont) font
implementation

Returns the menu item's font

Definition at line 305 of file CPMenuItem.j.

◆ hasSubmenu()

- (BOOL) hasSubmenu
implementation

Returns YES if the menu item has a submenu.

Definition at line 526 of file CPMenuItem.j.

◆ image()

- (CPImage) image
implementation

Returns the menu item's image

Definition at line 391 of file CPMenuItem.j.

◆ indentationLevel()

- (unsigned) indentationLevel
implementation

Returns the menu item's indentation level. This is a value between 0 and 15 (inclusive).

Definition at line 742 of file CPMenuItem.j.

◆ init()

- (id) init
implementation

Initializes the receiver

Returns
the initialized receiver

Reimplemented from CPObject.

Definition at line 109 of file CPMenuItem.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the menu item from a coder.

Parameters
aCoderthe coder from which to initialize
Returns
the initialized menu item

Provided by category CPMenuItem(CPCoding).

Definition at line 926 of file CPMenuItem.j.

◆ initWithTitle:action:keyEquivalent:()

- (id) initWithTitle: (CPString aTitle
action: (SEL)  anAction
keyEquivalent: (CPString aKeyEquivalent 
implementation

Initializes the menu item with a title, action, and keyboard equivalent.

Parameters
aTitlethe menu item's title
anActionthe action that gets triggered when the item is selected
aKeyEquivalentthe keyboard shortcut for the item
Returns
the initialized menu item

Definition at line 121 of file CPMenuItem.j.

◆ isAlternate()

- (BOOL) isAlternate
implementation

Returns YES if the menu item is an alternate for the previous item.

Definition at line 719 of file CPMenuItem.j.

◆ isEnabled()

- (BOOL) isEnabled
implementation

Returns YES if the item is enabled.

Definition at line 172 of file CPMenuItem.j.

◆ isHidden()

- (BOOL) isHidden
implementation

Returns YES if the item is hidden.

Definition at line 195 of file CPMenuItem.j.

◆ isHiddenOrHasHiddenAncestor()

- (BOOL) isHiddenOrHasHiddenAncestor
implementation

Returns YES if the item is hidden or if one of it's supermenus is hidden.

Definition at line 203 of file CPMenuItem.j.

◆ isHighlighted()

- (BOOL) isHighlighted
implementation

Returns YES if the menu item is highlighted.

Definition at line 815 of file CPMenuItem.j.

◆ isSeparatorItem()

- (BOOL) isSeparatorItem
implementation

Returns YES if the menu item is a separator.

Definition at line 548 of file CPMenuItem.j.

◆ keyEquivalent()

- (CPString) keyEquivalent
implementation

Returns the keyboard shortcut for this menu item

Definition at line 585 of file CPMenuItem.j.

◆ keyEquivalentModifierMask()

- (unsigned) keyEquivalentModifierMask
implementation

Returns the item's keyboard shortcut modifier mask. Can be a combination of:

CPShiftKeyMask
CPAlternateKeyMask
CPCommandKeyMask
CPControlKeyMask

Definition at line 615 of file CPMenuItem.j.

◆ keyEquivalentStringRepresentation()

- (CPString) keyEquivalentStringRepresentation
implementation

Definition at line 620 of file CPMenuItem.j.

◆ menu()

- (CPMenu) menu
implementation

Returns the container menu of this item

Definition at line 566 of file CPMenuItem.j.

◆ mixedStateImage()

- (CPImage) mixedStateImage
implementation

Returns the image shown when the menu item is in the 'mixed' state.

Definition at line 473 of file CPMenuItem.j.

◆ mnemonic()

- (CPString) mnemonic
implementation

Returns the menu items mnemonic character

Definition at line 700 of file CPMenuItem.j.

◆ mnemonicLocation()

- (unsigned) mnemonicLocation
implementation

Returns the index of the mnemonic character in the title.

Definition at line 675 of file CPMenuItem.j.

◆ mutableCopy()

- (id) mutableCopy
implementation

Creates a deep mutable copy of the receiver.

Returns
the mutable copy of the receiver

Reimplemented from CPObject.

Definition at line 856 of file CPMenuItem.j.

◆ offStateImage()

- (CPImage) offStateImage
implementation

Returns the image shown when the menu item is in the 'off' state.

Definition at line 451 of file CPMenuItem.j.

◆ onStateImage()

- (CPImage) onStateImage
implementation

Returns the image shown when the menu item is in the 'on' state.

Definition at line 430 of file CPMenuItem.j.

◆ representedObject()

- (id) representedObject
implementation

Returns the item's represented object.

Definition at line 779 of file CPMenuItem.j.

◆ separatorItem()

+ (CPMenuItem) separatorItem
implementation

Returns a new menu item separator.

Definition at line 536 of file CPMenuItem.j.

◆ setAction:()

- (void) setAction: (SEL)  anAction
implementation

Sets the action that gets sent to the item's target when triggered.

Parameters
anActionthe action to send

Definition at line 238 of file CPMenuItem.j.

◆ setAlternate:()

- (void) setAlternate: (BOOL)  isAlternate
implementation

Sets whether this item is an alternate for the previous menu item.

Parameters
isAlternateYES denotes that this menu item is an alternate

Definition at line 711 of file CPMenuItem.j.

◆ setAlternateImage:()

- (void) setAlternateImage: (CPImage anImage
implementation

Sets the menu item's alternate image

Parameters
anImagethe menu item's alternate image

Definition at line 400 of file CPMenuItem.j.

◆ setEnabled:()

- (void) setEnabled: (BOOL)  isEnabled
implementation

Sets whether the menu item is enabled or not

Parameters
isEnabledYES enables the item. NO disables it.

Definition at line 155 of file CPMenuItem.j.

◆ setFont:()

- (void) setFont: (CPFont aFont
implementation

Sets the font for the text of this menu item

Parameters
aFontthe font for the menu item

Definition at line 290 of file CPMenuItem.j.

◆ setHidden:()

- (void) setHidden: (BOOL)  isHidden
implementation

Sets whether the item should be hidden. A hidden item can not be triggered by keyboard shortcuts.

Parameters
isHiddenYES hides the item. NO reveals it.

Definition at line 182 of file CPMenuItem.j.

◆ setImage:()

- (void) setImage: (CPImage anImage
implementation

Sets the menu item's image

Parameters
anImagethe menu item's image

Definition at line 376 of file CPMenuItem.j.

◆ setIndentationLevel:()

- (void) setIndentationLevel: (unsigned)  aLevel
implementation

Sets the indentation level of the menu item. Must be a value between 0 and 15 (inclusive).

Parameters
aLevelthe item's new indentation level
Exceptions
CPInvalidArgumentExceptionif aLevel is less than 0

Definition at line 731 of file CPMenuItem.j.

◆ setKeyEquivalent:()

- (void) setKeyEquivalent: (CPString aString
implementation

Sets the keyboard shortcut for this menu item

Parameters
aStringthe keyboard shortcut

Definition at line 577 of file CPMenuItem.j.

◆ setKeyEquivalentModifierMask:()

- (void) setKeyEquivalentModifierMask: (unsigned)  aMask
implementation

Sets the modifier mask used for the item's keyboard shortcut. Can be a combination of:

CPShiftKeyMask
CPAlternateKeyMask
CPCommandKeyMask
CPControlKeyMask

Definition at line 600 of file CPMenuItem.j.

◆ setMenu:()

- (void) setMenu: (CPMenu aMenu
implementation

Set the container menu of this item.

Parameters
aMenuthe item's container menu

Definition at line 558 of file CPMenuItem.j.

◆ setMixedStateImage:()

- (void) setMixedStateImage: (CPImage anImage
implementation

Sets the image that is shown when the menu item is in the 'mixed' state.

Parameters
anImagethe image to show

Definition at line 460 of file CPMenuItem.j.

◆ setMnemonicLocation:()

- (void) setMnemonicLocation: (unsigned)  aLocation
implementation

Sets the index of the mnemonic character in the title. The character will be underlined and is used as a shortcut for navigation.

Parameters
aLocationthe index of the character in the title

Definition at line 667 of file CPMenuItem.j.

◆ setOffStateImage:()

- (void) setOffStateImage: (CPImage anImage
implementation

Sets the image that is shown when the menu item is in the 'off' state.

Parameters
anImagethe image to show

Definition at line 439 of file CPMenuItem.j.

◆ setOnStateImage:()

- (void) setOnStateImage: (CPImage anImage
implementation

Sets the image that is shown when the menu item is in the 'on' state.

Parameters
anImagethe image to show

Definition at line 418 of file CPMenuItem.j.

◆ setRepresentedObject:()

- (void) setRepresentedObject: (id)  anObject
implementation

Sets the menu item's represented object. This is a kind of tag for the developer. Not a UI feature.

Parameters
anObjectthe represented object

Definition at line 771 of file CPMenuItem.j.

◆ setState:()

- (void) setState: (int)  aState
implementation

Sets the state of the menu item. Possible states are:

CPMixedState
CPOnState
CPOffState

Definition at line 346 of file CPMenuItem.j.

◆ setSubmenu:()

- (void) setSubmenu: (CPMenu aMenu
implementation

Sets the submenu for this item

Parameters
aMenuthe submenu

Definition at line 483 of file CPMenuItem.j.

◆ setTag:()

- (void) setTag: (int)  aTag
implementation

Sets the menu item's tag

Parameters
aTagthe tag for the item

Definition at line 325 of file CPMenuItem.j.

◆ setTarget:()

- (void) setTarget: (id)  aTarget
implementation

Sets the menu item's action target.

Parameters
aTargetthe target for the action

Definition at line 221 of file CPMenuItem.j.

◆ setTextColor:()

- (void) setTextColor: (CPString aColor
implementation

Set's the item's text color

Definition at line 281 of file CPMenuItem.j.

◆ setTitle:()

- (void) setTitle: (CPString aTitle
implementation

Sets the item's title.

Parameters
aTitlethe item's new title

Definition at line 256 of file CPMenuItem.j.

◆ setTitleWithMnemonicLocation:()

- (void) setTitleWithMnemonicLocation: (CPString aTitle
implementation

Sets the title of the menu item and the mnemonic character. The mnemonic character should be preceded by an '&'.

Parameters
aTitlethe title string with a denoted mnemonic

Definition at line 684 of file CPMenuItem.j.

◆ setToolTip:()

- (void) setToolTip: (CPString aToolTip
implementation

Sets the tooltip for the menu item.

Parameters
aToolTipthe tool tip for the item

Definition at line 752 of file CPMenuItem.j.

◆ setView:()

- (void) setView: (CPView aView
implementation

Sets the view for the menu item

Parameters
aViewthe menu's item's view

Definition at line 790 of file CPMenuItem.j.

◆ state()

- (int) state
implementation

Returns the menu item's current state. Possible states are:

CPMixedState
CPOnState
CPOffState

Definition at line 366 of file CPMenuItem.j.

◆ submenu()

- (CPMenu) submenu
implementation

Returns the submenu of the item. nil if there is no submenu.

Definition at line 518 of file CPMenuItem.j.

◆ tag()

- (int) tag
implementation

Returns the item's tag

Definition at line 333 of file CPMenuItem.j.

◆ target()

- (id) target
implementation

Returns the item's action target

Definition at line 229 of file CPMenuItem.j.

◆ title()

- (CPString) title
implementation

Returns the menu item's title.

Definition at line 273 of file CPMenuItem.j.

◆ toolTip()

- (CPString) toolTip
implementation

Returns the item's tooltip

Definition at line 760 of file CPMenuItem.j.

◆ view()

- (CPView) view
implementation

Returns the menu item's view

Definition at line 805 of file CPMenuItem.j.


The documentation for this class was generated from the following files: