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