Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 40 lines (33 sloc) 0.876 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//
// PBUnsortableTableHeader.m
// GitX
//
// Created by Pieter de Bie on 03-10-08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "PBUnsortableTableHeader.h"


@implementation PBUnsortableTableHeader

- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint location = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:[[self window] contentView]];
int aColumnIndex = [self columnAtPoint:location];

// If the user pressed on another column, reset
if (aColumnIndex != columnIndex)
{
clickCount = 1;
columnIndex = aColumnIndex;
[super mouseDown:theEvent];
return;
}

// On the third click, reset the sorting and
// Don't pass on the click
if (++clickCount == 3)
{
clickCount = 0;
controller.sortDescriptors = [NSArray array];
[controller rearrangeObjects];
return;
}
[super mouseDown:theEvent];
}
@end
Something went wrong with that request. Please try again.