You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dws/ui/AppDelegate.m

73 lines
2.6 KiB
Matlab

#import "AppDelegate.h"
#import "MainWindowController.h"
@implementation AppDelegate
// Application Startup ------------------------------------------------------{{{
- (void) applicationDidFinishLaunching:(NSNotification *)notification {
NSLog(@"[AppDelegate] Application Finished Launching");
8 years ago
[self createMenubar];
[self createMainWindow];
NSLog(@"[AppDelegate] activate NSApp");
[NSApp activateIgnoringOtherApps:YES];
}
// --------------------------------------------------------------------------}}}
// Application Termination --------------------------------------------------{{{
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
NSLog(@"[AppDelegate] applicationShouldTerminate sender: %@", sender);
return NSTerminateNow;
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
NSLog(@"[AppDelegate] applicationShouldTerminateAfterLastWindowClosed sender: %@", sender);
return YES;
}
- (void)applicationWillTerminate:(NSNotification *)notification {
NSLog(@"[AppDelegate] applicationWillTerminate notification sender: %@", notification);
}
// --------------------------------------------------------------------------}}}
// Menu Bar -----------------------------------------------------------------{{{
8 years ago
- (void) createMenubar {
NSLog(@"[AppDelegate] Creating Menubar");
8 years ago
id mainMenu = [[NSMenu alloc] autorelease];
[mainMenu initWithTitle:@"Main Menu"];
[NSApp setMainMenu:mainMenu];
8 years ago
id appMenuItem = [[NSMenuItem alloc] autorelease];
[appMenuItem initWithTitle:@"dws" action:NULL keyEquivalent:@""];
[mainMenu addItem:appMenuItem];
8 years ago
id appMenu = [[NSMenu alloc] autorelease];
[appMenu initWithTitle:@"dws"];
[appMenuItem setSubmenu:appMenu];
8 years ago
id quitMenuItem = [[NSMenuItem alloc] autorelease];
[quitMenuItem initWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
[appMenu addItem:quitMenuItem];
}
// --------------------------------------------------------------------------}}}
8 years ago
// Main Window --------------------------------------------------------------{{{
- (void) createMainWindow {
NSLog(@"[AppDelegate] Creating Main Window");
// TODO: make a singleton? retain in a property of appdelegate?
// MainWindowController *windowController = [[[MainWindowController alloc] init] retain];
MainWindowController *windowController = [[MainWindowController alloc] init];
// NSLog(@"Window loaded: %d", [windowController isWindowLoaded]);
[windowController showWindow:self];
8 years ago
}
// --------------------------------------------------------------------------}}}
@end