Added a debug hook for constraints.

This commit is contained in:
Pietro Gagliardi 2015-08-03 12:09:31 -04:00
parent 69cb4694dd
commit 64f36f8e74
2 changed files with 20 additions and 0 deletions

View File

@ -25,6 +25,7 @@
BOOL spaced;
}
// TODO rename to padded
- (id)tInitVertical:(BOOL)vert spaced:(BOOL)sp
{
self = [super init];

View File

@ -1,6 +1,24 @@
// 1 august 2015
#include "osxaltest.h"
@implementation NSView (AutoLayoutHelpers)
- (void)tIsAmbiguous:(uintmax_t)indent
{
NSMutableString *s;
uintmax_t i;
NSUInteger j;
s = [NSMutableString new];
for (i = 0; i < indent; i++)
[s appendString:@" "];
NSLog(@"%@%@ %d", s, [self className], (int) [self hasAmbiguousLayout]);
if ([self hasAmbiguousLayout])
[[self window] visualizeConstraints:[[self superview] constraints]];
for (j = 0; j < [[self subviews] count]; j++)
[[[self subviews] objectAtIndex:j] tIsAmbiguous:(indent + 1)];
}
@end
@implementation tWindow {
NSWindow *w;
id<tControl> c;
@ -37,6 +55,7 @@
{
[self->w cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
[self->w makeKeyAndOrderFront:self];
[[self->w contentView] tIsAmbiguous:0];
}
- (void)tRelayout