CPObjectCPResponder
CPView
CPControl
CPButton
CPPopUpButton
@implementation CPPopUpButton : CPButton
A CPPopUpButton
contains a pop-up menu of items that a user can select from.
Method Summary | |
---|---|
-(id) | initWithCoder:(CPCoder)aCoder Initializes the pop-up button with data from the specified coder. |
-(id) | initWithFrame:(CGRect)aFrame Initializes the receiver for usage with the specified bounding rectangle. |
-(id) | initWithFrame:(CGRect)aFrame pullsDown:(BOOL)shouldPullDown Initializes the pop-up button to the specified size. |
-(void) | addItemWithTitle:(CPString)aTitle Adds a new menu item with the specified title. |
-(void) | addItemsWithTitles:(CPArray)titles Adds multiple new menu items with the titles specified in the provided array. |
-(void) | encodeWithCoder:(CPCoder)aCoder Encodes the data of the pop-up button into a coder. |
-(int) | indexOfItem:(CPMenuItem)aMenuItem Returns the index of the specified item or CPNotFound if the item is not in the list. |
-(int) | indexOfItemWithRepresentedObject:(id)anObject Returns the index of the item with the specified represented object or CPNotFound
if a match does not exist. |
-(int) | indexOfItemWithTag:(int)aTag Returns the index of the item with the specified tag or CPNotFound if the item is not in the list. |
-(int) | indexOfItemWithTarget:(id)aTarget action:(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 or CPNotFound . |
-(int) | indexOfSelectedItem Returns the index of the selected item. |
-(void) | insertItemWithTitle:(CPString)aTitle atIndex:(int)anIndex Inserts a new item with the specified title and index location. |
-(CPArray) | itemArray Returns an array of the items in the menu. |
-(CPMenuItem) | itemAtIndex:(unsigned)anIndex Returns the item at the specified index or nil if the item does not exist. |
-(CPString) | itemTitleAtIndex:(unsigned)anIndex Returns the title of the item at the specified index or nil if no item exists. |
-(CPArray) | itemTitles Returns an array of all the menu item titles. |
-(CPMenuItem) | itemWithTitle:(CPString)aTitle Returns the menu item with the specified title. |
-(CPMenuItem) | lastItem Returns the last menu item. |
-(CPMenu) | menu Returns the button's menu of items. |
-(void) | menuDidAddItem:(CPNotification)aNotification Called when the menu has a new item added to it. |
-(void) | menuDidChangeItem:(CPNotification)aNotification Called when a menu item has changed. |
-(void) | menuDidRemoveItem:(CPNotification)aNotification Called when an item was removed from the menu. |
-(void) | mouseDown:(CPEvent)anEvent Called when the user clicks on this button. |
-(int) | numberOfItems Returns a count of the number of items in the button's menu. |
-(id) | objectValue Returns the selected item's index. |
-(CPRectEdge) | preferredEdge Returns the button's edge where the pop-up menu will be displayed when there is not enough room to display directly above the button. |
-(BOOL) | pullsDown Returns YES if the button is a pull-down menu. |
-(void) | removeAllItems Removes all menu items from the pop-up button's menu. |
-(void) | removeItemAtIndex:(int)anIndex Removes the menu item at the specified index. |
-(void) | removeItemWithTitle:(CPString)aTitle Removes a menu item with the specified title from the button. |
-(void) | selectItem:(CPMenuItem)aMenuItem Selects the specified menu item. |
-(void) | selectItemAtIndex:(int)anIndex Selects the item at the specified index. |
-(void) | selectItemWithTag:(int)aTag Selects the menu item with the specified tag. |
-(void) | selectItemWithTitle:(CPString)aTitle Selects the item with the specified title. |
-(CPMenuItem) | selectedItem Returns the selected item or nil if no item is selected. |
-(void) | setBordered:(BOOL)shouldBeBordered Sets whether the button has a bezeled border. |
-(void) | setImage:(CPImage)anImage This method has no effect. |
-(void) | setMenu:(CPMenu)aMenu Sets the menu for the button. |
-(void) | setObjectValue:(id)aValue Sets the object for the selected item. |
-(void) | setPreferredEdge:(CPRectEdge)aRectEdge Sets the preffered edge of the button to display the pop-up when there is a limited amount of screen space. |
-(void) | setPullsDown:(BOOL)shouldPullDown Specifies whether the object is a pull-down or a pop-up menu. |
-(void) | setTitle:(CPString)aTitle Sets the pop-up button's title. |
-(void) | synchronizeTitleAndSelectedItem Makes sure the selected item and the item being displayed are one and the same. |
-(CPString) | titleOfSelectedItem Returns the title of the selected item or nil if no item is selected. |
Methods inherited from class CPControl |
---|
initWithFrame, action, alignment, backgroundColorForName, floatValue, font, isEnabled, mouseUp, sendAction, setAction, setAlignment, setBackgroundColor, setBackgroundColorWithName, setBackgroundColor, setEnabled, setFloatValue, setFont, setTarget, setTextColor, setTextShadow, target, textColor, textShadow |
Method Detail |
---|
-(id)initWithCoder:(CPCoder)aCoder
aCoder
- the coder from which to read
the data-(id)initWithFrame:(CGRect)aFrame
aFrame
-(id)initWithFrame:(CGRect)aFrame pullsDown:(BOOL)shouldPullDown
aFrame
- the size for the buttonshouldPullDown
- YES
makes this a pull-down menu, NO
makes it a pop-up menu.-(void)addItemWithTitle:(CPString)aTitle
aTitle
-(void)addItemsWithTitles:(CPArray)titles
titles
- an arry of names for the new items-(void)encodeWithCoder:(CPCoder)aCoder
aCoder
- the coder to which the data
will be written-(int)indexOfItem:(CPMenuItem)aMenuItem
CPNotFound
if the item is not in the list.aMenuItem
- the item to obtain the index for-(int)indexOfItemWithRepresentedObject:(id)anObject
CPNotFound
if a match does not exist.anObject
- the item's represented object-(int)indexOfItemWithTag:(int)aTag
CPNotFound
if the item is not in the list.aTag
- the item's tag-(int)indexOfItemWithTarget:(id)aTarget action:(SEL)anAction
CPNotFound
if the no
such item is in the list.aTarget
- the item's targetanAction
- the item's action-(int)indexOfItemWithTitle:(CPString)aTitle
CPNotFound
.aTitle
- the item's titel-(int)indexOfSelectedItem
CPNotFound
.-(void)insertItemWithTitle:(CPString)aTitle atIndex:(int)anIndex
aTitle
- the new itme's titleanIndex
- the item's index in the menu-(CPArray)itemArray
-(CPMenuItem)itemAtIndex:(unsigned)anIndex
nil
if the item does not exist.anIndex
- the index of the item to obtain-(CPString)itemTitleAtIndex:(unsigned)anIndex
nil
if no item exists.anIndex
- the index of the item-(CPArray)itemTitles
-(CPMenuItem)itemWithTitle:(CPString)aTitle
aTitle
- the title of the desired menu item-(CPMenuItem)lastItem
-(CPMenu)menu
-(void)menuDidAddItem:(CPNotification)aNotification
aNotification
- information about the event-(void)menuDidChangeItem:(CPNotification)aNotification
aNotification
- information about the event-(void)menuDidRemoveItem:(CPNotification)aNotification
aNotification
- information about the event-(void)mouseDown:(CPEvent)anEvent
anEvent
- the event with information about the click-(int)numberOfItems
-(id)objectValue
CPNotFound
.-(CPRectEdge)preferredEdge
-(BOOL)pullsDown
YES
if the button is a pull-down menu. NO
if the button is a pop-up menu.-(void)removeAllItems
-(void)removeItemAtIndex:(int)anIndex
anIndex
- the index of the item to remove-(void)removeItemWithTitle:(CPString)aTitle
aTitle
- the title of the item to remove-(void)selectItem:(CPMenuItem)aMenuItem
aMenuItem
- the item to select-(void)selectItemAtIndex:(int)anIndex
anIndex
- the index of the item to select-(void)selectItemWithTag:(int)aTag
aTag
-(void)selectItemWithTitle:(CPString)aTitle
aTitle
-(CPMenuItem)selectedItem
nil
if no item is selected.-(void)setBordered:(BOOL)shouldBeBordered
shouldBeBordered
-(void)setImage:(CPImage)anImage
anImage
-(void)setMenu:(CPMenu)aMenu
aMenu
-(void)setObjectValue:(id)aValue
aValue
-(void)setPreferredEdge:(CPRectEdge)aRectEdge
aRectEdge
-(void)setPullsDown:(BOOL)shouldPullDown
shouldPullDown
- YES
makes the pop-up button
a pull-down menu. NO
makes it a pop-up menu.-(void)setTitle:(CPString)aTitle
aTitle
- the new title-(void)synchronizeTitleAndSelectedItem
-(CPString)titleOfSelectedItem
nil
if no item is selected.Created on Sat Sep 13 14:15:43 PDT 2008