Skip to content

Commit

Permalink
Implement outline view outlineView:shouldShowOutlineViewForItem: dele…
Browse files Browse the repository at this point in the history
…gate method (corresponding to shouldShowOutlineCellForItem in Cocoa).
  • Loading branch information
aljungberg committed Mar 14, 2012
1 parent c21d2fd commit 4be4506
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions AppKit/CPOutlineView.j
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
*/
- (CGRect)frameOfOutlineDisclosureControlAtRow:(CPInteger)aRow
{
if (![self isExpandable:[self itemAtRow:aRow]])
var theItem = [self itemAtRow:aRow];
if (![self isExpandable:theItem] || (_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldShowOutlineViewForItem_ && ![_outlineViewDelegate outlineView:self shouldShowOutlineViewForItem:theItem]))
return _CGRectMakeZero();

var dataViewFrame = [self _frameOfOutlineDataViewAtRow:aRow],
Expand Down Expand Up @@ -1285,7 +1286,12 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
item = _itemsForRows[row],
isExpandable = [self isExpandable:item];

if (!isExpandable)
if (!isExpandable)
continue;

var disclosureControlFrame = [self frameOfOutlineDisclosureControlAtRow:row];

if (_CGRectIsEmpty(disclosureControlFrame))
continue;

var control = [self _dequeueDisclosureControl];
Expand All @@ -1295,7 +1301,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
[control setState:[self isItemExpanded:item] ? CPOnState : CPOffState];
var selector = [self isRowSelected:row] ? @"setThemeState:" : @"unsetThemeState:";
[control performSelector:CPSelectorFromString(selector) withObject:CPThemeStateSelected];
[control setFrame:[self frameOfOutlineDisclosureControlAtRow:row]];
[control setFrame:disclosureControlFrame];

[self addSubview:control];
}
Expand Down

0 comments on commit 4be4506

Please sign in to comment.