|
@@ -1,15 +1,34 @@ |
|
|
#import <Cocoa/Cocoa.h> |
|
|
#import <Cocoa/Cocoa.h> |
|
|
|
|
|
#import "main.h" |
|
|
|
|
|
|
|
|
|
|
|
void* CBR_CreateWindow(CBR_CreateWindowParams params) { |
|
|
|
|
|
id window = [ |
|
|
|
|
|
[NSWindow alloc] initWithContentRect:NSMakeRect(params.rect.x, params.rect.y, params.rect.width, params.rect.height) |
|
|
|
|
|
styleMask: (NSWindowStyleMask)params.style_flags |
|
|
|
|
|
backing:NSBackingStoreBuffered |
|
|
|
|
|
defer:NO |
|
|
|
|
|
]; |
|
|
|
|
|
[window cascadeTopLeftFromPoint:NSMakePoint(0,0)]; |
|
|
|
|
|
[window setTitle: [NSString stringWithUTF8String:(params.title)]]; |
|
|
|
|
|
[window makeKeyAndOrderFront:nil]; |
|
|
|
|
|
return (__bridge void *)(window); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int main() { |
|
|
int main() { |
|
|
@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(0, 0, 120, 120) |
|
|
|
|
|
styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:NO]; |
|
|
|
|
|
[window cascadeTopLeftFromPoint:NSMakePoint(20,20)]; |
|
|
|
|
|
[window setTitle: applicationName]; |
|
|
|
|
|
[window makeKeyAndOrderFront:nil]; |
|
|
|
|
|
|
|
|
void* window = CBR_CreateWindow((CBR_CreateWindowParams) { |
|
|
|
|
|
.rect = { |
|
|
|
|
|
.x = WINDOW_X, |
|
|
|
|
|
.y = WINDOW_Y, |
|
|
|
|
|
.width = WINDOW_WIDTH, |
|
|
|
|
|
.height = WINDOW_HEIGHT |
|
|
|
|
|
}, |
|
|
|
|
|
.style_flags = CBR_WINDOW_STYLE_FLAG_TITLED, |
|
|
|
|
|
.title = [applicationName cStringUsingEncoding:NSUTF8StringEncoding] |
|
|
|
|
|
}); |
|
|
[NSApp activateIgnoringOtherApps:YES]; |
|
|
[NSApp activateIgnoringOtherApps:YES]; |
|
|
[NSApp run]; |
|
|
[NSApp run]; |
|
|
} |
|
|
} |
|
|