Started saving the hugging priorities.

This commit is contained in:
Pietro Gagliardi 2015-08-03 00:56:14 -04:00
parent 410478e1c8
commit 1d2880895d
3 changed files with 16 additions and 0 deletions

View File

@ -77,6 +77,8 @@
id<tControl> c;
c = (id<tControl>) obj;
// this also resets the hugging priority
// TODO do this when adding and removing controls instead
[c tFillAutoLayout:&pp];
[views setObject:pp.view forKey:tAutoLayoutKey(n)];
n++;

View File

@ -4,6 +4,7 @@
@implementation tButton {
NSButton *b;
id<tControl> parent;
NSLayoutPriority horzpri, vertpri;
}
- (id)tInitWithText:(NSString *)text
@ -19,6 +20,9 @@
[self->b setTranslatesAutoresizingMaskIntoConstraints:NO];
self->parent = nil;
self->horzpri = [self->b contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationHorizontal];
self->vertpri = [self->b contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationVertical];
}
return self;
}
@ -33,6 +37,9 @@
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
{
// reset the hugging priority
[self->b setContentHuggingPriority:self->horzpri forOrientation:NSLayoutConstraintOrientationHorizontal];
[self->b setContentHuggingPriority:self->vertpri forOrientation:NSLayoutConstraintOrientationVertical];
p->view = self->b;
p->attachLeft = YES;
p->attachTop = YES;

View File

@ -19,6 +19,7 @@
NSTextField *t;
NSStepper *s;
id<tControl> parent;
NSLayoutPriority horzpri, vertpri;
}
- (id)init
@ -63,6 +64,9 @@
[views release];
self->parent = nil;
self->horzpri = [self->c contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationHorizontal];
self->vertpri = [self->c contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationVertical];
}
return self;
}
@ -77,6 +81,9 @@
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
{
// reset the hugging priority
[self->c setContentHuggingPriority:self->horzpri forOrientation:NSLayoutConstraintOrientationHorizontal];
[self->c setContentHuggingPriority:self->vertpri forOrientation:NSLayoutConstraintOrientationVertical];
p->view = self->c;
p->attachLeft = YES;
p->attachTop = YES;