NSDrawerFrame, NSDrawerWindow and transparency
NSDrawerFrame, NSDrawerWindow and transparency
- Subject: NSDrawerFrame, NSDrawerWindow and transparency
- From: René van Amerongen <email@hidden>
- Date: Mon, 13 Nov 2006 17:10:58 +0100
Hi
I have made a while ago a subclass of NSDrawer, NSDrawerWindow to
draw a transparent background the same as the parent window.
This works, ... so far, so good.
Now I would need to use a pattern color as background and a
transparant NSDrawerFrame
I have a few issues,
1. Bevel border drawer not transparent
How can I get the border of a drawer transparent? Or a at least give
a color pattern?
I will start drawing my own transparent border if it is not possible
to get the standard border transparent, but then I discovered the
next problem.
2. With no standard border
when I open the drawer the first time with a 100% transparent
background, the background of the Drawer isn't 100% transparent. When
I open it a second time it is. This issue happens only when I don't
let the subclass of NSDrawerFrame draw the bevel inside - (void)
drawRect:(NSRect)rect. If I call [super drawRect:rect]; or draw the
bevel with [self drawBevel:rect]; it's ok. On both times I can click
trough the background.
// inside subClass of NSDrawerFrame
- (void)drawRect:(NSRect)rect
{
[[self backgroundCollor] set]; // pattern
NSRectFill(rect);
// [self drawBevel:rect]; // bevel not transparant, but background
draws transparency correct
// [super drawRect:rect]; // draws the ResizeIndicator, and I don't
need that. + bevel not transparent
}
I guess I could try to override super drawBevel:rect with a
categorized empty drawBevel:rec.
Also the first time the drawer view has rounded edges, but the second
time not. De shadow has always the rounded corners.
Just toggled the drawer close and open.
Someone does have experience with this ?
3. With transparent pattern as color
when I use a pattern color with
//NSColor *backgroundColor exists;
NSImage * lPatternImage = [[[NSApplication sharedApplication]
delegate] patternImage]; // get(ter) a copy of the pattern
[lPatternImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:
NSImageInterpolationHigh];
[lPatternImage setSize:NSMakeSize (1.0, [self
frame].size.height )]; // [self frame] depending in what subclass
[lPatternImage unlockFocus];
backgroundColor = [[NSColor colorWithPatternImage:lPatternImage]
retain];
al the backgrounds are drawn ok ( except the Drawer border has no
pattern ).
if I use backgroundColor = [[[NSColor
colorWithPatternImage:lPatternImage] colorWithAlphaComponent:0.5f ]]
retain];
then the background of the drawer is black. I guess transparent with
no color. The subClassed NSDrawerWindow is set as not opaque.
Someone has dealt with this before?
Any info would be welcome!
Cheers
-- R v Amerongen
_______________________________________________
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