Added tRelayout to all controls. Also changed the order of stretchy controls in main.m because Auto Layout's defaults aren't optimal.
This commit is contained in:
parent
8868ad3b53
commit
30a30cb5be
|
@ -26,6 +26,7 @@
|
|||
[c tSetParent:self->parent addToView:self->sv];
|
||||
[self->children addObject:c];
|
||||
// TODO mark as needing relayout
|
||||
[self tRelayout];
|
||||
}
|
||||
|
||||
- (void)tSetParent:(id<tControl>)p addToView:(NSView *)v
|
||||
|
@ -38,6 +39,7 @@
|
|||
c = (id<tControl>) obj;
|
||||
[c tSetParent:self->parent addToView:self->sv];
|
||||
}];
|
||||
[self tRelayout];
|
||||
}
|
||||
|
||||
- (void)tFillAutoLayoutHorz:(NSMutableArray *)horz
|
||||
|
@ -84,4 +86,10 @@
|
|||
// - lateral dimension: for each view of n+1, make other dimension next to first n
|
||||
// this way, subelement views get positioned right
|
||||
|
||||
- (void)tRelayout
|
||||
{
|
||||
if (self->parent != nil)
|
||||
[self->parent tRelayout];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
{
|
||||
self->parent = p;
|
||||
[v addSubview:self->b];
|
||||
[self tRelayout];
|
||||
}
|
||||
|
||||
- (void)tFillAutoLayoutHorz:(NSMutableArray *)horz
|
||||
|
@ -45,4 +46,10 @@
|
|||
[views setObject:self->b forKey:key];
|
||||
}
|
||||
|
||||
- (void)tRelayout
|
||||
{
|
||||
if (self->parent != nil)
|
||||
[self->parent tRelayout];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,12 +23,12 @@ BOOL margined = NO;
|
|||
box = [[tBox alloc] tInitVertical:NO];
|
||||
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[box tAddControl:button stretchy:NO];
|
||||
[box tAddControl:button stretchy:YES];
|
||||
|
||||
[mainwin tSetControl:box];
|
||||
|
||||
spinbox = [[tSpinbox alloc] init];
|
||||
[box tAddControl:spinbox stretchy:YES];
|
||||
[box tAddControl:spinbox stretchy:NO];
|
||||
|
||||
[mainwin tShow];
|
||||
}
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
extraVert:(NSMutableArray *)extraVert
|
||||
views:(NSMutableDictionary *)views
|
||||
first:(uintmax_t *)n;
|
||||
- (void)tRelayout;
|
||||
@end
|
||||
|
||||
@interface tWindow : NSObject<tControl>
|
||||
- (void)tSetControl:(id<tControl>)cc;
|
||||
- (void)tSetMargined:(BOOL)m;
|
||||
- (void)tShow;
|
||||
// TODO this should probably in tControl
|
||||
- (void)tRelayout;
|
||||
@end
|
||||
|
||||
@interface tBox : NSObject<tControl>
|
||||
|
|
|
@ -59,4 +59,10 @@
|
|||
[views setObject:self->s forKey:keys];
|
||||
}
|
||||
|
||||
- (void)tRelayout
|
||||
{
|
||||
if (self->parent != nil)
|
||||
[self->parent tRelayout];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue