From 4be4506ffc43cf2c1a5a48d9f83f7bf36e2a793e Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Wed, 14 Mar 2012 23:08:01 +0000 Subject: [PATCH] Implement outline view outlineView:shouldShowOutlineViewForItem: delegate method (corresponding to shouldShowOutlineCellForItem in Cocoa). --- AppKit/CPOutlineView.j | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 09a7b56c9..6f9c90c67 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -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], @@ -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]; @@ -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]; }