CPObjectCPMenu
@implementation CPMenu : CPObject
Menus provide the user with a list of actions and/or submenus. Submenus themselves are full fledged menus and so a heirarchical structure appears.
Method Summary | |
---|---|
+(CPImage) | menuBarIconImage |
+(CPString) | menuBarTitle |
+(BOOL) | menuBarVisible |
+(void) | popUpContextMenu:(CPMenu)aMenu withEvent:(CPEvent)anEvent forView:(CPView)aView |
+(void) | popUpContextMenu:(CPMenu)aMenu withEvent:(CPEvent)anEvent forView:(CPView)aView withFont:(CPFont)aFont |
+(void) | setMenuBarIconImage:(CPImage)anImage |
+(void) | setMenuBarTitle:(CPString)aTitle |
+(void) | setMenuBarVisible:(BOOL)menuBarShouldBeVisible |
-(id) | initWithCoder:(CPCoder)aCoder Initializes the menu with data from the specified coder. |
-(id) | initWithTitle:(CPString)aTitle Initializes the menu with a specified title. |
-(void) | addItem:(CPMenuItem)aMenuItem Adds a menu item at the end of the menu. |
-(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. |
-(CPMenu) | attachedMenu Returns the attaced menu, or nil if there isn't one. |
-(BOOL) | autoenablesItems Returns YES if the menu auto enables items. |
-(void) | cancelTracking Cancels tracking. |
-(id) | delegate |
-(void) | encodeWithCoder:(CPCoder)aCoder Encodes the data of the menu into a coder. |
-(CPMenuItem) | highlightedItem Returns the currently highlighted menu item. |
-(int) | indexOfItem:(CPMenuItem)aMenuItem Returns the index of the specified menu item. |
-(int) | indexOfItemWithRepresentedObject:(id)anObject Returns the index of the menu item with the specified represented object. |
-(int) | indexOfItemWithSubmenu:(CPMenu)aMenu Returns the index of the item with the specified submenu. |
-(int) | indexOfItemWithTag:(int)aTag Returns the index of the item with the specified tag. |
-(int) | indexOfItemWithTarget:(id)aTarget andAction:(SEL)anAction Returns the index of the item with the specified target and action. |
-(int) | indexOfItemWithTitle:(CPString)aTitle Returns the index of the item with the specified title. |
-(CPMenuItem) | insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(unsigned)anIndex Creates and inserts a new menu item with the specified attributes. |
-(void) | insertItem:(CPMenuItem)aMenuItem atIndex:(unsigned)anIndex Inserts a menu item at the specified index. |
-(BOOL) | isAttached Returns YES if the menu is attached to another menu. |
-(BOOL) | isTornOff If there are two instances of this menu visible, return NO . |
-(CPArray) | itemArray Returns the array of menu items backing this menu. |
-(CPMenuItem) | itemAtIndex:(int)anIndex Returns the menu item at the specified index. |
-(void) | itemChanged:(CPMenuItem)aMenuItem Called when a menu item has visually changed. |
-(CGPoint) | locationOfSubmenu:(CPMenu)aMenu Not yet implemented. |
-(float) | menuBarHeight |
-(CPMenuItem) | menuWithTag:(int)aTag Returns the menu item with the specified tag. |
-(CPMenuItem) | menuWithTitle:(CPString)aTitle Returns the menu item with the specified title. |
-(unsigned) | numberOfItems Returns the number of menu items in the menu. |
-(void) | performActionForItemAtIndex:(unsigned)anIndex Sends the action of the menu item at the specified index. |
-(BOOL) | performKeyEquivalent:(CPEvent)anEvent Initiates the action of the menu item that has a keyboard shortcut equivalent to anEvent . |
-(void) | removeItem:(CPMenuItem)aMenuItem Removes the specified item from the menu. |
-(void) | removeItemAtIndex:(unsigned)anIndex Removes the item at the specified index from the menu. |
-(void) | setAutoenablesItems:(BOOL)aFlag Sets whether the menu automatically enables menu items. |
-(void) | setDelegate:(id)aDelegate |
-(void) | setShowsStateColumn:(BOOL)shouldShowStateColumn Sets whether to show the state column. |
-(void) | setSubmenu:(CPMenu)aMenu forItem:(CPMenuItem)aMenuItem Sets a submenu for a menu item. |
-(void) | setSupermenu:(CPMenu)aMenu Sets the super menu. |
-(void) | setTitle:(CPString)aTitle Sets the menu title. |
-(BOOL) | showsStateColumn Returns YES if the menu shows the state column. |
-(void) | submenuAction:(id)aSender The action method of menu items that open submenus. |
-(CPMenu) | supermenu Returns the super menu or nil if there is none. |
-(CPString) | title Returns the menu title. |
-(void) | update Not implemented. |
Method Detail |
---|
+(CPImage)menuBarIconImage
+(CPString)menuBarTitle
+(BOOL)menuBarVisible
+(void)popUpContextMenu:(CPMenu)aMenu withEvent:(CPEvent)anEvent forView:(CPView)aView
aMenu
anEvent
aView
+(void)popUpContextMenu:(CPMenu)aMenu withEvent:(CPEvent)anEvent forView:(CPView)aView withFont:(CPFont)aFont
aMenu
anEvent
aView
aFont
+(void)setMenuBarIconImage:(CPImage)anImage
anImage
+(void)setMenuBarTitle:(CPString)aTitle
aTitle
+(void)setMenuBarVisible:(BOOL)menuBarShouldBeVisible
menuBarShouldBeVisible
-(id)initWithCoder:(CPCoder)aCoder
aCoder
- the coder from which to read the data-(id)initWithTitle:(CPString)aTitle
aTitle
-(void)addItem:(CPMenuItem)aMenuItem
aMenuItem
- the menu item to add-(CPMenuItem)addItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent
aTitle
- the title of the new menu itemanAction
- the action initiated when the user selects the itemaKeyEquivalent
- the keyboard shortcut for the menu item-(CPMenu)attachedMenu
nil
if there isn't one.-(BOOL)autoenablesItems
YES
if the menu auto enables items.-(void)cancelTracking
-(id)delegate
-(void)encodeWithCoder:(CPCoder)aCoder
aCoder
- the coder to which the data will be written-(CPMenuItem)highlightedItem
nil
if no item is currently highlighted
-(int)indexOfItem:(CPMenuItem)aMenuItem
aMenuItem
- the item to find the index forCPNotFound
-(int)indexOfItemWithRepresentedObject:(id)anObject
anObject
- the represented object of the desired itemCPNotFound
-(int)indexOfItemWithSubmenu:(CPMenu)aMenu
aMenu
CPNotFound
-(int)indexOfItemWithTag:(int)aTag
aTag
- the desired tag to matchCPNotFound
-(int)indexOfItemWithTarget:(id)aTarget andAction:(SEL)anAction
aTarget
- the target of the desired menu itemanAction
- the action of the desired menu itemCPNotFound
-(int)indexOfItemWithTitle:(CPString)aTitle
aTitle
- the desired title to matchCPNotFound
-(CPMenuItem)insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(unsigned)anIndex
aTitle
- the title of the menu itemanAction
- the action initiated when the user selects the itemaKeyEquivalent
- the keyboard shortcut for the itemanIndex
- the index location in the menu for the new item-(void)insertItem:(CPMenuItem)aMenuItem atIndex:(unsigned)anIndex
aMenuItem
- the item to insertanIndex
- the index in the menu to insert the item.-(BOOL)isAttached
YES
if the menu is attached to another menu.-(BOOL)isTornOff
NO
.
Otherwise, return YES
if we are a detached menu and visible.-(CPArray)itemArray
-(CPMenuItem)itemAtIndex:(int)anIndex
anIndex
- the index of the requested item-(void)itemChanged:(CPMenuItem)aMenuItem
aMenuItem
- the item that changed-(CGPoint)locationOfSubmenu:(CPMenu)aMenu
aMenu
-(float)menuBarHeight
-(CPMenuItem)menuWithTag:(int)aTag
aTag
nil
if a match was not found
-(CPMenuItem)menuWithTitle:(CPString)aTitle
aTitle
- the title of the menu itemnil
if a match was not found
-(unsigned)numberOfItems
-(void)performActionForItemAtIndex:(unsigned)anIndex
anIndex
- the index of the item-(BOOL)performKeyEquivalent:(CPEvent)anEvent
anEvent
anEvent
- the keyboard eventYES
if it was handled.
-(void)removeItem:(CPMenuItem)aMenuItem
aMenuItem
- the item to remove-(void)removeItemAtIndex:(unsigned)anIndex
anIndex
- the index of the item to remove-(void)setAutoenablesItems:(BOOL)aFlag
aFlag
- YES
sets the menu to automatically enable items.-(void)setDelegate:(id)aDelegate
aDelegate
-(void)setShowsStateColumn:(BOOL)shouldShowStateColumn
shouldShowStateColumn
- YES
shows the state column-(void)setSubmenu:(CPMenu)aMenu forItem:(CPMenuItem)aMenuItem
aMenu
- the submenuaMenuItem
- the menu item to set the submenu on-(void)setSupermenu:(CPMenu)aMenu
aMenu
- the new super menu-(void)setTitle:(CPString)aTitle
aTitle
-(BOOL)showsStateColumn
YES
if the menu shows the state column-(void)submenuAction:(id)aSender
aSender
- the object that sent the message-(CPMenu)supermenu
nil
if there is none.-(CPString)title
-(void)update
Created on Sat Sep 13 14:15:43 PDT 2008