NSTableView 内の NSButtonCell を押しても row が選択されないようにする

NSTableView のリファレンスを見るとそのものずばりの事が書いてある

tableView:shouldTrackCell:forTableColumn:row:
For example, this allows you to have an NSButtonCell in a table which does not change the selection, but can still be clicked on and tracked.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html

のだが、やり方がわからない。次のような NSTableView のサブクラスを作るといちおう期待通り動いた。

@interface MyTableView : NSTableView {
  BOOL selectionShouldChange;
}
@end

@implementation MyTableView

- (void)awakeFromNib {
  [self setDelegate:self];
  selectionShouldChange = YES;
}

- (void)mouseDown:(NSEvent *)theEvent {
  NSUInteger column = [self columnAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]];
  selectionShouldChange = (column != 0);  // ボタンが 0 列目の場合
  [super mouseDown:theEvent];
  selectionShouldChange = YES;
}

- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView {
  return selectionShouldChange;
}

- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
  return YES;
}

@end

tableView:shouldTrackCell:forTableColumn:row: は 10.5 以降