Inherits from: NSTextFieldCell : NSActionCell : NSCell : NSObject
Package: com.apple.yellow.application
Implements: NSCoding (from NSCell) NSCopying (from NSCell)
NSComboBoxCell is a subclass of NSTextFieldCell used to implement the user interface of "combo boxes" (see the Class Description in the NSComboBox class specification for information on how combo boxes look and work). The NSComboBox subclass of NSTextField uses a single NSComboBoxCell, and essentially all of NSComboBox's methods simply invoke the corresponding NSComboBoxCell method.
- Setting display attributes
- hasVerticalScroller
- intercellSpacing
- itemHeight
- numberOfVisibleItems
- setHasVerticalScroller
- setIntercellSpacing
- setItemHeight
- setNumberOfVisibleItems
- Setting a data source
- dataSource
- setDataSource
- setUsesDataSource
- usesDataSource
- Working with an internal list
- addItemsWithObjectValues
- addItemWithObjectValue
- insertItemWithObjectValueAtIndex
- objectValues
- removeAllItems
- removeItemAtIndex
- removeItemWithObjectValue
- numberOfItems
- Manipulating the displayed list
- indexOfItemWithObjectValue
- itemObjectValueAtIndex
- noteNumberOfItemsChanged
- reloadData
- scrollItemAtIndexToTop
- scrollItemAtIndexToVisible
- Manipulating the selection
- deselectItemAtIndex
- indexOfSelectedItem
- objectValueOfSelectedItem
- selectItemAtIndex
- selectItemWithObjectValue
- Completing the text field
- completedString
- completes
- setCompletes
public NSComboBoxCell(String aString)
public NSComboBoxCell(NSImage aNSImage)
public NSComboBoxCell(NSCoder decoder)
public void addItemsWithObjectValues(NSArray objects)
true
.public void addItemWithObjectValue(Object anObject)
true
.public String completedString(String substring)
null
if there is no such string. The
argument substring is what the user
entered in the combo box's text field. The default implementation
of this method first checks whether the combo box uses a data source
and whether the data source responds to comboBox:completedString: or comboBoxCell:completedString:. If
so, the combo box cell returns that method's return value. Otherwise,
this method goes through the combo box's items one-by-one and
returns an item which starts with substring. Override this method only if your subclass completes strings differently. The overriding method does not need to call the superclass's method. Generally, you do not need to call this method directly.
public boolean completes()
true
if
the combo box tries to complete what the user types in the text field. It
returns
false
otherwise.See Also: setCompletes
public Object dataSource()
false
.
See the class description and the NSComboBoxCellDataSource informal
protocol specification for more information on combo box cell data
source objects.public void deselectItemAtIndex(int index)
See Also: indexOfSelectedItem, numberOfItems, selectItemAtIndex
public void encodeWithCoder(NSCoder encoder)
See Also: initWithCoder:
public boolean hasVerticalScroller()
true
if
the receiver will display a vertical scroller. Note
that the scoller will be displayed even if the pop-up list contains
fewer items than will fit in the area specified for display. Returns
false
if
the receiver won't display a vertical scroller.See Also: numberOfItems, numberOfVisibleItems
public int indexOfItemWithObjectValue(Object anObject)
true
.
If none of the objects in the receiver's internal item list are
equal to anObject, indexOfItemWithObjectValue returns NSArray.NotFound.
This method logs a warning if usesDataSource returns
true
.See Also: selectItemWithObjectValue
public int indexOfSelectedItem()
See Also: objectValueOfSelectedItem
public void insertItemWithObjectValueAtIndex(Object anObject, int index)
true
.See Also: addItemWithObjectValue, numberOfItems
public NSSize intercellSpacing()
See Also: itemHeight, numberOfVisibleItems
public float itemHeight()
See Also: intercellSpacing, numberOfVisibleItems
public Object itemObjectValueAtIndex(int index)
true
. See Also: objectValueOfSelectedItem
public void noteNumberOfItemsChanged()
See the NSComboBoxCellDataSource informal protocol specification for information on the messages an NSComboBoxCell sends to its data source.
See Also: reloadData
public int numberOfItems()
See Also: numberOfVisibleItems, - numberOfItemsInComboBoxCell: (NSComboBoxCellDataSource protocol), -
public int numberOfVisibleItems()
See Also: numberOfItems
public Object objectValueOfSelectedItem()
null
if
no item is selected. Note that nothing is initially
selected in a newly-initialized combo box cell. This method logs a
warning if usesDataSource returns
true
.See Also: indexOfSelectedItem, - comboBoxCell:objectValueForItemAtIndex: (NSComboBoxCellDataSource protocol)
public NSArray objectValues()
true
.public void reloadData()
See Also: noteNumberOfItemsChanged
public void removeAllItems()
true
.See Also: objectValues
public void removeItemAtIndex(int index)
true
.public void removeItemWithObjectValue(Object anObject)
true
.
This method logs a warning if usesDataSource returns
true
.See Also: indexOfItemWithObjectValue
public void scrollItemAtIndexToTop(int index)
public void scrollItemAtIndexToVisible(int index)
public void selectItemAtIndex(int index)
See Also: - setObjectValue(NSControl)
public void selectItemWithObjectValue(Object anObject)
true
.
Posts NSComboBoxSelectionDidChangeNotification to the default notification
center if the selection does in fact change. Note that this method
doesn't alter the contents of the combo box cell's text field-see "Interacting
with the Text Field" in the class description for more information.See Also: - setObjectValue(NSControl)
public void setCompletes(boolean completes)
If completes is true
,
every time the user adds characters to the end of the text field,
the combo box calls the NSComboBoxCell method completedString. If completedString returns
a string that's longer than the existing string, the combo box
replaces the existing string with the returned string, and selects
the additional characters. If the user is deleting characters or
adds characters somwhere besides the end of the string, the combo
box does not try to complete it.
See Also: completes
public void setDataSource(Object aSource)
false
,
and in fact logs a warning if usesDataSource returns
false
.This method logs a warning if aSource doesn't respond to either numberOfRowsInComboBoxCell: or comboBoxCell:objectValueForItemAtIndex:.
See Also: setUsesDataSource
public void setHasVerticalScroller(boolean flag)
true
.
If flag is
false
and
the combo box cell has more list items (either in its internal item
list or from its data source) than are allowed by numberOfVisibleItems,
only a subset will be displayed. NSComboBoxCell's scroll... methods
can be used to position this subset within the pop-up list.Note
that if flag is true
,
a scroller will be displayed even if the combo box cell has fewer
list items than are allowed by numberOfVisibleItems.
See Also: numberOfItems, scrollItemAtIndexToTop, scrollItemAtIndexToVisible
public void setIntercellSpacing(NSSize aSize)
See Also: setItemHeight, setNumberOfVisibleItems
public void setItemHeight(float itemHeight)
See Also: setIntercellSpacing, setNumberOfVisibleItems
public void setNumberOfVisibleItems(int visibleItems)
See Also: numberOfItems, numberOfVisibleItems, setIntercellSpacing, setItemHeight
public void setUsesDataSource(boolean flag)
public boolean usesDataSource()
true
if
the receiver uses an external data source to populate the receiver's
pop-up list,
false
if
it uses an internal item list.See Also: dataSource