Guest User

Untitled

a guest
Apr 26th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. @implementation IconViewBox
  2.  
  3. // -------------------------------------------------------------------------------
  4. // hitTest:aPoint
  5. // -------------------------------------------------------------------------------
  6. - (NSView *)hitTest:(NSPoint)aPoint
  7. {
  8. // don't allow any mouse clicks for subviews in this view
  9. if(NSPointInRect(aPoint,[self convertRect:[self bounds] toView:[self superview]])) {
  10. return self;
  11. } else {
  12. return nil;
  13. }
  14. }
  15.  
  16. -(void)mouseDown:(NSEvent *)theEvent {
  17. [super mouseDown:theEvent];
  18.  
  19. // check for click count above one, which we assume means it's a double click
  20. if([theEvent clickCount] > 1) {
  21. NSLog(@"double click!");
  22. if(delegate && [delegate respondsToSelector:@selector(doubleClick:)]) {
  23. [delegate performSelector:@selector(doubleClick:) withObject:self];
  24. }
  25. }
  26. }
  27.  
  28. @end
Add Comment
Please, Sign In to add comment