![]() |
API 0.9.5
|
#import <CPMenuItem.h>
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.
- (SEL) action |
Returns the item's action.
Definition at line 231 of file CPMenuItem.j.
- (CPImage) alternateImage |
Returns the menu item's alternate image
Definition at line 393 of file CPMenuItem.j.
- (id) copy |
Returns a copy of the item. The copy does not belong If the item has a submenu, it is NOT copied.
Definition at line 810 of file CPMenuItem.j.
- (CPString) description |
Definition at line 869 of file CPMenuItem.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Writes the menu item out to a coder.
aCoder | the coder to write the menu item out to |
Definition at line 965 of file CPMenuItem.j.
- (CPFont) font |
Returns the menu item's font
Definition at line 290 of file CPMenuItem.j.
- (BOOL) hasSubmenu |
Returns YES
if the menu item has a submenu.
Definition at line 511 of file CPMenuItem.j.
- (CPImage) image |
Returns the menu item's image
Definition at line 376 of file CPMenuItem.j.
- (unsigned) indentationLevel |
Returns the menu item's indentation level. This is a value between 0 and 15 (inclusive).
Definition at line 727 of file CPMenuItem.j.
- (id) init |
Definition at line 97 of file CPMenuItem.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Initializes the menu item from a coder.
aCoder | the coder from which to initialize |
Definition at line 911 of file CPMenuItem.j.
- (id) initWithTitle: | (CPString) | aTitle | |
action: | (SEL) | anAction | |
keyEquivalent: | (CPString) | aKeyEquivalent | |
Initializes the menu item with a title, action, and keyboard equivalent.
aTitle | the menu item's title |
anAction | the action that gets triggered when the item is selected |
aKeyEquivalent | the keyboard shortcut for the item |
Definition at line 109 of file CPMenuItem.j.
- (BOOL) isAlternate |
Returns YES
if the menu item is an alternate for the previous item.
Definition at line 704 of file CPMenuItem.j.
- (BOOL) isEnabled |
Returns YES
if the item is enabled.
Definition at line 157 of file CPMenuItem.j.
- (BOOL) isHidden |
Returns YES
if the item is hidden.
Definition at line 180 of file CPMenuItem.j.
- (BOOL) isHiddenOrHasHiddenAncestor |
Returns YES
if the item is hidden or if one of it's supermenus is hidden.
Definition at line 188 of file CPMenuItem.j.
- (BOOL) isHighlighted |
Returns YES
if the menu item is highlighted.
Definition at line 800 of file CPMenuItem.j.
- (BOOL) isSeparatorItem |
Returns YES
if the menu item is a separator.
Definition at line 533 of file CPMenuItem.j.
- (CPString) keyEquivalent |
Returns the keyboard shortcut for this menu item
Definition at line 570 of file CPMenuItem.j.
- (unsigned) keyEquivalentModifierMask |
Returns the item's keyboard shortcut modifier mask. Can be a combination of:
CPShiftKeyMask CPAlternateKeyMask CPCommandKeyMask CPControlKeyMask
Definition at line 600 of file CPMenuItem.j.
- (CPString) keyEquivalentStringRepresentation |
Definition at line 605 of file CPMenuItem.j.
- (CPMenu) menu |
Returns the container menu of this item
Definition at line 551 of file CPMenuItem.j.
- (CPImage) mixedStateImage |
Returns the image shown when the menu item is in the 'mixed' state.
Definition at line 458 of file CPMenuItem.j.
- (CPString) mnemonic |
Returns the menu items mnemonic character
Definition at line 685 of file CPMenuItem.j.
- (unsigned) mnemonicLocation |
Returns the index of the mnemonic character in the title.
Definition at line 660 of file CPMenuItem.j.
- (id) mutableCopy |
Definition at line 841 of file CPMenuItem.j.
- (CPImage) offStateImage |
Returns the image shown when the menu item is in the 'off' state.
Definition at line 436 of file CPMenuItem.j.
- (CPImage) onStateImage |
Returns the image shown when the menu item is in the 'on' state.
Definition at line 415 of file CPMenuItem.j.
- (id) representedObject |
Returns the item's represented object.
Definition at line 764 of file CPMenuItem.j.
+ (CPMenuItem) separatorItem |
Returns a new menu item separator.
Definition at line 521 of file CPMenuItem.j.
- (void) setAction: | (SEL) | anAction |
Sets the action that gets sent to the item's target when triggered.
anAction | the action to send |
Definition at line 223 of file CPMenuItem.j.
- (void) setAlternate: | (BOOL) | isAlternate |
Sets whether this item is an alternate for the previous menu item.
isAlternate | YES denotes that this menu item is an alternate |
Definition at line 696 of file CPMenuItem.j.
- (void) setAlternateImage: | (CPImage) | anImage |
Sets the menu item's alternate image
anImage | the menu item's alternate image |
Definition at line 385 of file CPMenuItem.j.
- (void) setEnabled: | (BOOL) | isEnabled |
Sets whether the menu item is enabled or not
isEnabled | YES enables the item. NO disables it. |
Definition at line 143 of file CPMenuItem.j.
- (void) setFont: | (CPFont) | aFont |
Sets the font for the text of this menu item
aFont | the font for the menu item |
Definition at line 275 of file CPMenuItem.j.
- (void) setHidden: | (BOOL) | isHidden |
Sets whether the item should be hidden. A hidden item can not be triggered by keyboard shortcuts.
isHidden | YES hides the item. NO reveals it. |
Definition at line 167 of file CPMenuItem.j.
- (void) setImage: | (CPImage) | anImage |
Sets the menu item's image
anImage | the menu item's image |
Definition at line 361 of file CPMenuItem.j.
- (void) setIndentationLevel: | (unsigned) | aLevel |
Sets the indentation level of the menu item. Must be a value between 0 and 15 (inclusive).
aLevel | the item's new indentation level |
CPInvalidArgumentException | if aLevel is less than 0 |
Definition at line 716 of file CPMenuItem.j.
- (void) setKeyEquivalent: | (CPString) | aString |
Sets the keyboard shortcut for this menu item
aString | the keyboard shortcut |
Definition at line 562 of file CPMenuItem.j.
- (void) setKeyEquivalentModifierMask: | (unsigned) | aMask |
Sets the modifier mask used for the item's keyboard shortcut. Can be a combination of:
CPShiftKeyMask CPAlternateKeyMask CPCommandKeyMask CPControlKeyMask
Definition at line 585 of file CPMenuItem.j.
- (void) setMenu: | (CPMenu) | aMenu |
Set the container menu of this item.
aMenu | the item's container menu |
Definition at line 543 of file CPMenuItem.j.
- (void) setMixedStateImage: | (CPImage) | anImage |
Sets the image that is shown when the menu item is in the 'mixed' state.
anImage | the image to show |
Definition at line 445 of file CPMenuItem.j.
- (void) setMnemonicLocation: | (unsigned) | aLocation |
Sets the index of the mnemonic character in the title. The character will be underlined and is used as a shortcut for navigation.
aLocation | the index of the character in the title |
Definition at line 652 of file CPMenuItem.j.
- (void) setOffStateImage: | (CPImage) | anImage |
Sets the image that is shown when the menu item is in the 'off' state.
anImage | the image to show |
Definition at line 424 of file CPMenuItem.j.
- (void) setOnStateImage: | (CPImage) | anImage |
Sets the image that is shown when the menu item is in the 'on' state.
anImage | the image to show |
Definition at line 403 of file CPMenuItem.j.
- (void) setRepresentedObject: | (id) | anObject |
Sets the menu item's represented object. This is a kind of tag for the developer. Not a UI feature.
anObject | the represented object |
Definition at line 756 of file CPMenuItem.j.
- (void) setState: | (int) | aState |
Sets the state of the menu item. Possible states are:
CPMixedState CPOnState CPOffState
Definition at line 331 of file CPMenuItem.j.
- (void) setSubmenu: | (CPMenu) | aMenu |
Sets the submenu for this item
aMenu | the submenu |
Definition at line 468 of file CPMenuItem.j.
- (void) setTag: | (int) | aTag |
Sets the menu item's tag
aTag | the tag for the item |
Definition at line 310 of file CPMenuItem.j.
- (void) setTarget: | (id) | aTarget |
Sets the menu item's action target.
aTarget | the target for the action |
Definition at line 206 of file CPMenuItem.j.
- (void) setTextColor: | (CPString) | aColor |
Set's the item's text color
Definition at line 266 of file CPMenuItem.j.
- (void) setTitle: | (CPString) | aTitle |
Sets the item's title.
aTitle | the item's new title |
Definition at line 241 of file CPMenuItem.j.
- (void) setTitleWithMnemonicLocation: | (CPString) | aTitle |
Sets the title of the menu item and the mnemonic character. The mnemonic character should be preceded by an '&'.
aTitle | the title string with a denoted mnemonic |
Definition at line 669 of file CPMenuItem.j.
- (void) setToolTip: | (CPString) | aToolTip |
Sets the tooltip for the menu item.
aToolTip | the tool tip for the item |
Definition at line 737 of file CPMenuItem.j.
- (void) setView: | (CPView) | aView |
Sets the view for the menu item
aView | the menu's item's view |
Definition at line 775 of file CPMenuItem.j.
- (int) state |
Returns the menu item's current state. Possible states are:
CPMixedState CPOnState CPOffState
Definition at line 351 of file CPMenuItem.j.
- (CPMenu) submenu |
Returns the submenu of the item. nil
if there is no submenu.
Definition at line 503 of file CPMenuItem.j.
- (int) tag |
Returns the item's tag
Definition at line 318 of file CPMenuItem.j.
- (id) target |
Returns the item's action target
Definition at line 214 of file CPMenuItem.j.
- (CPString) title |
Returns the menu item's title.
Definition at line 258 of file CPMenuItem.j.
- (CPString) toolTip |
Returns the item's tooltip
Definition at line 745 of file CPMenuItem.j.
- (CPView) view |
Returns the menu item's view
Definition at line 790 of file CPMenuItem.j.