Changed button.m and spinbox.m to use the new model. Let's test this one...

This commit is contained in:
Pietro Gagliardi 2015-08-02 22:41:07 -04:00
parent bd166e601f
commit 2eb48aa129
3 changed files with 11 additions and 52 deletions

View File

@ -29,6 +29,7 @@
self = [super init];
if (self) {
self->v = [[NSView alloc] initWithFrame:NSZeroRect];
[self->v setTranslatesAutoresizingMaskIntoConstraints:NO];
self->children = [NSMutableArray new];
self->stretchy = [NSMutableArray new];
self->vertical = vert;

View File

@ -33,32 +33,11 @@
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
{
NSString *key;
NSString *horzpred, *vertpred;
key = tAutoLayoutKey(p->n);
p->n++;
horzpred = @"";
if (p->horzStretchy)
if (p->horzFirstStretchy)
// TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness...
horzpred = @"(>=0)";
else
horzpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->horzStretchyTo)];
vertpred = @"";
if (p->vertStretchy)
if (p->vertFirstStretchy)
// TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness...
vertpred = @"(>=0)";
else
vertpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->vertStretchyTo)];
[p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]];
[p->horzAttachLeft addObject:[NSNumber numberWithBool:p->horzFirst]];
[p->horzAttachRight addObject:[NSNumber numberWithBool:p->horzLast]];
[p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]];
[p->vertAttachTop addObject:[NSNumber numberWithBool:p->vertFirst]];
[p->vertAttachBottom addObject:[NSNumber numberWithBool:p->vertLast]];
[p->views setObject:self->b forKey:key];
p->view = self->b;
p->attachLeft = YES;
p->attachTop = YES;
p->attachRight = YES;
p->attachBottom = YES;
}
- (void)tRelayout

View File

@ -77,32 +77,11 @@
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
{
NSString *key;
NSString *horzpred, *vertpred;
key = tAutoLayoutKey(p->n);
p->n++;
horzpred = @"(==96)"; // TODO only the entry
if (p->horzStretchy)
if (p->horzFirstStretchy)
// TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness...
horzpred = @"(>=0)";
else
horzpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->horzStretchyTo)];
vertpred = @"";
if (p->vertStretchy)
if (p->vertFirstStretchy)
// TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness...
vertpred = @"(>=0)";
else
vertpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->vertStretchyTo)];
[p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]];
[p->horzAttachLeft addObject:[NSNumber numberWithBool:p->horzFirst]];
[p->horzAttachRight addObject:[NSNumber numberWithBool:p->horzLast]];
[p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]];
[p->vertAttachTop addObject:[NSNumber numberWithBool:p->vertFirst]];
[p->vertAttachBottom addObject:[NSNumber numberWithBool:p->vertLast]];
[p->views setObject:self->c forKey:key];
p->view = self->c;
p->attachLeft = YES;
p->attachTop = YES;
p->attachRight = YES;
p->attachBottom = YES;
}
- (void)tRelayout