Higlight selection in NSOutlineView
Hi everybody,
I want to highlight selected rows with a tranparent image instead of colors.
Here's the code:
- (void)highlightSelectionInClipRect:(NSRect)theClipRect
{
NSRange aVisibleRowIndexes = [self rowsInRect:theClipRect];
NSIndexSet * aSelectedRowIndexes = [self selectedRowIndexes];
int aRow = aVisibleRowIndexes.location;
int anEndRow = aRow + aVisibleRowIndexes.length;
for (aRow; aRow < anEndRow; aRow++)
{
if([aSelectedRowIndexes containsIndex:aRow])
{
NSRect aRowRect = NSInsetRect([self rectOfRow:aRow], 2, 1);
NSImage * anIcon = [NSImage imageNamed:@"HighligthSelection"];
[anIcon setFlipped:YES];
[anIcon setSize:aRowRect.size];
[anIcon drawAtPoint:aRowRect.origin fromRect:aRowRect operation:NSCompositeSourceOver fraction:1.0];
}
}
}
It does work for the first row of my NSOutlineView, but if I selected another one the image doesn't appear ...
Any idea ?