libui/redo/osxaltest/main.m

94 lines
2.5 KiB
Mathematica
Raw Normal View History

// 31 july 2015
#import "osxaltest.h"
// #qo LDFLAGS: -framework Foundation -framework AppKit
BOOL spaced = NO;
BOOL firstvert = YES;
2015-08-01 14:44:06 -05:00
@interface appDelegate : NSObject<NSApplicationDelegate>
@end
@implementation appDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
tWindow *mainwin;
tBox *box, *hbox;
tButton *button;
tSpinbox *spinbox;
tEntry *entry;
mainwin = [[tWindow alloc] init];
[mainwin tSetMargined:spaced];
2015-08-03 10:22:14 -05:00
box = [[tBox alloc] tInitVertical:firstvert spaced:spaced];
2015-08-03 11:16:08 -05:00
/* spinbox = [[tSpinbox alloc] init];
[box tAddControl:spinbox stretchy:NO];
2015-08-03 11:16:08 -05:00
*/
[mainwin tSetControl:box];
2015-08-03 11:16:08 -05:00
/*
2015-08-03 10:22:14 -05:00
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES];
button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES];
[box tAddControl:hbox stretchy:NO];
2015-08-03 10:22:14 -05:00
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES];
button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES];
[box tAddControl:hbox stretchy:NO];
2015-08-03 10:22:14 -05:00
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES];
button = [[tButton alloc] tInitWithText:@"A"];
[hbox tAddControl:button stretchy:NO];
button = [[tButton alloc] tInitWithText:@"BB"];
[hbox tAddControl:button stretchy:NO];
button = [[tButton alloc] tInitWithText:@"CCC"];
[hbox tAddControl:button stretchy:NO];
[box tAddControl:hbox stretchy:NO];
2015-08-03 11:16:08 -05:00
*/
2015-08-03 00:19:32 -05:00
// TODO this isn't stretchy in the proper order
2015-08-03 10:22:14 -05:00
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
2015-08-03 00:19:32 -05:00
spinbox = [[tSpinbox alloc] init];
[hbox tAddControl:spinbox stretchy:NO];
spinbox = [[tSpinbox alloc] init];
[hbox tAddControl:spinbox stretchy:YES];
[box tAddControl:hbox stretchy:NO];
2015-08-03 11:16:08 -05:00
/*
2015-08-03 10:22:14 -05:00
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
entry = [[tEntry alloc] init];
[hbox tAddControl:entry stretchy:NO];
entry = [[tEntry alloc] init];
[hbox tAddControl:entry stretchy:YES];
[box tAddControl:hbox stretchy:NO];
2015-08-03 11:16:08 -05:00
*/
[mainwin tShow];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a
{
return YES;
}
@end
int main(int argc, char *argv[])
{
NSApplication *app;
spaced = argc > 1;
2015-08-01 14:44:06 -05:00
app = [NSApplication sharedApplication];
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
[app setDelegate:[appDelegate new]];
[app run];
return 0;
}