Re: NSTableView highlited text color
Re: NSTableView highlited text color
- Subject: Re: NSTableView highlited text color
- From: Andre Masse <email@hidden>
- Date: Thu, 06 Nov 2008 08:17:55 -0500
Thanks for the idea,
Andre Masse
On Nov 5, 2008, at 21:38, Dave Fernandes wrote:
As yet another way to do this, you can subclass the NSTableView and
override drawRow: clipRect:
Here's my code to give a background color to expandable rows in an
outline view (like in Mail.app).
// Override to draw expandable rows with background color.
- (void)drawRow:(int)rowIndex clipRect:(NSRect)clipRect
{
id item = [self itemAtRow:rowIndex];
if ([self isExpandable:item] && [self selectedRow] != [self
rowForItem:item])
{
NSRect cellRect = [self rectOfRow:rowIndex];
[[NSColor colorWithCalibratedHue:216./360. saturation:0.16
brightness:0.95 alpha:1.] set];
[NSBezierPath fillRect:cellRect];
[[NSColor gridColor] set];
NSBezierPath* outline = [NSBezierPath bezierPath];
NSPoint point = NSMakePoint(cellRect.origin.x, cellRect.origin.y);
[outline moveToPoint:point];
point.x += cellRect.size.width;
[outline lineToPoint:point];
[outline setLineWidth:1.];
[outline stroke];
}
[super drawRow:rowIndex clipRect:clipRect];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden