API  0.9.7
 All Classes Files Functions Variables Macros Groups Pages
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
 

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:
 

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

- (void) addItem: (CPMenuItem aMenuItem
implementation

Adds a menu item at the end of the menu.

Parameters
aMenuItemthe menu item to add

Definition at line 301 of file CPMenu.j.

- (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 314 of file CPMenu.j.

- (BOOL) autoenablesItems
implementation

Returns YES if the menu auto enables items.

Definition at line 605 of file CPMenu.j.

- (void) awakeFromCib
implementation

Definition at line 1102 of file CPMenu.j.

- (void) cancelTracking
implementation

Cancels tracking.

Definition at line 972 of file CPMenu.j.

- (CPUInteger) countOfItems
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1131 of file CPMenu.j.

- (id) delegate
implementation

Definition at line 943 of file CPMenu.j.

- (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 1225 of file CPMenu.j.

- (CPFont) font
implementation

Definition at line 1009 of file CPMenu.j.

- (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 923 of file CPMenu.j.

- (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 444 of file CPMenu.j.

- (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 513 of file CPMenu.j.

- (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 530 of file CPMenu.j.

- (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 474 of file CPMenu.j.

- (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 492 of file CPMenu.j.

- (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 457 of file CPMenu.j.

- (id) init
implementation

Definition at line 264 of file CPMenu.j.

+ (void) initialize
implementation

Definition at line 71 of file CPMenu.j.

- (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 1200 of file CPMenu.j.

- (id) initWithTitle: (CPString aTitle
implementation

Initializes the menu with a specified title.

Parameters
aTilethe menu title
Returns
the initialized menu

Definition at line 246 of file CPMenu.j.

- (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 275 of file CPMenu.j.

- (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 288 of file CPMenu.j.

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

Provided by category CPMenu(CPKeyValueObserving).

Definition at line 1150 of file CPMenu.j.

- (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 587 of file CPMenu.j.

- (CPArray) itemArray
implementation

Returns the array of menu items backing this menu

Definition at line 433 of file CPMenu.j.

- (CPMenuItem) itemAtIndex: (int)  anIndex
implementation

Returns the menu item at the specified index

Parameters
anIndexthe index of the requested item

Definition at line 417 of file CPMenu.j.

- (void) itemChanged: (CPMenuItem aMenuItem
implementation

Called when a menu item has visually changed.

Parameters
aMenuItemthe item that changed

Definition at line 364 of file CPMenu.j.

- (CPArray) itemsAtIndexes: (CPIndexSet indexes
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1141 of file CPMenu.j.

- (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 388 of file CPMenu.j.

- (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 403 of file CPMenu.j.

+ (CPDictionary) menuBarAttributes
implementation

Definition at line 216 of file CPMenu.j.

- (float) menuBarHeight
implementation

Definition at line 227 of file CPMenu.j.

+ (CPImage) menuBarIconImage
implementation

Definition at line 142 of file CPMenu.j.

+ (CPString) menuBarTitle
implementation

Definition at line 131 of file CPMenu.j.

+ (BOOL) menuBarVisible
implementation

Definition at line 79 of file CPMenu.j.

- (float) minimumWidth
implementation

Definition at line 702 of file CPMenu.j.

- (unsigned) numberOfItems
implementation

Returns the number of menu items in the menu

Definition at line 425 of file CPMenu.j.

- (CPMenuItem) objectInItemsAtIndex: (CPUInteger)  anIndex
implementation

Provided by category CPMenu(CPKeyValueCoding).

Definition at line 1136 of file CPMenu.j.

- (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 1058 of file CPMenu.j.

- (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 1020 of file CPMenu.j.

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

Definition at line 845 of file CPMenu.j.

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

Definition at line 850 of file CPMenu.j.

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

Definition at line 736 of file CPMenu.j.

- (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 343 of file CPMenu.j.

- (void) removeItem: (CPMenuItem aMenuItem
implementation

Removes the specified item from the menu

Parameters
aMenuItemthe item to remove

Definition at line 323 of file CPMenu.j.

- (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 332 of file CPMenu.j.

- (void) removeObjectFromItemsAtIndex: (CPUInteger)  anIndex
implementation

Provided by category CPMenu(CPKeyValueObserving).

Definition at line 1170 of file CPMenu.j.

- (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 597 of file CPMenu.j.

- (void) setDelegate: (id)  aDelegate
implementation

Definition at line 938 of file CPMenu.j.

- (void) setFont: (CPFont aFont
implementation

Definition at line 1004 of file CPMenu.j.

+ (void) setMenuBarAttributes: (CPDictionary attributes
implementation

Definition at line 155 of file CPMenu.j.

+ (void) setMenuBarIconImage: (CPImage anImage
implementation

Definition at line 136 of file CPMenu.j.

+ (void) setMenuBarTitle: (CPString aTitle
implementation

Definition at line 125 of file CPMenu.j.

+ (void) setMenuBarVisible: (BOOL)  menuBarShouldBeVisible
implementation

Definition at line 84 of file CPMenu.j.

- (void) setMinimumWidth: (float)  aMinimumWidth
implementation

Definition at line 697 of file CPMenu.j.

- (void) setShowsStateColumn: (BOOL)  shouldShowStateColumn
implementation

Sets whether to show the state column

Parameters
shouldShowStateColumnYES shows the state column

Definition at line 905 of file CPMenu.j.

- (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 548 of file CPMenu.j.

- (void) setSupermenu: (CPMenu aMenu
implementation

Sets the super menu.

Parameters
aMenuthe new super menu

Definition at line 578 of file CPMenu.j.

- (void) setTitle: (CPString aTitle
implementation

Sets the menu title.

Parameters
thenew title

Definition at line 684 of file CPMenu.j.

- (BOOL) showsStateColumn
implementation

Returns YES if the menu shows the state column

Definition at line 913 of file CPMenu.j.

- (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 562 of file CPMenu.j.

- (CPMenu) supermenu
implementation

Returns the super menu or nil if there is none.

Definition at line 569 of file CPMenu.j.

- (CPString) title
implementation

Returns the menu title

Definition at line 692 of file CPMenu.j.

+ (Function) trackingCallbackWithCallback: (Function)  aCallback
implementation

Definition at line 829 of file CPMenu.j.

- (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 616 of file CPMenu.j.


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