3 #include <Cocoa/Cocoa.h>
25 NSMenu *
const mainMenu = [[NSMenu alloc] initWithTitle : @"NSMainMenu"];
30 NSMenuItem *menuItem = [mainMenu addItemWithTitle : @"Apple" action : nil keyEquivalent:@""];
31 NSMenu *submenu = [[NSMenu alloc] initWithTitle : @"Apple"];
35 [mainMenu setSubmenu : submenu forItem : menuItem];
37 menuItem = [mainMenu addItemWithTitle : @"Window" action : nil keyEquivalent : @""];
38 submenu = [[NSMenu alloc] initWithTitle : NSLocalizedString(@"Window", @"The Window menu")];
41 [mainMenu setSubmenu : submenu forItem : menuItem];
42 [NSApp setWindowsMenu : submenu];
44 menuItem = [mainMenu addItemWithTitle:@"Help" action:NULL keyEquivalent:@""];
45 submenu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Help", @"The Help menu")];
48 [mainMenu setSubmenu : submenu forItem : menuItem];
50 [NSApp setMainMenu : mainMenu];
51 [NSMenu setMenuBarVisible : YES];
57 assert(aMenu != nil &&
"PopulateApplicationMenu, aMenu parameter is nil");
59 NSString *
const applicationName =
@"root";
61 NSMenuItem *menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat : @"%@ %@",
62 NSLocalizedString(@"About", nil), applicationName]
63 action : @selector(orderFrontStandardAboutPanel:) keyEquivalent : @""];
64 [menuItem setTarget : NSApp];
65 [aMenu addItem : [NSMenuItem separatorItem]];
67 menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat : @"%@ %@",
68 NSLocalizedString(@"Hide", nil), applicationName] action : @selector(hide:) keyEquivalent : @"h"];
69 [menuItem setTarget : NSApp];
71 menuItem = [aMenu addItemWithTitle : NSLocalizedString(@"Hide Others", nil)
72 action : @selector(hideOtherApplications:) keyEquivalent : @"h"];
73 [menuItem setKeyEquivalentModifierMask : NSCommandKeyMask | NSAlternateKeyMask];
74 [menuItem setTarget : NSApp];
76 menuItem = [aMenu addItemWithTitle : NSLocalizedString(@"Show All", nil)
77 action : @selector(unhideAllApplications:) keyEquivalent : @""];
78 [menuItem setTarget : NSApp];
80 [aMenu addItem : [NSMenuItem separatorItem]];
81 menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat : @"%@ %@",
82 NSLocalizedString(@"Quit", nil), applicationName] action : @selector(terminate:) keyEquivalent : @"q"];
83 [menuItem setTarget : NSApp];
89 assert(aMenu != nil &&
"PopulateWindowMenu, aMenu parameter is nil");
91 NSMenuItem *menuItem = [aMenu addItemWithTitle : NSLocalizedString(@"Minimize", nil)
92 action : @selector(performMinimize:) keyEquivalent : @"m"];
93 menuItem = [aMenu addItemWithTitle : NSLocalizedString(@"Zoom", nil)
94 action : @selector(performZoom:) keyEquivalent : @""];
95 [aMenu addItem : [NSMenuItem separatorItem]];
96 menuItem = [aMenu addItemWithTitle : NSLocalizedString(@"Bring All to Front", nil)
97 action : @selector(arrangeInFront:) keyEquivalent : @""];
103 NSMenuItem *
const menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat : @"%@ %@", @"root",
104 NSLocalizedString(@"Help", nil)] action : @selector(showHelp:) keyEquivalent : @"?"];
105 [menuItem setTarget : NSApp];
Namespace for new ROOT classes and functions.
void PopulateApplicationMenu(NSMenu *submenu)
void PopulateWindowMenu(NSMenu *submenu)
void PopulateHelpMenu(NSMenu *submenu)