Declared In:
AppKit/NSOutlineView.h
Note: The NSOutlineView class and its supporting informal protocol NSOutlineDataSource are under development. If you want to use an NSOutlineView, you will have to instantiate it programmatically because Interface Builder does not yet include support for working with it.
The NSOutlineDataSource category declares the methods that an NSOutlineView uses to access the contents of its data source object. An outline view determines whether an item is expandable by sending the outlineView:isItemExpandable:
message. It determines how many rows to display for an expanded item by sending an outlineView:numberOfChildrenOfItem:
message. It accesses individual values with the outlineView:child:ofItem:
and outlineView:objectValueForTableColumn:byItem:
methods. A data source must implement these methods to work with an NSOutlineView. To allow users to modify data, the data source object also implements the outlineView:setObjectValue:forTableColumn:byItem:
method; otherwise, the NSOutlineView provides read-only access to its contents.
The NSOutlineView treats objects provided by its data source as values to be displayed in NSCell objects. If these objects aren't of common value classes-such as NSString, NSNumber, and so on-you'll need to create a custom NSFormatter to display them. See the NSFormatter class specification for more information.
outlineView:
(NSOutlineView *)outlineViewchild:
(int)indexofItem:
(id)item
Returns the id
for the child at index for item in outlineView. Returns nil
if no such child exists. Items at the highest level in an outline view are considered to be children of a single root item. To specify a child of the single root item, you pass nil
for item.
outlineView:
(NSOutlineView *)outlineViewisItemExpandable:
(id)item
Returns the number of records managed for outlineView by the data source object. An NSOutlineView uses this method to determine whether item is expandable.
outlineView:
(NSOutlineView *)outlineViewobjectValueForTableColumn:
(NSTableColumn *)tableColumnbyItem:
(id)item
Returns an attribute value for the record in outlineView specified by item. tableColumn contains the identifier for the attribute, which you get by using NSTableColumn's identifier
method. For example, if tableColumn stands for the city that an employee lives in and item specifies the record for an employee who lives in Portland, this method returns an object with a string value of "Portland."
outlineView:
(NSOutlineView *)outlineViewnumberOfChildrenOfItem:
(id)item
Returns the number of children for item in outlineView.
outlineView:
(NSOutlineView *)outlineViewsetObjectValue:
(id)objectforTableColumn:
(NSTableColumn *)tableColumnbyItem:
(id)item
Sets an attribute value for the record in outlineView specified by item. anObject is the new value, and aTableColumn contains the identifier for the attribute, which you get by using NSTableColumn's identifier
method. This method allows editing of the data source's outline view.