Started saving the hugging priorities.
This commit is contained in:
parent
410478e1c8
commit
1d2880895d
|
@ -77,6 +77,8 @@
|
||||||
id<tControl> c;
|
id<tControl> c;
|
||||||
|
|
||||||
c = (id<tControl>) obj;
|
c = (id<tControl>) obj;
|
||||||
|
// this also resets the hugging priority
|
||||||
|
// TODO do this when adding and removing controls instead
|
||||||
[c tFillAutoLayout:&pp];
|
[c tFillAutoLayout:&pp];
|
||||||
[views setObject:pp.view forKey:tAutoLayoutKey(n)];
|
[views setObject:pp.view forKey:tAutoLayoutKey(n)];
|
||||||
n++;
|
n++;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
@implementation tButton {
|
@implementation tButton {
|
||||||
NSButton *b;
|
NSButton *b;
|
||||||
id<tControl> parent;
|
id<tControl> parent;
|
||||||
|
NSLayoutPriority horzpri, vertpri;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)tInitWithText:(NSString *)text
|
- (id)tInitWithText:(NSString *)text
|
||||||
|
@ -19,6 +20,9 @@
|
||||||
[self->b setTranslatesAutoresizingMaskIntoConstraints:NO];
|
[self->b setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||||
|
|
||||||
self->parent = nil;
|
self->parent = nil;
|
||||||
|
|
||||||
|
self->horzpri = [self->b contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||||
|
self->vertpri = [self->b contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationVertical];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +37,9 @@
|
||||||
|
|
||||||
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
|
- (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->view = self->b;
|
||||||
p->attachLeft = YES;
|
p->attachLeft = YES;
|
||||||
p->attachTop = YES;
|
p->attachTop = YES;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
NSTextField *t;
|
NSTextField *t;
|
||||||
NSStepper *s;
|
NSStepper *s;
|
||||||
id<tControl> parent;
|
id<tControl> parent;
|
||||||
|
NSLayoutPriority horzpri, vertpri;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
|
@ -63,6 +64,9 @@
|
||||||
[views release];
|
[views release];
|
||||||
|
|
||||||
self->parent = nil;
|
self->parent = nil;
|
||||||
|
|
||||||
|
self->horzpri = [self->c contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||||
|
self->vertpri = [self->c contentHuggingPriorityForOrientation:NSLayoutConstraintOrientationVertical];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +81,9 @@
|
||||||
|
|
||||||
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
|
- (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->view = self->c;
|
||||||
p->attachLeft = YES;
|
p->attachLeft = YES;
|
||||||
p->attachTop = YES;
|
p->attachTop = YES;
|
||||||
|
|
Loading…
Reference in New Issue