diff --git a/ChangeLog b/ChangeLog index a626d1168..def1c86e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-05 Matt Rice + + * Source/NSOutlineView (-mouseDown:): Check item expandability before + expanding or collapsing. + 2007-02-05 Fred Kiefer * Headers/AppKit/NSMenuItem.h: Add MacOS 10.3 methods and diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 78bda88ba..ebb0d3744 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -836,11 +836,12 @@ static NSImage *unexpandable = nil; && [_tableColumns objectAtIndex: _clickedColumn] == _outlineTableColumn) { NSImage *image; - + + id item = [self itemAtRow:_clickedRow]; int level = [self levelForRow: _clickedRow]; int position = 0; - - if ([self isItemExpanded: [self itemAtRow: _clickedRow]]) + + if ([self isItemExpanded: item]) { image = expanded; } @@ -856,15 +857,17 @@ static NSImage *unexpandable = nil; position += _columnOrigins[_clickedColumn]; - if (location.x >= position && location.x <= position + [image size].width) + if ([self isExpandable:item] + && location.x >= position + && location.x <= position + [image size].width) { - if (![self isItemExpanded: [self itemAtRow: _clickedRow]]) + if (![self isItemExpanded: item]) { - [self expandItem: [self itemAtRow: _clickedRow]]; + [self expandItem: item]; } else { - [self collapseItem: [self itemAtRow: _clickedRow]]; + [self collapseItem: item]; } return; }