NSOutlineView Row Selection Color
NSOutlineView Row Selection Color
- Subject: NSOutlineView Row Selection Color
- From: haym37 <email@hidden>
- Date: Sun, 5 Feb 2006 00:24:48 -0500
After reading much about how to customize the color of the selected
row in an NSOutlineView, I am still unable to get it to work. Here's
what I have:
- LeftMenuController.h which is a subclass of NSOutlineView
- LeftMenuController.m which contains the following code:
- (id)_highlightColorForCell:(NSCell *)cell
{
NSLog(@"here");
return nil;
}
- (void)highlightSelectionInClipRect:(NSRect)clipRect
{
NSLog(@"here");
if (selectedRow != -1)
{
[outlineView lockFocus];
NSImage *gradientHighlight;
if(([[outlineView window] firstResponder] == outlineView) &&
[[outlineView window] isMainWindow] && [[outlineView window]
isKeyWindow])
{
gradientHighlight = [NSImage
imageNamed:@"LeftMenuRowHighlightFocused.png"];
}
else
{
gradientHighlight = [NSImage
imageNamed:@"LeftMenuRowHighlightUnFocus.png"];
}
[gradientHighlight setFlipped:NO];
[gradientHighlight setScalesWhenResized:YES];
NSRect drawingRect = [outlineView rectOfRow:selectedRow];
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [gradientHighlight size];
if(drawingRect.size.width != 0 && drawingRect.size.height != 0)
{
[gradientHighlight drawInRect:drawingRect fromRect:imageRect
operation:NSCompositeSourceOver fraction:1.0];
}
[outlineView unlockFocus];
}
}
In Interface Builder, I have LeftMenuController as the dataSource and
delegate of the NSOutlineView.
Still, when selecting a row in the NSOutlineView, rather than
displaying the background as the LeftMenuRowHighlightFocused.png
gradient, it still displays it as the standard dark blue.
Is there another thing that I should be doing to have it work? Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden