Re: NSWindow hax0r
Re: NSWindow hax0r
- Subject: Re: NSWindow hax0r
- From: Charles Jolley <email@hidden>
- Date: Wed, 3 Oct 2001 00:07:00 -0500
Actually, I don't think it does set the entire window's alpha value as
evidenced by the titlebar, scroll bar, and even the text itself
remaining solid while the background of the terminal as translucent.
I have actually tried a few things and found a solution. So here's the
secret if you want to create a window where you can see through parts of
it:
1. When you initialize the window, set the alpha value to just less than
one and isOpaque to NO:
[window setAlphaValue: 0.999] ;
[window setOpaque: NO] ;
2. Add a custom view to your window that will draw with a partially
transparent color. This transparency will actually show through the
window itself. For example, if you create a custom view with the
following drawRect: method and then add it to a window initialized as I
stated above, then the view will display as a "hole" in the window:
- (void)drawRect: (NSRect)rect
{
[[NSColor clearColor] set] ;
NSRectFill([self frame]) ;
}
I have dropped the project I used to test this on my server. Check:
http://www.okito.net/charles/macosx/Quickie.sit
[Note: I'll probably take it off after some time.]
Cheers,
-Charles
On Tuesday, October 2, 2001, at 01:26 AM, Finlay Dobbie wrote:
On Tuesday, October 2, 2001, at 02:00 AM, Dustin Mierau wrote:
I want an NSWindow to have transparent parts but still draw the
standard window controls, is this possible? It would be nice if I
could have controls draw the transparent parts and have the window
draw areas normally that are not transparent.
Actually, the terminal sets the entire window's alpha value (see
-[NSWindow setAlpha])
You can do what you want, yes -- see the RoundTransparentWindow example
at developer.apple.com/samplecode under Cocoa.
-- Finlay
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev