Skip to content

Commit

Permalink
Fixes #1164. Support CPOutlineView `selectionShouldChangeInOutlineVie…
Browse files Browse the repository at this point in the history
…w:` delegate method.
  • Loading branch information
aljungberg committed Mar 25, 2012
1 parent 5351bf7 commit f50802b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion AppKit/CPOutlineView.j
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
CPOutlineViewCoalesceSelectionNotificationStateOn = 1,
CPOutlineViewCoalesceSelectionNotificationStateDid = 2;

#define SELECTION_SHOULD_CHANGE(anOutlineView) (!((anOutlineView)._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_selectionShouldChangeInOutlineView_) || [(anOutlineView)._outlineViewDelegate selectionShouldChangeInOutlineView:(anOutlineView)])

#define SHOULD_SELECT_ITEM(anOutlineView, anItem) (!((anOutlineView)._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldSelectItem_) || [(anOutlineView)._outlineViewDelegate outlineView:(anOutlineView) shouldSelectItem:(anItem)])

/*!
Expand Down Expand Up @@ -1512,7 +1514,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
if (![self isItemExpanded:theItem])
{
var parent = [self parentForItem:theItem],
shouldSelect = parent && SHOULD_SELECT_ITEM(self, parent);
shouldSelect = parent && SELECTION_SHOULD_CHANGE(self) && SHOULD_SELECT_ITEM(self, parent);
if (shouldSelect)
{
var rowIndex = [self rowForItem:parent];
Expand Down Expand Up @@ -1843,6 +1845,11 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
return SHOULD_SELECT_ITEM(_outlineView, [_outlineView itemAtRow:theRow]);
}

- (BOOL)selectionShouldChangeInTableView:(CPTableView)theTableView
{
return SELECTION_SHOULD_CHANGE(_outlineView);
}

- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aColumn row:(int)aRow
{
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldEditTableColumn_item_))
Expand Down

0 comments on commit f50802b

Please sign in to comment.