Added multiple primary horizontal and vertical Auto Layout views. This will accomodate tSpinbox. Now we can go back to tBox.

This commit is contained in:
Pietro Gagliardi 2015-08-01 17:26:56 -04:00
parent 4dc63828e4
commit b528d1ff0c
4 changed files with 23 additions and 18 deletions

View File

@ -32,14 +32,14 @@
return n; return n;
} }
- (void)tFillAutoLayoutHorz:(NSMutableString *)horz - (void)tFillAutoLayoutHorz:(NSMutableArray *)horz
vert:(NSMutableString *)vert vert:(NSMutableArray *)vert
extra:(NSMutableArray *)extra extra:(NSMutableArray *)extra
extraVert:(NSMutableArray *)extraVert extraVert:(NSMutableArray *)extraVert
views:(NSMutableDictionary *)views views:(NSMutableDictionary *)views
{ {
[horz setString:@"[view0]"]; [horz addObject:@"[view0]"];
[vert setString:@"[view0]"]; [vert addObject:@"[view0]"];
[views setObject:self->b forKey:@"view0"]; [views setObject:self->b forKey:@"view0"];
} }

View File

@ -6,8 +6,8 @@
@required @required
- (void)tAddToView:(NSView *)v; - (void)tAddToView:(NSView *)v;
//TODO- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n; //TODO- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
- (void)tFillAutoLayoutHorz:(NSMutableString *)horz - (void)tFillAutoLayoutHorz:(NSMutableArray *)horz
vert:(NSMutableString *)vert vert:(NSMutableArray *)vert
extra:(NSMutableArray *)extra extra:(NSMutableArray *)extra
extraVert:(NSMutableArray *)extraVert extraVert:(NSMutableArray *)extraVert
views:(NSMutableDictionary *)views; views:(NSMutableDictionary *)views;

View File

@ -43,14 +43,15 @@
return n; return n;
} }
- (void)tFillAutoLayoutHorz:(NSMutableString *)horz - (void)tFillAutoLayoutHorz:(NSMutableArray *)horz
vert:(NSMutableString *)vert vert:(NSMutableArray *)vert
extra:(NSMutableArray *)extra extra:(NSMutableArray *)extra
extraVert:(NSMutableArray *)extraVert extraVert:(NSMutableArray *)extraVert
views:(NSMutableDictionary *)views views:(NSMutableDictionary *)views
{ {
[horz setString:@"[view0]-[view1]"]; [horz addObject:@"[view0]-[view1]"];
[vert setString:@"[view0]"]; [vert addObject:@"[view0]"];
[vert addObject:@"[view1]"];
[views setObject:self->t forKey:@"view0"]; [views setObject:self->t forKey:@"view0"];
[views setObject:self->s forKey:@"view1"]; [views setObject:self->s forKey:@"view1"];
} }

View File

@ -42,18 +42,18 @@
- (void)tRelayout - (void)tRelayout
{ {
NSView *contentView; NSView *contentView;
NSMutableString *horz, *vert; NSMutableArray *horz, *vert;
NSMutableArray *extra, *extraVert; NSMutableArray *extra, *extraVert;
NSMutableDictionary *views; NSMutableDictionary *views;
NSInteger i; NSUInteger i;
NSString *margin; NSString *margin;
if (self->c == nil) if (self->c == nil)
return; return;
contentView = [self->w contentView]; contentView = [self->w contentView];
[contentView removeConstraints:[contentView constraints]]; [contentView removeConstraints:[contentView constraints]];
horz = [NSMutableString new]; horz = [NSMutableArray new];
vert = [NSMutableString new]; vert = [NSMutableArray new];
extra = [NSMutableArray new]; extra = [NSMutableArray new];
extraVert = [NSMutableArray new]; extraVert = [NSMutableArray new];
views = [NSMutableDictionary new]; views = [NSMutableDictionary new];
@ -61,10 +61,14 @@
margin = @""; margin = @"";
if (self->margined) if (self->margined)
margin = @"-"; margin = @"-";
[extra addObject:[NSString stringWithFormat:@"|%@%@%@|", margin, horz, margin]]; [horz enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
[extraVert addObject:@NO]; [extra addObject:[NSString stringWithFormat:@"|%@%@%@|", margin, obj, margin]];
[extra addObject:[NSString stringWithFormat:@"|%@%@%@|", margin, vert, margin]]; [extraVert addObject:@NO];
[extraVert addObject:@YES]; }];
[vert enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
[extra addObject:[NSString stringWithFormat:@"|%@%@%@|", margin, obj, margin]];
[extraVert addObject:@YES];
}];
for (i = 0; i < [extra count]; i++) { for (i = 0; i < [extra count]; i++) {
NSString *constraint; NSString *constraint;
NSNumber *vertical; NSNumber *vertical;