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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to