Re: Minimal cocoa application
Re: Minimal cocoa application
- Subject: Re: Minimal cocoa application
- From: Joshua Orr <email@hidden>
- Date: Thu, 8 Mar 2007 08:29:31 -0700
On Mar 8, 2007, at 7:23 AM, John C. Randolph wrote:
On Mar 8, 2007, at 3:14 AM, Godwin, Mark R wrote:
What I would like to know is, what is the absolute minimum I need
to do
to create a window in Cocoa, and fill it with, for instance, a
WebView?
// theScreen Is a NSScreen instance, indicating which monitor to put
the window on...
screenRect = [theScreen frame];
screenRect.origin.x = 0;
screenRect.origin.y = 0;
// Here you can choose various options when you make your window,
including what screen it will show up on (if there are multiple
monitors attached)...
mainWindow = [[NSWindow alloc] initWithContentRect:screenRect//
NSMakeRect(20, 500, 400, 400)//screenRect
styleMask:NSBorderlessWindowMask //
NSTitledWindowMask// NSBorderlessWindowMask
backing:NSBackingStoreBuffered //
NSBackingStoreRetained //NSBackingStoreBuffered
defer:NO screen:theScreen /*
[NSScreen mainScreen]*/];
// Set the background color if you want...
[mainWindow setBackgroundColor:[NSColor blackColor]];
// set the window level if needed (I do this for a full screen app
that always has to be above everything else)...
[mainWindow setLevel:CGShieldingWindowLevel()];
// Bring the window up...
[mainWindow makeKeyAndOrderFront:nil];
// Set the content view, in this case I am using a custom movie view
subclass instance...
[mainWindow setContentView:[self returnNewMovieView]];
This is sort of ruff, but gives you a start at least.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden