Re: Drawing Directly onto an NSWindow
Re: Drawing Directly onto an NSWindow
- Subject: Re: Drawing Directly onto an NSWindow
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 2 Dec 2002 11:36:54 -0800
See the "Round Transparent Window" example at
http://developer.apple.com/samplecode/Sample_Code/Cocoa/
RoundTransparentWindow.htm
Just replace the window's contentView with a custom view of your own.
In your custom view class, implement the -mouseDownCanMoveWindow method
to return YES if the titlebar was hit.
-jcr
On Friday, November 29, 2002, at 06:01 AM, mw wrote:
Okay, thanks for the information. However, I don't think that it will
work
for me, given the method cocoa uses to place the image (tiling and
truncating). You see, I need to do this for a custom titlebar on a
borderless window, and the reason I have to draw it directly onto the
window
is so the person can still drag by using the custom titlebar if they so
wish. It seems that the function you are using to set the background is
specifically for pattern images (because patterns are supposed to be
tiled,
etc.). Perhaps there is another function that is specifically geared
toward
non-pattern images?
Thanks again, though.
mw
I put an image of my daughter, named Background.jpg (I renamed it for
the purpose, thank you very much), into the application bundle, and
had
this in the window's controller:
@implementation Controller
- (void) awakeFromNib
{
NSImage * background = [NSImage imageNamed: @"Background"];
[myWindow setBackgroundColor: [NSColor colorWithPatternImage:
background]];
}
@end
The window's background is now the picture of my daughter instead of
the stripes. The image is not scaled; it is rooted to the lower-left
corner; it is truncated if it lacks room, and repeated if there is
room
to spare.
As nothing else happened to the NSWindow, I assume event handling goes
on as before.
-- F
On Thursday, November 28, 2002, at 08:58 AM, mw wrote:
Is there any way to draw an NSImage (retrieved from the main bundle)
directly onto a window so that the window still receives the normal
mouse
events (instead of using an NSView and blocking the window from
getting
events such as mouseEnter and mouseDrag)?
_______________________________________________
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.
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.