Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void make_cocoa_window()
- {
- NSApplication *app = [NSApplication sharedApplication];
- [app setActivationPolicy: NSApplicationActivationPolicyRegular];
- NSMenu *menu_bar = [[NSMenu alloc] init];
- NSMenuItem *app_menu_item = [[NSMenuItem alloc] init];
- [menu_bar addItem:app_menu_item];
- app.mainMenu = menu_bar;
- NSMenu *app_menu = [[NSMenu alloc] init];
- NSMenuItem *quit_menu_item = [[NSMenuItem alloc] initWithTitle:@"Quit"
- action:@selector(terminate:)
- keyEquivalent:@"q"];
- [app_menu addItem:quit_menu_item];
- [app_menu_item setSubmenu:app_menu];
- [app activateIgnoringOtherApps:YES];
- NSWindow *window = nil;
- NSRect contentRet = NSMakeRect(0, 0, 1025, 768);
- { // create window
- window = [[NSWindow alloc] initWithContentRect:contentRet
- styleMask:NSTitledWindowMask
- backing:NSBackingStoreBuffered
- defer:NO
- screen:nil];
- [window cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
- [window setTitle:@"Lol Window"];
- }
- // show window
- [window makeKeyAndOrderFront:nil];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement