All pastes #596620 Raw Edit

jjgod

public text v1 · immutable
#596620 ·published 2007-06-30 02:19 UTC
rendered paste body
static int window_create(int width, int height)
{
    NSWindow *window;
    NSRect contentRect;
    unsigned int style;

    contentRect = NSMakeRect(0, 0, width, height);
    style = NSTitledWindowMask | 
    NSMiniaturizableWindowMask | 
          NSClosableWindowMask | 
         NSResizableWindowMask;

    window = [[NSWindow alloc] initWithContentRect:contentRect 
                                         styleMask:style
                                           backing:NSBackingStoreBuffered 
                                             defer:NO];
    [window center];
    [window setViewsNeedDisplay:NO];
    [window setTitle:@"Hello"];
    [window makeKeyAndOrderFront:nil];
    return 1;
}

int main(int argc, const char *argv[])
{       
    NSAutoreleasePool *pool = [NSAutoreleasePool new];

    [NSApplication sharedApplication];
 
    [NSApp setMainMenu:[[NSMenu alloc] init]];
    setApplicationMenu();
    
    window_create(400, 400);

    [pool release];
    [NSApp run];

    return 0;
}