Skip to content

Instantly share code, notes, and snippets.

@raphlinus
Created February 18, 2019 19:48
Show Gist options
  • Save raphlinus/5a1b1ef23deafd77a407e98b99fee579 to your computer and use it in GitHub Desktop.
Save raphlinus/5a1b1ef23deafd77a407e98b99fee579 to your computer and use it in GitHub Desktop.
let menubar = NSMenu::new(nil).autorelease();
let app_menu_item = NSMenuItem::new(nil).autorelease();
menubar.addItem_(app_menu_item);
app.setMainMenu_(menubar);
let app_menu = NSMenu::new(nil).autorelease();
let quit_title = make_nsstring("Quit");
let quit_action = selector("terminate:");
let quit_key = make_nsstring("q");
let quit_item = NSMenuItem::alloc(nil)
.initWithTitle_action_keyEquivalent_(quit_title, quit_action, quit_key
)
.autorelease();
app_menu.addItem_(quit_item);
app_menu_item.setSubmenu_(app_menu);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment