NSOutlineViewDataSource

NSOutlineViewDataSource Mac OS X 10.0

Methods in this informal protocol are implemented by classes that provide the data contents for an NSOutlineView. An NSOutlineView data source delegate object must implement the following four required methods of the protocol: outlineView:child:ofItem:, outlineView:isItemExpandable:, outlineView:numberOfChildrenOfItem:, outlineView:objectValueForTableColumn: byItem:.

In each of these four methods, outlineView: is the NSOutlineView object invoking the method. Every outline view has a root item. In the invocation of the data source methods, an outline view indicates a root item as nil. Thus, if outlineView:numberOfChildrenOfItem: was invoked with nil at the item, the implementation of this method would return the number of children items for the root item.

@interface NSObject (NSOutlineViewDataSource)
 // Instance Methods
   - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
   - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
   - (int)outlineView:(NSOutlineView *)outlineView  numberOfChildrenOfItem:(id)item;
   - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn
        byItem:(id)item;
   - (void)outlineView:(NSOutlineView *)outlineView v  forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
   - (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject:(id)object;
   - (id)outlineView:(NSOutlineView *)outlineView persistentObjectForItem:(id)item;
   - (BOOL)outlineView:(NSOutlineView *)olv  writeItems:(NSArray*)items toPasteboard:(NSPasteboard*)pboard;
   - (NSDragOperation)outlineView:(NSOutlineView*)olv validateDrop:(id <NSDraggingInfo>)info
        proposedItem:(id)item proposedChildIndex:(int)index;
   - (BOOL)outlineView:(NSOutlineView*)olv acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index;
@end



    Part II: API Quick Reference
    Chapter 13. Foundation Classes