Added padding.
This commit is contained in:
parent
06257b19a5
commit
69cb4694dd
|
@ -22,9 +22,10 @@
|
|||
NSMutableArray *stretchy;
|
||||
BOOL vertical;
|
||||
id<tControl> parent;
|
||||
BOOL spaced;
|
||||
}
|
||||
|
||||
- (id)tInitVertical:(BOOL)vert
|
||||
- (id)tInitVertical:(BOOL)vert spaced:(BOOL)sp
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
@ -34,6 +35,7 @@
|
|||
self->stretchy = [NSMutableArray new];
|
||||
self->vertical = vert;
|
||||
self->parent = nil;
|
||||
self->spaced = sp;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -54,7 +56,6 @@
|
|||
[self tRelayout];
|
||||
}
|
||||
|
||||
// TODO spaced
|
||||
// TODO custom minimum width for non-stretchy controls
|
||||
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
|
||||
{
|
||||
|
@ -101,6 +102,8 @@
|
|||
for (i = 0; i < n; i++) {
|
||||
NSNumber *isStretchy;
|
||||
|
||||
if (self->spaced && i != 0)
|
||||
[constraint appendString:@"-"];
|
||||
[constraint appendString:@"["];
|
||||
[constraint appendString:tAutoLayoutKey(i)];
|
||||
isStretchy = (NSNumber *) [self->stretchy objectAtIndex:i];
|
||||
|
|
|
@ -22,28 +22,28 @@ BOOL firstvert = YES;
|
|||
mainwin = [[tWindow alloc] init];
|
||||
[mainwin tSetMargined:spaced];
|
||||
|
||||
box = [[tBox alloc] tInitVertical:firstvert];
|
||||
box = [[tBox alloc] tInitVertical:firstvert spaced:spaced];
|
||||
|
||||
spinbox = [[tSpinbox alloc] init];
|
||||
[box tAddControl:spinbox stretchy:NO];
|
||||
|
||||
[mainwin tSetControl:box];
|
||||
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert];
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[hbox tAddControl:button stretchy:YES];
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[hbox tAddControl:button stretchy:YES];
|
||||
[box tAddControl:hbox stretchy:NO];
|
||||
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert];
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[hbox tAddControl:button stretchy:YES];
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[hbox tAddControl:button stretchy:YES];
|
||||
[box tAddControl:hbox stretchy:NO];
|
||||
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert];
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
|
||||
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||
[hbox tAddControl:button stretchy:YES];
|
||||
button = [[tButton alloc] tInitWithText:@"A"];
|
||||
|
@ -55,14 +55,14 @@ BOOL firstvert = YES;
|
|||
[box tAddControl:hbox stretchy:NO];
|
||||
|
||||
// TODO this isn't stretchy in the proper order
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert];
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
|
||||
spinbox = [[tSpinbox alloc] init];
|
||||
[hbox tAddControl:spinbox stretchy:NO];
|
||||
spinbox = [[tSpinbox alloc] init];
|
||||
[hbox tAddControl:spinbox stretchy:YES];
|
||||
[box tAddControl:hbox stretchy:NO];
|
||||
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert];
|
||||
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
|
||||
entry = [[tEntry alloc] init];
|
||||
[hbox tAddControl:entry stretchy:NO];
|
||||
entry = [[tEntry alloc] init];
|
||||
|
|
|
@ -28,7 +28,7 @@ struct tAutoLayoutParams {
|
|||
@end
|
||||
|
||||
@interface tBox : NSObject<tControl>
|
||||
- (id)tInitVertical:(BOOL)vert;
|
||||
- (id)tInitVertical:(BOOL)vert spaced:(BOOL)sp;
|
||||
- (void)tAddControl:(id<tControl>)c stretchy:(BOOL)s;
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue