Up

# NSPopUpButtonCell

### Authors

Fred Kiefer (`FredKiefer@gmx.de`)
Michael Hanni (`mhanni@sprintmail.com`)

Copyright: (C) 1999 Free Software Foundation, Inc.

# Software documentation for the NSPopUpButtonCell class

## NSPopUpButtonCell : NSMenuItemCell

> Declared in:
>   AppKit/NSPopUpButtonCell.h

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- -addItemWithTitle:
- -addItemsWithTitles:
- -altersStateOfSelectedItem
- -arrowPosition
- -attachPopUpWithFrame:inView:
- -autoenablesItems
- -dismissPopUp
- -indexOfItem:
- -indexOfItemWithRepresentedObject:
- -indexOfItemWithTag:
- -indexOfItemWithTarget:andAction:
- -indexOfItemWithTitle:
- -indexOfSelectedItem
- -initTextCell:pullsDown:
- -insertItemWithTitle:atIndex:
- -itemArray
- -itemAtIndex:
- -itemTitleAtIndex:
- -itemTitles
- -itemWithTitle:
- -lastItem
- -menu
- -numberOfItems
- -performClickWithFrame:inView:
- -preferredEdge
- -pullsDown
- -removeAllItems
- -removeItemAtIndex:
- -removeItemWithTitle:
- -selectItem:
- -selectItemAtIndex:
- -selectItemWithTitle:
- -selectedItem
- -setAltersStateOfSelectedItem:
- -setArrowPosition:
- -setAutoenablesItems:
- -setMenu:
- -setPreferredEdge:
- -setPullsDown:
- -setTitle:
- -setUsesItemFromMenu:
- -synchronizeTitleAndSelectedItem
- -titleOfSelectedItem
- -usesItemFromMenu

### addItemWithTitle:

- (void) addItemWithTitle: (NSString*)title;
Availability: OpenStep
Add an item to the popup with title.

### addItemsWithTitles:

- (void) addItemsWithTitles: (NSArray*)titles;
Availability: OpenStep
Add a number of items to the reciever using the provided itemTitles array.

### altersStateOfSelectedItem

- (BOOL) altersStateOfSelectedItem;
Availability: OpenStep
Return `YES`, if the reciever changes the state of the item chosen by the user.

### arrowPosition

- (NSPopUpArrowPosition) arrowPosition;
Availability: OpenStep
Returns the current arrow position of the reciever.

### attachPopUpWithFrame: inView:

- (void) attachPopUpWithFrame: (NSRect)cellFrame inView: (NSView*)controlView;
Availability: OpenStep
Attach popup

### autoenablesItems

- (BOOL) autoenablesItems;
Availability: OpenStep
Returns `YES`, if the items are autoenabled.

### dismissPopUp

- (void) dismissPopUp;
Availability: OpenStep
Dismiss the reciever.

### indexOfItem:

- (int) indexOfItem: (id<NSMenuItem>)item;
Availability: OpenStep
Return the index of item in the item array of the reciever.

### indexOfItemWithRepresentedObject:

- (int) indexOfItemWithRepresentedObject: (id)obj;
Availability: OpenStep
Index of the item whose menu item's representedObject is equal to obj.

### indexOfItemWithTag:

- (int) indexOfItemWithTag: (int)tag;
Availability: OpenStep
Return index of the item with a tag equal to aTag.

### indexOfItemWithTarget: andAction:

- (int) indexOfItemWithTarget: (id)aTarget andAction: (SEL)actionSelector;
Availability: OpenStep
Index of the item in the reciever whose target and action are equal to aTarget and actionSelector.

### indexOfItemWithTitle:

- (int) indexOfItemWithTitle: (NSString*)title;
Availability: OpenStep
Return index of the item with the given title.

### indexOfSelectedItem

- (int) indexOfSelectedItem;
Availability: OpenStep
Index of the currently selected item in the reciever.

### initTextCell: pullsDown:

- (id) initTextCell: (NSString*)stringValue pullsDown: (BOOL)flag;
Availability: OpenStep
Initialize with stringValue and pullDown. If pullDown is `YES`, the reciever will be a pulldown button.

### insertItemWithTitle: atIndex:

- (void) insertItemWithTitle: (NSString*)title atIndex: (int)index;
Availability: OpenStep
Adds an item with the given title at index. If an item already exists at index, it, and all items after it are advanced one position. Index needs to be within the valid range for the array of items in the popup button.

### itemArray

- (NSArray*) itemArray;
Availability: OpenStep
Item array of the reciever.

### itemAtIndex:

- (id<NSMenuItem>) itemAtIndex: (int)index;
Availability: OpenStep
Return the item at index.

### itemTitleAtIndex:

- (NSString*) itemTitleAtIndex: (int)index;
Availability: OpenStep
Set item title at the given index in the reciever.

### itemTitles

- (NSArray*) itemTitles;
Availability: OpenStep
Returns an array containing all of the current item titles.

### itemWithTitle:

- (id<NSMenuItem>) itemWithTitle: (NSString*)title;
Availability: OpenStep
Return the item with title.

### lastItem

- (id<NSMenuItem>) lastItem;
Availability: OpenStep
Return the item listed last in the reciever.

### menu

- (NSMenu*) menu;
Availability: OpenStep
Return the menu for the popup.

### numberOfItems

- (int) numberOfItems;
Availability: OpenStep
Number of items in the reciever.

### performClickWithFrame: inView:

- (void) performClickWithFrame: (NSRect)frame inView: (NSView*)controlView;
Availability: OpenStep
Perform the click operation with the given frame and controlView.

### preferredEdge

- (NSRectEdge) preferredEdge;
Availability: OpenStep
Return the preferred edge.

### pullsDown

- (BOOL) pullsDown;
Availability: OpenStep
Returns `YES`, if this is a pull-down

### removeAllItems

- (void) removeAllItems;
Availability: OpenStep
Purges all items from the popup.

### removeItemAtIndex:

- (void) removeItemAtIndex: (int)index;
Availability: OpenStep
Remove a given item based on its index, must be a valid index within the range for the item array of this popup.

### removeItemWithTitle:

- (void) removeItemWithTitle: (NSString*)title;
Availability: OpenStep
Remove a given item based on its title.

### selectItem:

- (void) selectItem: (id<NSMenuItem>)item;
Availability: OpenStep
Select item in the reciever.

### selectItemAtIndex:

- (void) selectItemAtIndex: (int)index;
Availability: OpenStep
Select item at the given index.

### selectItemWithTitle:

- (void) selectItemWithTitle: (NSString*)title;
Availability: OpenStep
Select the item with the given title.

### selectedItem

- (id<NSMenuItem>) selectedItem;
Availability: OpenStep
The currently selected item in the reciever.

### setAltersStateOfSelectedItem:

- (void) setAltersStateOfSelectedItem: (BOOL)flag;
Availability: OpenStep
Set to `YES`, if the state of the menu item selected in the reciever should be changed when it's selected.
Return `YES`, if the reciever changes the state of the item chosen by the user.

### setArrowPosition:

- (void) setArrowPosition: (NSPopUpArrowPosition)pos;
Availability: OpenStep
Sets the current arrow position of the reciever.

### setAutoenablesItems:

- (void) setAutoenablesItems: (BOOL)flag;
Availability: OpenStep
Set to `YES`, if the items are to be autoenabled.

### setMenu:

- (void) setMenu: (NSMenu*)menu;
Availability: OpenStep
Set the menu for the popup.

### setPreferredEdge:

- (void) setPreferredEdge: (NSRectEdge)preferredEdge;
Availability: OpenStep
Set the preferred edge as described by edge. This is used to determine the edge which will open the popup when the screen is small.

### setPullsDown:

- (void) setPullsDown: (BOOL)flag;
Availability: OpenStep
Set to `YES` to make the popup button a pull-down style control.
Returns `YES`, if this is a pull-down

### setTitle:

- (void) setTitle: (NSString*)aString;
Availability: OpenStep
Set title to aString.

### setUsesItemFromMenu:

- (void) setUsesItemFromMenu: (BOOL)flag;
Availability: OpenStep
Set to `YES`, if the reciever should use a menu item for its title. `YES` is the default.

### synchronizeTitleAndSelectedItem

- (void) synchronizeTitleAndSelectedItem;
Availability: OpenStep
Synchronizes the title and the selected item. This sets the selected item to the title of the reciever.

### titleOfSelectedItem

- (NSString*) titleOfSelectedItem;
Availability: OpenStep
Returns the title of the currently selected item in the reciever.

### usesItemFromMenu

- (BOOL) usesItemFromMenu;
Availability: OpenStep
Returns `YES`, if the reciever uses a menu item for its title.

## Instance Variables for NSPopUpButtonCell Class

### _pbcFlags

@protected struct __pbcFlags _pbcFlags;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _selectedItem

@protected id _selectedItem;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up