• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to make an NSWindow unmovable...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to make an NSWindow unmovable...


  • Subject: Re: how to make an NSWindow unmovable...
  • From: Eric Brunstad <email@hidden>
  • Date: Sun, 12 Jun 2005 21:54:14 -0400

On Jun 12, 2005, at 9:43 PM, Philip George wrote:

thanks. i'm getting reeeeeally close. now, instead of pinstripes, everything that should be clear is jet black.

to keep it simple, i'm just using one picture here, but otherwise this is the exact code.

can you see the problem?



@interface XXXWindowBackgroundView : NSView { NSImage * window_template; }
@end
@implementation XXXWindowBackgroundView
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self) {
window_template = [[NSImage alloc] initWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"win_template" ofType:@"png"]];
}
return self;
}
- (void)drawRect:(NSRect)rect {
[[NSColor clearColor] set];
NSRectFill([self frame]);
[window_template compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
[[self window] setHasShadow:NO];
[[self window] setHasShadow:YES];
}
@end


@interface XXXWindow : NSWindow { XXXWindowBackgroundView * content_view; }
- (id)initWithFrame:(NSRect)frameRect;
@end
@implementation XXXWindow
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithContentRect:frameRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
if (self) {
content_view = [[XXXWindowBackgroundView alloc] initWithFrame:frameRect];
[self setContentView:content_view];
[self setBackgroundColor:[NSColor clearColor]];
[self setOpaque:NO];
[self setHasShadow:YES];
}


    return self;
}
@end

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mindsprockets.com


This email sent to email@hidden



You may want to remove
[[NSColor clearColor] set];
NSRectFill([self frame]);
in XXXWindowBackgroundView becuase one of the limitations of NSRectFill, at least in my experience, is that it does not handle transparency too well. In the past, this has resulted in a black background for me too.


Also change

[[self window] setHasShadow:NO];
[[self window] setHasShadow:YES];

to

[[self window] invalidateShadow]

(it looks better)

-Eric
_______________________________________________
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


  • Follow-Ups:
    • Re: how to make an NSWindow unmovable...
      • From: Philip George <email@hidden>
  • Prev by Date: Re: how to make an NSWindow unmovable...
  • Next by Date: Re: how to make an NSWindow unmovable...
  • Previous by thread: Re: how to make an NSWindow unmovable...
  • Next by thread: Re: how to make an NSWindow unmovable...
  • Index(es):
    • Date
    • Thread