1
/* Example for use of GNU gettext.
2
Copyright (C) 2003 Free Software Foundation, Inc.
3
This file is in the public domain.
5
Source code of the main program. */
7
#include <AppKit/AppKit.h>
8
#include "AppController.h"
10
#define APP_NAME @"Hello"
12
/* Create the application's menu. */
22
SEL action = @selector(method:);
24
menu = [[NSMenu alloc] initWithTitle: APP_NAME];
25
[menu addItemWithTitle: @"Info"
28
[menu addItemWithTitle: @"Edit"
31
[menu addItemWithTitle: @"Hello..."
32
action: @selector(showHelloWindow:)
34
[menu addItemWithTitle: @"Windows"
37
[menu addItemWithTitle: @"Services"
40
[menu addItemWithTitle: @"Hide"
41
action: @selector(hide:)
43
[menu addItemWithTitle: @"Quit"
44
action: @selector(terminate:)
47
info = AUTORELEASE ([[NSMenu alloc] init]);
48
[info addItemWithTitle: @"Info Panel..."
49
action: @selector(showInfoPanel:)
51
[info addItemWithTitle: @"Preferences"
52
action: @selector(showPrefPanel:)
54
[info addItemWithTitle: @"Help"
57
[menu setSubmenu: info forItem: [menu itemWithTitle: @"Info"]];
59
edit = AUTORELEASE ([[NSMenu alloc] init]);
60
[edit addItemWithTitle: @"Cut"
61
action: @selector(cut:)
63
[edit addItemWithTitle: @"Copy"
64
action: @selector(copy:)
66
[edit addItemWithTitle: @"Paste"
67
action: @selector(paste:)
69
[edit addItemWithTitle: @"Delete"
70
action: @selector(delete:)
72
[edit addItemWithTitle: @"Select All"
73
action: @selector(selectAll:)
75
[menu setSubmenu: edit forItem: [menu itemWithTitle: @"Edit"]];
77
windows = AUTORELEASE ([[NSMenu alloc] init]);
78
[windows addItemWithTitle: @"Arrange"
79
action: @selector(arrangeInFront:)
81
[windows addItemWithTitle: @"Miniaturize"
82
action: @selector(performMiniaturize:)
84
[windows addItemWithTitle: @"Close"
85
action: @selector(performClose:)
87
[menu setSubmenu: windows forItem: [menu itemWithTitle: @"Windows"]];
89
services = AUTORELEASE ([[NSMenu alloc] init]);
90
[menu setSubmenu: services forItem: [menu itemWithTitle: @"Services"]];
92
[[NSApplication sharedApplication] setMainMenu: menu];
93
[[NSApplication sharedApplication] setServicesMenu: services];
94
[[NSApplication sharedApplication] setWindowsMenu: windows];
97
/* Initialise and go! */
99
main(int argc, const char *argv[])
101
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
102
AppController *controller;
104
[NSApplication sharedApplication];
108
controller = [[AppController alloc] init];
109
[NSApp setDelegate:controller];
113
return NSApplicationMain (argc, argv);