aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.m
diff options
context:
space:
mode:
authorTeddy Wing2023-08-14 02:02:49 +0200
committerTeddy Wing2023-08-14 02:02:49 +0200
commit5d242798e7a343b2012dca16e8d22af957205f93 (patch)
tree6475e355a6def39d3a5172d7e1d39abcb6b78503 /src/main.m
parent70b8d569190c7a54f0dc0e2cd11ead6577caa840 (diff)
downloadBase-Windowed-Application-5d242798e7a343b2012dca16e8d22af957205f93.tar.bz2
Add an NSApplicationDelegate
Move the window creation to a separate class, and also allow us to take advantage of `NSApplicationDelegate` protocol methods.
Diffstat (limited to 'src/main.m')
-rw-r--r--src/main.m14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main.m b/src/main.m
index bc5e385..c7dac1b 100644
--- a/src/main.m
+++ b/src/main.m
@@ -2,6 +2,8 @@
#import <Cocoa/Cocoa.h>
+#import "AppDelegate.h"
+
int main() {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -22,19 +24,11 @@ int main() {
[application setMainMenu:menubar];
- NSWindow *window = [[NSWindow alloc]
- initWithContentRect:NSMakeRect(0, 0, 400, 400)
- styleMask:NSWindowStyleMaskTitled
- backing:NSBackingStoreBuffered
- defer:NO];
-
- [window setTitle:@"Application"];
- [window cascadeTopLeftFromPoint:NSMakePoint(100, 100)];
- [window makeKeyAndOrderFront:nil];
+ NSObject<NSApplicationDelegate> *app_delegate = [[AppDelegate alloc] init];
+ [application setDelegate:app_delegate];
[application run];
- [window release];
[quit_menu_item release];
[application_menu release];
[application_menu_item release];