API 0.9.5
CPMenu Class Reference

#import <CPMenu.h>

Inheritance diagram for CPMenu:

List of all members.

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

Adds a menu item at the end of the menu.

Parameters:
aMenuItemthe menu item to add

Definition at line 295 of file CPMenu.j.

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

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

- (BOOL) autoenablesItems

Returns YES if the menu auto enables items.

Definition at line 594 of file CPMenu.j.

- (void) awakeFromCib

Reimplemented from CPObject.

Definition at line 1041 of file CPMenu.j.

- (void) cancelTracking

Cancels tracking.

Definition at line 910 of file CPMenu.j.

- (CPUInteger) countOfItems

Definition at line 1070 of file CPMenu.j.

- (id) delegate

Definition at line 885 of file CPMenu.j.

- (void) encodeWithCoder: (CPCoder aCoder

Encodes the data of the menu into a coder

Parameters:
aCoderthe coder to which the data will be written

Definition at line 1161 of file CPMenu.j.

- (CPFont) font

Definition at line 947 of file CPMenu.j.

- (CPMenuItem) highlightedItem

Returns the currently highlighted menu item.

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

Definition at line 865 of file CPMenu.j.

- (int) indexOfItem: (CPMenuItem aMenuItem

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

- (int) indexOfItemWithRepresentedObject: (id)  anObject

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

- (int) indexOfItemWithSubmenu: (CPMenu aMenu

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

- (int) indexOfItemWithTag: (int)  aTag

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

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

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

- (int) indexOfItemWithTitle: (CPString aTitle

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

- (id) init

Definition at line 258 of file CPMenu.j.

+ (void) initialize

Definition at line 72 of file CPMenu.j.

- (id) initWithCoder: (CPCoder aCoder

Initializes the menu with data from the specified coder.

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

Definition at line 1136 of file CPMenu.j.

- (id) initWithTitle: (CPString aTitle

Initializes the menu with a specified title.

Parameters:
aTilethe menu title
Returns:
the initialized menu

Definition at line 240 of file CPMenu.j.

- (void) insertItem: (CPMenuItem aMenuItem
atIndex: (unsigned)  anIndex 

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

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

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

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

Definition at line 1089 of file CPMenu.j.

- (BOOL) isTornOff

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

- (CPArray) itemArray

Returns the array of menu items backing this menu

Definition at line 422 of file CPMenu.j.

- (CPMenuItem) itemAtIndex: (int)  anIndex

Returns the menu item at the specified index

Parameters:
anIndexthe index of the requested item

Definition at line 406 of file CPMenu.j.

- (void) itemChanged: (CPMenuItem aMenuItem

Called when a menu item has visually changed.

Parameters:
aMenuItemthe item that changed

Definition at line 358 of file CPMenu.j.

- (CPArray) itemsAtIndexes: (CPIndexSet indexes

Definition at line 1080 of file CPMenu.j.

- (CPMenuItem) itemWithTag: (int)  aTag

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

- (CPMenuItem) itemWithTitle: (CPString aTitle

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

+ (CPDictionary) menuBarAttributes

Definition at line 210 of file CPMenu.j.

- (float) menuBarHeight

Definition at line 221 of file CPMenu.j.

+ (CPImage) menuBarIconImage

Definition at line 143 of file CPMenu.j.

+ (CPString) menuBarTitle

Definition at line 132 of file CPMenu.j.

+ (BOOL) menuBarVisible

Definition at line 80 of file CPMenu.j.

- (float) minimumWidth

Definition at line 653 of file CPMenu.j.

- (unsigned) numberOfItems

Returns the number of menu items in the menu

Definition at line 414 of file CPMenu.j.

- (CPMenuItem) objectInItemsAtIndex: (CPUInteger)  anIndex

Definition at line 1075 of file CPMenu.j.

- (void) performActionForItemAtIndex: (unsigned)  anIndex

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

Parameters:
anIndexthe index of the item

Definition at line 997 of file CPMenu.j.

- (BOOL) performKeyEquivalent: (CPEvent anEvent

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

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

Definition at line 790 of file CPMenu.j.

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

Definition at line 795 of file CPMenu.j.

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

Definition at line 681 of file CPMenu.j.

- (void) removeAllItems

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

- (void) removeItem: (CPMenuItem aMenuItem

Removes the specified item from the menu

Parameters:
aMenuItemthe item to remove

Definition at line 317 of file CPMenu.j.

- (void) removeItemAtIndex: (unsigned)  anIndex

Removes the item at the specified index from the menu

Parameters:
anIndexthe index of the item to remove

Definition at line 326 of file CPMenu.j.

- (void) removeObjectFromItemsAtIndex: (CPUInteger)  anIndex

Definition at line 1108 of file CPMenu.j.

- (void) setAutoenablesItems: (BOOL)  aFlag

Sets whether the menu automatically enables menu items.

Parameters:
aFlagYES sets the menu to automatically enable items.

Definition at line 586 of file CPMenu.j.

- (void) setDelegate: (id)  aDelegate

Definition at line 880 of file CPMenu.j.

- (void) setFont: (CPFont aFont

Definition at line 942 of file CPMenu.j.

+ (void) setMenuBarAttributes: (CPDictionary attributes

Definition at line 149 of file CPMenu.j.

+ (void) setMenuBarIconImage: (CPImage anImage

Definition at line 137 of file CPMenu.j.

+ (void) setMenuBarTitle: (CPString aTitle

Definition at line 126 of file CPMenu.j.

+ (void) setMenuBarVisible: (BOOL)  menuBarShouldBeVisible

Definition at line 85 of file CPMenu.j.

- (void) setMinimumWidth: (float)  aMinimumWidth

Definition at line 648 of file CPMenu.j.

- (void) setShowsStateColumn: (BOOL)  shouldShowStateColumn

Sets whether to show the state column

Parameters:
shouldShowStateColumnYES shows the state column

Definition at line 847 of file CPMenu.j.

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

Sets a submenu for a menu item

Parameters:
aMenuthe submenu
aMenuItemthe menu item to set the submenu on

Definition at line 537 of file CPMenu.j.

- (void) setSupermenu: (CPMenu aMenu

Sets the super menu.

Parameters:
aMenuthe new super menu

Definition at line 567 of file CPMenu.j.

- (void) setTitle: (CPString aTitle

Sets the menu title.

Parameters:
thenew title

Definition at line 635 of file CPMenu.j.

- (BOOL) showsStateColumn

Returns YES if the menu shows the state column

Definition at line 855 of file CPMenu.j.

- (void) submenuAction: (id)  aSender

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

- (CPMenu) supermenu

Returns the super menu or nil if there is none.

Definition at line 558 of file CPMenu.j.

- (CPString) title

Returns the menu title

Definition at line 643 of file CPMenu.j.

+ (Function) trackingCallbackWithCallback: (Function)  aCallback

Definition at line 774 of file CPMenu.j.

- (void) update

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

Definition at line 604 of file CPMenu.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines