NSTableHeaderCell Woes...
NSTableHeaderCell Woes...
- Subject: NSTableHeaderCell Woes...
- From: Julian <email@hidden>
- Date: Tue, 6 Dec 2005 23:26:29 -0500
Hi all,
OK, I have sub-classed NSTableHeaderCell so that I can draw a metal
background along with metal text black with white shadow. This is all
fine and dandy, however one problem persists and I do not see why.
The last thing i am doing is drawing the column Separator. This works
fine for the first column but no any column after index:0.
Here is my drawing code, any help would be grateful....
Screenshot:
http://www.0xa9.com//wp-content/Picture7.png
- (void)drawWithFrame:(NSRect)frame inView:(NSView*)inView {
NSRect tempSrc = NSZeroRect;
NSRect tempDst = frame;
// Draw _metalBacking along width of frame.
tempSrc.origin.y = 0.0;
tempSrc.size.height = [_metalBacking size].height + 2.0;
tempDst.origin.y -= 2.0;
tempDst.size.height = frame.size.height + 2.0;
[_metalBacking drawInRect:tempDst
fromRect:tempSrc
operation:NSCompositeSourceOver
fraction:1.0];
// Draw white text centered.
float offset = 0.5;
[_attributes setValue:[NSColor colorWithCalibratedWhite:1.0
alpha:0.7]
forKey:@"NSColor"];
NSRect centeredRect = frame;
centeredRect.size = [[self stringValue]
sizeWithAttributes:_attributes];
centeredRect.origin.x +=
((frame.size.width - centeredRect.size.width) / 2.0) - offset;
centeredRect.origin.y =
((frame.size.height - centeredRect.size.height) / 2.0) +
offset;
[[self stringValue] drawInRect:centeredRect
withAttributes:_attributes];
centeredRect.origin.y -= offset;
[[self stringValue] drawInRect:centeredRect
withAttributes:_attributes];
// Draw the column divider.
[[NSColor darkGrayColor] set];
NSRect _dividerRect = NSMakeRect(frame.size.width - 1, 0,
1,frame.size.height);
NSRectFill(_dividerRect);
}
~Julian
_______________________________________________
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