More Auto Layout test work. It compiles1

This commit is contained in:
Pietro Gagliardi 2015-08-01 12:43:54 -04:00
parent 8bcaeb5d85
commit c9da21e350
6 changed files with 64 additions and 5 deletions

View File

@ -37,20 +37,23 @@
}];
}
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)nn
{
[self->children enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
NSObject<tControl> *c;
__block uintmax_t n = nn;
c = (NSObject<tControl> *) obj;
[self->children enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
id<tControl> c;
c = (id<tControl>) obj;
n = [c tAddToAutoLayoutDictionary:views keyNumber:n];
}];
return n;
}
- (NSString *)tBuildAutoLayoutConstraintsKeyNumber:(uintmax_t)n
- (NSString *)tBuildAutoLayoutConstraintsKeyNumber:(uintmax_t)nn
{
NSMutableString *constraints;
__block uintmax_t n = nn;
if (self->vertical)
constraints = [NSMutableString stringWithString:@"V:"];

View File

@ -1,6 +1,8 @@
// 31 july 2015
#import "osxaltest.h"
// #qo LDFLAGS: -framework Foundation -framework AppKit
@interface appDelegate : NSObject<NSApplicationDelegate>
@end
@ -8,6 +10,20 @@
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
NSWindow *mainwin;
tWindowDelegate *delegate;
mainwin = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 320, 240)
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
backing:NSBackingStoreBuffered
defer:YES];
[mainwin setTitle:@"Auto Layout Test"];
delegate = [tWindowDelegate new];
[mainwin setDelegate:delegate];
[mainwin cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
[mainwin makeKeyAndOrderFront:self];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a

BIN
redo/osxaltest/osxaltest Executable file

Binary file not shown.

View File

@ -8,4 +8,9 @@
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
@end
@interface tWindowDelegate : NSObject<NSWindowDelegate>
- (void)tSetControl:(NSObject<tControl> *)cc;
- (void)tRelayout;
@end
extern NSString *tAutoLayoutKey(uintmax_t);

7
redo/osxaltest/util.m Normal file
View File

@ -0,0 +1,7 @@
// 1 august 2015
#import "osxaltest.h"
NSString *tAutoLayoutKey(uintmax_t n)
{
return [NSString stringWithFormat:@"[view%ju]", n];
}

View File

@ -0,0 +1,28 @@
// 1 august 2015
#import "osxaltest.h"
@implementation tWindowDelegate {
NSObject<tControl> *c;
}
- (id)init
{
self = [super init];
if (self)
self->c = NULL;
return self;
}
- (void)tSetControl:(NSObject<tControl> *)cc
{
self->c = cc;
}
- (void)tRelayout
{
if (self->c == NULL)
return;
// TODO
}
@end