History fileview: select current item on rightclick

This commit is contained in:
Pieter de Bie
2009-03-29 00:46:18 +00:00
committed by Pieter de Bie
parent ad2213ce2f
commit d04362ba82
+19
View File
@@ -58,6 +58,25 @@
return fileNames;
}
- (NSMenu *)menuForEvent:(NSEvent *)theEvent
{
if ([theEvent type] == NSRightMouseDown)
{
// get the current selections for the outline view.
NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
// select the row that was clicked before showing the menu for the event
NSPoint mousePoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
int row = [self rowAtPoint:mousePoint];
// figure out if the row that was just clicked on is currently selected
if ([selectedRowIndexes containsIndex:row] == NO)
[self selectRow:row byExtendingSelection:NO];
}
return [super menuForEvent:theEvent];
}
/* Implemented to satisfy datasourcee protocol */
- (BOOL) outlineView: (NSOutlineView *)ov
isItemExpandable: (id)item { return NO; }