2015-07-31 21:33:49 -05:00
|
|
|
// 31 july 2015
|
|
|
|
#import "osxaltest.h"
|
|
|
|
|
2015-08-01 11:43:54 -05:00
|
|
|
// #qo LDFLAGS: -framework Foundation -framework AppKit
|
|
|
|
|
2015-07-31 21:33:49 -05:00
|
|
|
@interface appDelegate : NSObject<NSApplicationDelegate>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation appDelegate
|
|
|
|
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
|
|
|
{
|
2015-08-01 11:43:54 -05:00
|
|
|
NSWindow *mainwin;
|
|
|
|
tWindowDelegate *delegate;
|
|
|
|
|
|
|
|
mainwin = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 320, 240)
|
|
|
|
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
|
|
|
|
backing:NSBackingStoreBuffered
|
|
|
|
defer:YES];
|
|
|
|
[mainwin setTitle:@"Auto Layout Test"];
|
|
|
|
|
|
|
|
delegate = [tWindowDelegate new];
|
|
|
|
[mainwin setDelegate:delegate];
|
|
|
|
|
|
|
|
[mainwin cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
|
|
|
|
[mainwin makeKeyAndOrderFront:self];
|
2015-07-31 21:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
NSApplication *app;
|
|
|
|
|
|
|
|
app = [NSApplication sharedApplication];
|
|
|
|
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
|
|
[app setDelegate:[appDelegate new]];
|
|
|
|
[app run];
|
|
|
|
return 0;
|
|
|
|
}
|