Skip to content

Instantly share code, notes, and snippets.

@jfahrenkrug
Created December 24, 2009 10:46
Show Gist options
  • Save jfahrenkrug/263141 to your computer and use it in GitHub Desktop.
Save jfahrenkrug/263141 to your computer and use it in GitHub Desktop.
@implementation IconViewBox
// -------------------------------------------------------------------------------
// hitTest:aPoint
// -------------------------------------------------------------------------------
- (NSView *)hitTest:(NSPoint)aPoint
{
// don't allow any mouse clicks for subviews in this view
if(NSPointInRect(aPoint,[self convertRect:[self bounds] toView:[self superview]])) {
return self;
} else {
return nil;
}
}
-(void)mouseDown:(NSEvent *)theEvent {
[super mouseDown:theEvent];
// check for click count above one, which we assume means it's a double click
if([theEvent clickCount] > 1) {
NSLog(@"double click!");
if(delegate && [delegate respondsToSelector:@selector(doubleClick:)]) {
[delegate performSelector:@selector(doubleClick:) withObject:self];
}
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment