3 #include <Cocoa/Cocoa.h> 26 NSMenu *
const mainMenu = [[NSMenu alloc] initWithTitle :
@"NSMainMenu"];
31 NSMenuItem *menuItem = [mainMenu addItemWithTitle :
@"Apple" action : nil keyEquivalent:
@""];
32 NSMenu *submenu = [[NSMenu alloc] initWithTitle :
@"Apple"];
36 [mainMenu setSubmenu : submenu forItem : menuItem];
38 menuItem = [mainMenu addItemWithTitle :
@"Window" action : nil keyEquivalent :
@""];
39 submenu = [[NSMenu alloc] initWithTitle : NSLocalizedString(
@"Window",
@"The Window menu")];
42 [mainMenu setSubmenu : submenu forItem : menuItem];
43 [NSApp setWindowsMenu : submenu];
45 menuItem = [mainMenu addItemWithTitle:
@"Help" action:
NULL keyEquivalent:
@""];
46 submenu = [[NSMenu alloc] initWithTitle:NSLocalizedString(
@"Help",
@"The Help menu")];
49 [mainMenu setSubmenu : submenu forItem : menuItem];
51 [NSApp setMainMenu : mainMenu];
52 [NSMenu setMenuBarVisible : YES];
58 assert(aMenu != nil &&
"PopulateApplicationMenu, aMenu parameter is nil");
60 NSString *
const applicationName =
@"root";
62 NSMenuItem *menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat :
@"%@ %@",
63 NSLocalizedString(
@"About", nil), applicationName]
64 action :
@selector(orderFrontStandardAboutPanel:) keyEquivalent :
@""];
65 [menuItem setTarget : NSApp];
66 [aMenu addItem : [NSMenuItem separatorItem]];
68 menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat :
@"%@ %@",
69 NSLocalizedString(
@"Hide", nil), applicationName] action :
@selector(hide:) keyEquivalent :
@"h"];
70 [menuItem setTarget : NSApp];
72 menuItem = [aMenu addItemWithTitle : NSLocalizedString(
@"Hide Others", nil)
73 action :
@selector(hideOtherApplications:) keyEquivalent :
@"h"];
75 [menuItem setTarget : NSApp];
77 menuItem = [aMenu addItemWithTitle : NSLocalizedString(
@"Show All", nil)
78 action :
@selector(unhideAllApplications:) keyEquivalent :
@""];
79 [menuItem setTarget : NSApp];
81 [aMenu addItem : [NSMenuItem separatorItem]];
82 menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat :
@"%@ %@",
83 NSLocalizedString(
@"Quit", nil), applicationName] action :
@selector(terminate:) keyEquivalent :
@"q"];
84 [menuItem setTarget : NSApp];
90 assert(aMenu != nil &&
"PopulateWindowMenu, aMenu parameter is nil");
92 NSMenuItem *menuItem = [aMenu addItemWithTitle : NSLocalizedString(
@"Minimize", nil)
93 action :
@selector(performMinimize:) keyEquivalent :
@"m"];
94 menuItem = [aMenu addItemWithTitle : NSLocalizedString(
@"Zoom", nil)
95 action :
@selector(performZoom:) keyEquivalent :
@""];
96 [aMenu addItem : [NSMenuItem separatorItem]];
97 menuItem = [aMenu addItemWithTitle : NSLocalizedString(
@"Bring All to Front", nil)
98 action :
@selector(arrangeInFront:) keyEquivalent :
@""];
104 NSMenuItem *
const menuItem = [aMenu addItemWithTitle : [NSString stringWithFormat :
@"%@ %@",
@"root",
105 NSLocalizedString(
@"Help", nil)] action :
@selector(showHelp:) keyEquivalent :
@"?"];
106 [menuItem setTarget : NSApp];
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
const NSUInteger kAlternateKeyMask
void PopulateApplicationMenu(NSMenu *submenu)
const NSUInteger kCommandKeyMask
void PopulateWindowMenu(NSMenu *submenu)
void PopulateHelpMenu(NSMenu *submenu)