Joshua
Joshua

Reputation: 15510

Displaying a NSCell with the number of children its row has

I would like a NSCell in an OutlineView to display the number of the children the row it's has. Here's what I mean:

alt text
(source: sourceforge.net)
What's on the right, but for all rows.

How would I go about finding out, first, which row the NSCell is and then from there getting the number of children that row has.

Upvotes: 1

Views: 195

Answers (1)

Dave DeLong
Dave DeLong

Reputation: 243156

PXSourceList does this.

edit re: the comment about displaying the number of children in the badge

If you use the excellent PXSourceList, then you'll simply implement a single delegate method:

- (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item;

Most likely, you'll implement this as:

- (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item {
  return [self sourceList:aSourceList numberOfChildrenOfItem:item];
}

Upvotes: 2

Related Questions