mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-21 19:01:18 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@7817 72102866-910b-0410-8b05-ffd578937521
106 lines
2.8 KiB
Objective-C
106 lines
2.8 KiB
Objective-C
/* $Id$ */
|
|
|
|
#import <AppKit/AppKit.h>
|
|
#import "AppController.h"
|
|
|
|
#define APP_NAME @"GNUstep"
|
|
|
|
/*
|
|
* Create the application's menu
|
|
*/
|
|
|
|
void createMenu();
|
|
|
|
/*
|
|
* Initialise and go!
|
|
*/
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
NSApplication *theApp;
|
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
AppController *controller;
|
|
|
|
#ifndef NX_CURRENT_COMPILER_RELEASE
|
|
initialize_gnustep_backend();
|
|
#endif
|
|
|
|
theApp = [NSApplication sharedApplication];
|
|
|
|
createMenu();
|
|
|
|
controller = [[AppController alloc] init];
|
|
[theApp setDelegate:controller];
|
|
|
|
/*
|
|
* Go...
|
|
*/
|
|
|
|
[theApp run];
|
|
|
|
/*
|
|
* ...and finish!
|
|
*/
|
|
|
|
RELEASE(controller);
|
|
RELEASE(pool);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void createMenu()
|
|
{
|
|
NSMenu *menu;
|
|
NSMenu *info;
|
|
NSMenu *edit;
|
|
NSMenu *services;
|
|
NSMenu *windows;
|
|
|
|
SEL action = @selector(method:);
|
|
|
|
menu = [[NSMenu alloc] initWithTitle:APP_NAME];
|
|
|
|
[menu addItemWithTitle:@"Info" action:@selector(showInfoPanel:) keyEquivalent:@""];
|
|
[menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""];
|
|
[menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""];
|
|
[menu addItemWithTitle:@"Services" action:action keyEquivalent:@""];
|
|
[menu addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"];
|
|
[menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
|
|
|
|
info = AUTORELEASE([[NSMenu alloc] init]);
|
|
[menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]];
|
|
[info addItemWithTitle:@"Info Panel..." action:@selector(showInfoPanel:) keyEquivalent:@""];
|
|
[info addItemWithTitle:@"Preferences" action:@selector(showPrefPanel:) keyEquivalent:@""];
|
|
[info addItemWithTitle:@"Help" action:action keyEquivalent:@"?"];
|
|
|
|
edit = AUTORELEASE([[NSMenu alloc] init]);
|
|
[edit addItemWithTitle:@"Cut" action:action keyEquivalent:@"x"];
|
|
[edit addItemWithTitle:@"Copy" action:action keyEquivalent:@"c"];
|
|
[edit addItemWithTitle:@"Paste" action:action keyEquivalent:@"v"];
|
|
[edit addItemWithTitle:@"Delete" action:action keyEquivalent:@""];
|
|
[edit addItemWithTitle:@"Select All" action:action keyEquivalent:@"a"];
|
|
[menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]];
|
|
|
|
windows = AUTORELEASE([[NSMenu alloc] init]);
|
|
[windows addItemWithTitle:@"Arrange"
|
|
action:@selector(arrangeInFront:)
|
|
keyEquivalent:@""];
|
|
[windows addItemWithTitle:@"Miniaturize"
|
|
action:@selector(performMiniaturize:)
|
|
keyEquivalent:@"m"];
|
|
[windows addItemWithTitle:@"Close"
|
|
action:@selector(performClose:)
|
|
keyEquivalent:@"w"];
|
|
[menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]];
|
|
|
|
services = AUTORELEASE([[NSMenu alloc] init]);
|
|
[menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]];
|
|
|
|
[[NSApplication sharedApplication] setMainMenu:menu];
|
|
[[NSApplication sharedApplication] setServicesMenu: services];
|
|
|
|
[menu update];
|
|
[menu display];
|
|
}
|
|
|
|
|
|
|