Hello developers around the world :) Today I have a question about the NSOutlineView customisation, the environment is: -OS X 10.7+ - an Outline view with subclassed NSTextFieldCell
the problem: I want customise the colour end the gradient for the cell selection, my first approach was override the method
-(NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
in the NSTextFieldCell subclass, but the result is this:
The gradient selection still remain blu and the label background become to the returned colour. How to change the entire cell selection colour (with the gradient?)
UPDATE:
After subclassing the NSOutlineView and override the method:
- (void)highlightSelectionInClipRect:(NSRect)clipRect
{
NSRange aVisibleRowIndexes = [self rowsInRect:clipRect];
NSIndexSet * aSelectedRowIndexes = [self selectedRowIndexes];
NSUInteger aRow = aVisibleRowIndexes.location;
NSUInteger anEndRow = aRow + aVisibleRowIndexes.length;
NSColor *aColor = MW_MENU_SELECTED_CELL_GB;
[aColor set];
// draw highlight for the visible, selected rows
for (aRow; aRow < anEndRow; aRow++)
{
if([aSelectedRowIndexes containsIndex:aRow])
{
NSRect aRowRect = NSInsetRect([self rectOfRow:aRow], 2, 1);
NSRectFill(aRowRect);
}
}
}
Now I have the right behaviour, but without gradient, how to add the gradient (or a background image to the cell?)