- (void)menuShouldOpen
{
NSPoint viewLocation = [self frame].origin;
viewLocation.y = viewLocation.y + 12;
[NSMenu popUpContextMenu:objectMenu withEvent:[NSEvent
mouseEventWithType:NSLeftMouseDown location:viewLocation
modifierFlags:0 timestamp:1 windowNumber:[[NSApp mainWindow]
windowNumber] context:[NSGraphicsContext currentContext]
eventNumber:1 clickCount:1 pressure:0.0] forView:self];
}
- (void)mouseDown:(NSEvent *)event
{
[self setPressed:YES];
[self setNeedsDisplay:YES];
[self performSelector:@selector(menuShouldOpen)];
}
- (void)mouseUp:(NSEvent *)event
{
[self setPressed:NO];
[self setNeedsDisplay:YES];
}