Re: NSBox Colour
Re: NSBox Colour
- Subject: Re: NSBox Colour
- From: Oliver Cameron <email@hidden>
- Date: Sat, 6 Dec 2003 10:37:14 +0000
Wow,
Thanks for all the help :-)
Now I know why I joined this list ;-)
Thanks,
Oliver
On 6 Dec 2003, at 10:22, Jens Bauer wrote:
Hi Oliver,
On Saturday, Dec 6, 2003, at 10:24 Europe/Copenhagen, Oliver Cameron
wrote:
Thanks a lot for that code, it does exactly what I want. Now I need
to figure out the RGB value :-)
I'm pleased, that you like it. =)
-Please note: If you use NSRectFill, you will get a solid fill, but
NSRectFillUsingOperation will allow it to be translucent. =)
I believe there's a NSFrameRectUsingOperation as well, which I'm sure
would just draw the outline-box itself, but if you want a title, you
would probably generate a path (draw one line at a time, because it's
faster than adding all and then stroking that rect)...
if(!path) // path would be a member of the GroupView class, so that
we don't waste time initializing it each time.
{
path = [[[NSBezierPath alloc] init] retain];
[path setLineCapStyle:NSRoundLineCapStyle];
[path setLineJoinStyle:NSRoundLineJoinStyle];
[path setMiterLimit:4.0];
}
// repeat the following code for the 4 lines:
[path moveToPoint:pt1];
[path lineToPoint:pt2];
[path stroke]; // Uhm, I don't know if there is a
strokeUsingOperation, check that out.
[path removeAllPoints];
// removing all points is faster than deallocating and reallocating.
If the above doesn't work well, you could construct the 4 lines of
NSRectFillUsingOperation, with heights or widths set to 1 pixel. This
might be easier to overview. =)
- (void)drawRect:(NSRect)rect
{
[[NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.1]
set];
NSRectFillUsingOperation(rect, NSCompositeSourceOver);
}
I would like to change the colour of the default line NSBox, is
this possible without creating a complete replica myself?
Love,
Jens
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.