2 // PBUnsortableTableHeader.m
5 // Created by Pieter de Bie on 03-10-08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
9 #import "PBUnsortableTableHeader.h"
12 @implementation PBUnsortableTableHeader
14 - (void)mouseDown:(NSEvent *)theEvent
16 NSPoint location = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:[[self window] contentView]];
17 int aColumnIndex = [self columnAtPoint:location];
19 // If the user pressed on another column, reset
20 if (aColumnIndex != columnIndex)
23 columnIndex = aColumnIndex;
24 [super mouseDown:theEvent];
28 // On the third click, reset the sorting and
29 // Don't pass on the click
30 if (++clickCount == 3)
33 controller.sortDescriptors = [NSArray array];
34 [controller rearrangeObjects];
37 [super mouseDown:theEvent];