API  1.0.0
CPMenu Class Reference

#import <CPMenu.h>

+ Inheritance diagram for CPMenu:

Instance Methods

(void) - addItem:
 
(CPMenuItem- addItemWithTitle:action:keyEquivalent:
 
(BOOL) - autoenablesItems
 
(void) - awakeFromCib
 
(void) - cancelTracking
 
(CPUInteger) - countOfItems
 
(id) - delegate
 
(void) - encodeWithCoder:
 
(CPFont- font
 
(CPMenuItem- highlightedItem
 
(int) - indexOfItem:
 
(int) - indexOfItemWithRepresentedObject:
 
(int) - indexOfItemWithSubmenu:
 
(int) - indexOfItemWithTag:
 
(int) - indexOfItemWithTarget:andAction:
 
(int) - indexOfItemWithTitle:
 
(id) - init
 
(id) - initWithCoder:
 
(id) - initWithTitle:
 
(void) - insertItem:atIndex:
 
(CPMenuItem- insertItemWithTitle:action:keyEquivalent:atIndex:
 
(void) - insertObject:inItemsAtIndex:
 
(BOOL) - isTornOff
 
(CPArray) - itemArray
 
(CPMenuItem- itemAtIndex:
 
(void) - itemChanged:
 
(CPArray) - itemsAtIndexes:
 
(CPMenuItem- itemWithTag:
 
(CPMenuItem- itemWithTitle:
 
(float) - menuBarHeight
 
(float) - minimumWidth
 
(unsigned) - numberOfItems
 
(CPMenuItem- objectInItemsAtIndex:
 
(void) - performActionForItemAtIndex:
 
(BOOL) - performKeyEquivalent:
 
(void) - popUpMenuPositioningItem:atLocation:inView:callback:
 
(void) - removeAllItems
 
(void) - removeItem:
 
(void) - removeItemAtIndex:
 
(void) - removeObjectFromItemsAtIndex:
 
(void) - setAutoenablesItems:
 
(void) - setDelegate:
 
(void) - setFont:
 
(void) - setMinimumWidth:
 
(void) - setShowsStateColumn:
 
(void) - setSubmenu:forItem:
 
(void) - setSupermenu:
 
(void) - setTitle:
 
(BOOL) - showsStateColumn
 
(void) - submenuAction:
 
(CPMenu- supermenu
 
(CPString- title
 
(void) - update
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(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) - mutableCopy
 
(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

(void) + initialize
 
(CPDictionary+ menuBarAttributes
 
(CPImage+ menuBarIconImage
 
(CPString+ menuBarTitle
 
(BOOL) + menuBarVisible
 
(void) + popUpContextMenu:withEvent:forView:
 
(void) + popUpContextMenu:withEvent:forView:withFont:
 
(void) + setMenuBarAttributes:
 
(void) + setMenuBarIconImage:
 
(void) + setMenuBarTitle:
 
(void) + setMenuBarVisible:
 
(Function) + trackingCallbackWithCallback:
 
- 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:
 
(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

Menus provide the user with a list of actions and/or submenus. Submenus themselves are full fledged menus and so a hierarchical structure appears.

Definition at line 2 of file CPMenu.h.

Method Documentation

◆ addItem:()

- (void) addItem: (CPMenuItem aMenuItem
implementation

Adds a menu item at the end of the menu.

Parameters
aMenuItemthe menu item to add

Definition at line 312 of file CPMenu.j.

◆ addItemWithTitle:action:keyEquivalent:()

- (CPMenuItem) addItemWithTitle: (CPString aTitle
action: (SEL)  anAction
keyEquivalent: (CPString aKeyEquivalent 
implementation

Creates and adds a menu item with the specified attributes at the end of the menu.

Parameters
aTitlethe title of the new menu item
anActionthe action initiated when the user selects the item
aKeyEquivalentthe keyboard shortcut for the menu item
Returns
the new menu item

Definition at line 325 of file CPMenu.j.

◆ autoenablesItems()

- (BOOL) autoenablesItems
implementation

Returns YES if the menu auto enables items.

Definition at line 616 of file CPMenu.j.

◆ awakeFromCib()

- (void) awakeFromCib
implementation

Reimplemented from CPObject.

Definition at line 1118 of file CPMenu.j.

◆ cancelTracking()

- (void) cancelTracking
implementation

Cancels tracking.

Definition at line 988 of file CPMenu.j.

◆ countOfItems()

- (CPUInteger) countOfItems
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1177 of file CPMenu.j.

◆ delegate()

- (id) delegate
implementation

Definition at line 965 of file CPMenu.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Encodes the data of the menu into a coder

Parameters
aCoderthe coder to which the data will be written

Provided by category CPMenu(CPCoding).

Definition at line 1271 of file CPMenu.j.

◆ font()

- (CPFont) font
implementation

Definition at line 1025 of file CPMenu.j.

◆ highlightedItem()

- (CPMenuItem) highlightedItem
implementation

Returns the currently highlighted menu item.

Returns
the highlighted menu item or nil if no item is currently highlighted

Definition at line 935 of file CPMenu.j.

◆ indexOfItem:()

- (int) indexOfItem: (CPMenuItem aMenuItem
implementation

Returns the index of the specified menu item

Parameters
aMenuItemthe item to find the index for
Returns
the item index or CPNotFound

Definition at line 455 of file CPMenu.j.

◆ indexOfItemWithRepresentedObject:()

- (int) indexOfItemWithRepresentedObject: (id)  anObject
implementation

Returns the index of the menu item with the specified represented object.

Parameters
anObjectthe represented object of the desired item
Returns
the index of the item or CPNotFound

Definition at line 524 of file CPMenu.j.

◆ indexOfItemWithSubmenu:()

- (int) indexOfItemWithSubmenu: (CPMenu aMenu
implementation

Returns the index of the item with the specified submenu.

Parameters
thesubmenu of the desired menu item
Returns
the index of the item or CPNotFound

Definition at line 541 of file CPMenu.j.

◆ indexOfItemWithTag:()

- (int) indexOfItemWithTag: (int)  aTag
implementation

Returns the index of the item with the specified tag

Parameters
aTagthe desired tag to match
Returns
the index of the item or CPNotFound

Definition at line 485 of file CPMenu.j.

◆ indexOfItemWithTarget:andAction:()

- (int) indexOfItemWithTarget: (id)  aTarget
andAction: (SEL)  anAction 
implementation

Returns the index of the item with the specified target and action.

Parameters
aTargetthe target of the desired menu item
anActionthe action of the desired menu item
Returns
the index of the item or CPNotFound

Definition at line 503 of file CPMenu.j.

◆ indexOfItemWithTitle:()

- (int) indexOfItemWithTitle: (CPString aTitle
implementation

Returns the index of the item with the specified title.

Parameters
aTitlethe desired title to match
Returns
the index of the item or CPNotFound

Definition at line 468 of file CPMenu.j.

◆ init()

- (id) init
implementation

Initializes the receiver

Returns
the initialized receiver

Reimplemented from CPObject.

Definition at line 275 of file CPMenu.j.

◆ initialize()

+ (void) initialize
implementation

Reimplemented from CPObject.

Definition at line 82 of file CPMenu.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the menu with data from the specified coder.

Parameters
aCoderthe coder from which to read the data
Returns
the initialized menu

Provided by category CPMenu(CPCoding).

Definition at line 1246 of file CPMenu.j.

◆ initWithTitle:()

- (id) initWithTitle: (CPString aTitle
implementation

Initializes the menu with a specified title.

Parameters
aTilethe menu title
Returns
the initialized menu

Definition at line 257 of file CPMenu.j.

◆ insertItem:atIndex:()

- (void) insertItem: (CPMenuItem aMenuItem
atIndex: (CPUInteger)  anIndex 
implementation

Inserts a menu item at the specified index.

Parameters
aMenuItemthe item to insert
anIndexthe index in the menu to insert the item.

Definition at line 286 of file CPMenu.j.

◆ insertItemWithTitle:action:keyEquivalent:atIndex:()

- (CPMenuItem) insertItemWithTitle: (CPString aTitle
action: (SEL)  anAction
keyEquivalent: (CPString aKeyEquivalent
atIndex: (CPUInteger)  anIndex 
implementation

Creates and inserts a new menu item with the specified attributes.

Parameters
aTitlethe title of the menu item
anActionthe action initiated when the user selects the item
aKeyEquivalentthe keyboard shortcut for the item
anIndexthe index location in the menu for the new item
Returns
the new menu item

Definition at line 299 of file CPMenu.j.

◆ insertObject:inItemsAtIndex:()

- (void) insertObject: (CPMenuItem aMenuItem
inItemsAtIndex: (CPUInteger)  anIndex 
implementation

Provided by category CPMenu(CPKeyValueObserving).

Definition at line 1196 of file CPMenu.j.

◆ isTornOff()

- (BOOL) isTornOff
implementation

If there are two instances of this menu visible, return NO. Otherwise, return YES if we are a detached menu and visible.

Definition at line 598 of file CPMenu.j.

◆ itemArray()

- (CPArray) itemArray
implementation

Returns the array of menu items backing this menu

Definition at line 444 of file CPMenu.j.

◆ itemAtIndex:()

- (CPMenuItem) itemAtIndex: (int)  anIndex
implementation

Returns the menu item at the specified index

Parameters
anIndexthe index of the requested item

Definition at line 428 of file CPMenu.j.

◆ itemChanged:()

- (void) itemChanged: (CPMenuItem aMenuItem
implementation

Called when a menu item has visually changed.

Parameters
aMenuItemthe item that changed

Definition at line 375 of file CPMenu.j.

◆ itemsAtIndexes:()

- (CPArray) itemsAtIndexes: (CPIndexSet indexes
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1187 of file CPMenu.j.

◆ itemWithTag:()

- (CPMenuItem) itemWithTag: (int)  aTag
implementation

Returns the menu item with the specified tag

Parameters
thetag of the desired menu item
Returns
the menu item or nil if a match was not found

Definition at line 399 of file CPMenu.j.

◆ itemWithTitle:()

- (CPMenuItem) itemWithTitle: (CPString aTitle
implementation

Returns the menu item with the specified title.

Parameters
aTitlethe title of the menu item
Returns
the menu item or nil if a match was not found

Definition at line 414 of file CPMenu.j.

◆ menuBarAttributes()

+ (CPDictionary) menuBarAttributes
implementation

Definition at line 227 of file CPMenu.j.

◆ menuBarHeight()

- (float) menuBarHeight
implementation

Definition at line 238 of file CPMenu.j.

◆ menuBarIconImage()

+ (CPImage) menuBarIconImage
implementation

Definition at line 153 of file CPMenu.j.

◆ menuBarTitle()

+ (CPString) menuBarTitle
implementation

Definition at line 142 of file CPMenu.j.

◆ menuBarVisible()

+ (BOOL) menuBarVisible
implementation

Definition at line 90 of file CPMenu.j.

◆ minimumWidth()

- (float) minimumWidth
implementation

Definition at line 714 of file CPMenu.j.

◆ numberOfItems()

- (unsigned) numberOfItems
implementation

Returns the number of menu items in the menu

Definition at line 436 of file CPMenu.j.

◆ objectInItemsAtIndex:()

- (CPMenuItem) objectInItemsAtIndex: (CPUInteger)  anIndex
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1182 of file CPMenu.j.

◆ performActionForItemAtIndex:()

- (void) performActionForItemAtIndex: (CPUInteger)  anIndex
implementation

Sends the action of the menu item at the specified index.

Parameters
anIndexthe index of the item

Definition at line 1074 of file CPMenu.j.

◆ performKeyEquivalent:()

- (BOOL) performKeyEquivalent: (CPEvent anEvent
implementation

Initiates the action of the menu item that has a keyboard shortcut equivalent to anEvent

Parameters
anEventthe keyboard event
Returns
YES if it was handled.

Definition at line 1036 of file CPMenu.j.

◆ popUpContextMenu:withEvent:forView:()

+ (void) popUpContextMenu: (CPMenu aMenu
withEvent: (CPEvent anEvent
forView: (CPView aView 
implementation

Definition at line 857 of file CPMenu.j.

◆ popUpContextMenu:withEvent:forView:withFont:()

+ (void) popUpContextMenu: (CPMenu aMenu
withEvent: (CPEvent anEvent
forView: (CPView aView
withFont: (CPFont aFont 
implementation

Definition at line 862 of file CPMenu.j.

◆ popUpMenuPositioningItem:atLocation:inView:callback:()

- (void) popUpMenuPositioningItem: (CPMenuItem anItem
atLocation: (CGPoint)  aLocation
inView: (CPView aView
callback: (Function)  aCallback 
implementation

Definition at line 748 of file CPMenu.j.

◆ removeAllItems()

- (void) removeAllItems
implementation

Removes all the menu items in the receiver. This method is more efficient than removing menu items individually.

Unlike the other remove methods, this method does not post CPMenuDidChangeItemNotification notifications.

Definition at line 354 of file CPMenu.j.

◆ removeItem:()

- (void) removeItem: (CPMenuItem aMenuItem
implementation

Removes the specified item from the menu

Parameters
aMenuItemthe item to remove

Definition at line 334 of file CPMenu.j.

◆ removeItemAtIndex:()

- (void) removeItemAtIndex: (CPUInteger)  anIndex
implementation

Removes the item at the specified index from the menu

Parameters
anIndexthe index of the item to remove

Definition at line 343 of file CPMenu.j.

◆ removeObjectFromItemsAtIndex:()

- (void) removeObjectFromItemsAtIndex: (CPUInteger)  anIndex
implementation

Provided by category CPMenu(CPKeyValueObserving).

Definition at line 1216 of file CPMenu.j.

◆ setAutoenablesItems:()

- (void) setAutoenablesItems: (BOOL)  aFlag
implementation

Sets whether the menu automatically enables menu items.

Parameters
aFlagYES sets the menu to automatically enable items.

Definition at line 608 of file CPMenu.j.

◆ setDelegate:()

- (void) setDelegate: (id <CPMenuDelegate>)  aDelegate
implementation

Definition at line 950 of file CPMenu.j.

◆ setFont:()

- (void) setFont: (CPFont aFont
implementation

Definition at line 1020 of file CPMenu.j.

◆ setMenuBarAttributes:()

+ (void) setMenuBarAttributes: (CPDictionary attributes
implementation

Definition at line 166 of file CPMenu.j.

◆ setMenuBarIconImage:()

+ (void) setMenuBarIconImage: (CPImage anImage
implementation

Definition at line 147 of file CPMenu.j.

◆ setMenuBarTitle:()

+ (void) setMenuBarTitle: (CPString aTitle
implementation

Definition at line 136 of file CPMenu.j.

◆ setMenuBarVisible:()

+ (void) setMenuBarVisible: (BOOL)  menuBarShouldBeVisible
implementation

Definition at line 95 of file CPMenu.j.

◆ setMinimumWidth:()

- (void) setMinimumWidth: (float)  aMinimumWidth
implementation

Definition at line 709 of file CPMenu.j.

◆ setShowsStateColumn:()

- (void) setShowsStateColumn: (BOOL)  shouldShowStateColumn
implementation

Sets whether to show the state column

Parameters
shouldShowStateColumnYES shows the state column

Definition at line 917 of file CPMenu.j.

◆ setSubmenu:forItem:()

- (void) setSubmenu: (CPMenu aMenu
forItem: (CPMenuItem aMenuItem 
implementation

Sets a submenu for a menu item

Parameters
aMenuthe submenu
aMenuItemthe menu item to set the submenu on

Definition at line 559 of file CPMenu.j.

◆ setSupermenu:()

- (void) setSupermenu: (CPMenu aMenu
implementation

Sets the super menu.

Parameters
aMenuthe new super menu

Definition at line 589 of file CPMenu.j.

◆ setTitle:()

- (void) setTitle: (CPString aTitle
implementation

Sets the menu title.

Parameters
thenew title

Definition at line 696 of file CPMenu.j.

◆ showsStateColumn()

- (BOOL) showsStateColumn
implementation

Returns YES if the menu shows the state column

Definition at line 925 of file CPMenu.j.

◆ submenuAction:()

- (void) submenuAction: (id)  aSender
implementation

The action method of menu items that open submenus. The default implementation does nothing, but it may be subclassed to provide different behavior.

Parameters
aSenderthe object that sent the message

Definition at line 573 of file CPMenu.j.

◆ supermenu()

- (CPMenu) supermenu
implementation

Returns the super menu or nil if there is none.

Definition at line 580 of file CPMenu.j.

◆ title()

- (CPString) title
implementation

Returns the menu title

Definition at line 704 of file CPMenu.j.

◆ trackingCallbackWithCallback:()

+ (Function) trackingCallbackWithCallback: (Function)  aCallback
implementation

Definition at line 841 of file CPMenu.j.

◆ update()

- (void) update
implementation

Enables or disables the receiver’s menu items. If the item has no target, an action binding is checked. If the target does not implement the menu item's action method or the binding's selector, the item is disabled. If the target responds to selector validateMenuItem: or validateUserInterfaceItem: (in that order) the return value is used.

Definition at line 627 of file CPMenu.j.


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