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