Started saving the hugging priorities.
This commit is contained in:
parent
410478e1c8
commit
1d2880895d
|
@ -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++;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue