No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / examples / hello-objc-gnustep / main.m
blob2abf2931d30cb6ea92cd4b9ce20ce2b666a7583a
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.  */
13 static void
14 createMenu ()
16   NSMenu *menu;
17   NSMenu *info;
18   NSMenu *edit;
19   NSMenu *services;
20   NSMenu *windows;
22   SEL action = @selector(method:);
24   menu = [[NSMenu alloc] initWithTitle: APP_NAME];
25   [menu addItemWithTitle: @"Info"
26         action: action
27         keyEquivalent: @""];
28   [menu addItemWithTitle: @"Edit"
29         action: action
30         keyEquivalent: @""];
31   [menu addItemWithTitle: @"Hello..."
32         action: @selector(showHelloWindow:)
33         keyEquivalent: @""];
34   [menu addItemWithTitle: @"Windows"
35         action: action
36         keyEquivalent: @""];
37   [menu addItemWithTitle: @"Services"
38         action: action
39         keyEquivalent: @""];
40   [menu addItemWithTitle: @"Hide"
41         action: @selector(hide:)
42         keyEquivalent: @"h"];
43   [menu addItemWithTitle: @"Quit"
44         action: @selector(terminate:)
45         keyEquivalent: @"q"];
47   info = AUTORELEASE ([[NSMenu alloc] init]);
48   [info addItemWithTitle: @"Info Panel..."
49         action: @selector(showInfoPanel:)
50         keyEquivalent: @""];
51   [info addItemWithTitle: @"Preferences"
52         action: @selector(showPrefPanel:)
53         keyEquivalent: @""];
54   [info addItemWithTitle: @"Help"
55         action: action
56         keyEquivalent: @"?"];
57   [menu setSubmenu: info forItem: [menu itemWithTitle: @"Info"]];
59   edit = AUTORELEASE ([[NSMenu alloc] init]);
60   [edit addItemWithTitle: @"Cut"
61         action: @selector(cut:)
62         keyEquivalent: @"x"];
63   [edit addItemWithTitle: @"Copy"
64         action: @selector(copy:)
65         keyEquivalent: @"c"];
66   [edit addItemWithTitle: @"Paste"
67         action: @selector(paste:)
68         keyEquivalent: @"v"];
69   [edit addItemWithTitle: @"Delete"
70         action: @selector(delete:)
71         keyEquivalent: @""];
72   [edit addItemWithTitle: @"Select All"
73         action: @selector(selectAll:)
74         keyEquivalent: @"a"];
75   [menu setSubmenu: edit forItem: [menu itemWithTitle: @"Edit"]];
77   windows = AUTORELEASE ([[NSMenu alloc] init]);
78   [windows addItemWithTitle: @"Arrange"
79            action: @selector(arrangeInFront:)
80            keyEquivalent: @""];
81   [windows addItemWithTitle: @"Miniaturize"
82            action: @selector(performMiniaturize:)
83            keyEquivalent: @"m"];
84   [windows addItemWithTitle: @"Close"
85            action: @selector(performClose:)
86            keyEquivalent: @"w"];
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!  */
98 int
99 main(int argc, const char *argv[])
101   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
102   AppController *controller;
104   [NSApplication sharedApplication];
106   createMenu ();
108   controller = [[AppController alloc] init];
109   [NSApp setDelegate:controller];
111   RELEASE (pool);
113   return NSApplicationMain (argc, argv);