I'm trying to get dragging working on an NSOutlineView that's getting its data through a NSTreeController. I can't seem to figure out the "right" way to do this.
For example, in a NSTableView, it's possible to set up a delegate that implements part of NSTableDataSource:
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard
However, for NSOutlineView there doesn't seem to be any equivalent function that uses NSIndexSet. There is a NSOutlineViewDataSource function
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
but then the outline view will insist that all of the other methods in that protocol be implemented: "Must implement outlineView:numberOfChildrenOfItem:, outlineView:isItemExpandable:, outlineView:child:ofItem: and outlineView:objectValueForTableColumn:byItem:". When those methods are made to exist, the NSOutlineView will ignore the data in the NSTreeController altogether.
It seems odd to me that there's not a more straightforward solution to this, and I feel like I've missed something here, or that something is missing (10.4.1?) Any help would be appreciated.
Thanks!
Kevin
|