|
@@ -1,14 +1,24 @@ |
|
|
#import <Cocoa/Cocoa.h> |
|
|
#import <Cocoa/Cocoa.h> |
|
|
#import "main.h" |
|
|
#import "main.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main() { |
|
|
int main() { |
|
|
// https://stackoverflow.com/questions/30269329/creating-window-application-in-pure-c-on-mac-osx |
|
|
// https://stackoverflow.com/questions/30269329/creating-window-application-in-pure-c-on-mac-osx |
|
|
@autoreleasepool { |
|
|
@autoreleasepool { |
|
|
[NSApplication sharedApplication]; |
|
|
[NSApplication sharedApplication]; |
|
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; |
|
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; |
|
|
id applicationName = [[NSProcessInfo processInfo] processName]; |
|
|
id applicationName = [[NSProcessInfo processInfo] processName]; |
|
|
id window = [[NSWindow alloc] initWithContentRect:NSMakeRect(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT) |
|
|
|
|
|
styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:NO]; |
|
|
|
|
|
|
|
|
id window = [ |
|
|
|
|
|
[NSWindow alloc] |
|
|
|
|
|
initWithContentRect: NSMakeRect(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT) |
|
|
|
|
|
styleMask: |
|
|
|
|
|
NSWindowStyleMaskTitled |
|
|
|
|
|
| NSWindowStyleMaskClosable |
|
|
|
|
|
| NSWindowStyleMaskMiniaturizable |
|
|
|
|
|
| NSWindowStyleMaskResizable |
|
|
|
|
|
backing:NSBackingStoreBuffered |
|
|
|
|
|
defer:NO |
|
|
|
|
|
]; |
|
|
[window cascadeTopLeftFromPoint:NSMakePoint(20, 20)]; |
|
|
[window cascadeTopLeftFromPoint:NSMakePoint(20, 20)]; |
|
|
[window setTitle:applicationName]; |
|
|
[window setTitle:applicationName]; |
|
|
[window makeKeyAndOrderFront:nil]; |
|
|
[window makeKeyAndOrderFront:nil]; |
|
|