More Auto Layout test work. It compiles1
This commit is contained in:
parent
8bcaeb5d85
commit
c9da21e350
|
@ -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) {
|
__block uintmax_t n = nn;
|
||||||
NSObject<tControl> *c;
|
|
||||||
|
|
||||||
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];
|
n = [c tAddToAutoLayoutDictionary:views keyNumber:n];
|
||||||
}];
|
}];
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)tBuildAutoLayoutConstraintsKeyNumber:(uintmax_t)n
|
- (NSString *)tBuildAutoLayoutConstraintsKeyNumber:(uintmax_t)nn
|
||||||
{
|
{
|
||||||
NSMutableString *constraints;
|
NSMutableString *constraints;
|
||||||
|
__block uintmax_t n = nn;
|
||||||
|
|
||||||
if (self->vertical)
|
if (self->vertical)
|
||||||
constraints = [NSMutableString stringWithString:@"V:"];
|
constraints = [NSMutableString stringWithString:@"V:"];
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// 31 july 2015
|
// 31 july 2015
|
||||||
#import "osxaltest.h"
|
#import "osxaltest.h"
|
||||||
|
|
||||||
|
// #qo LDFLAGS: -framework Foundation -framework AppKit
|
||||||
|
|
||||||
@interface appDelegate : NSObject<NSApplicationDelegate>
|
@interface appDelegate : NSObject<NSApplicationDelegate>
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -8,6 +10,20 @@
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
- (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
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a
|
||||||
|
|
Binary file not shown.
|
@ -8,4 +8,9 @@
|
||||||
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
|
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface tWindowDelegate : NSObject<NSWindowDelegate>
|
||||||
|
- (void)tSetControl:(NSObject<tControl> *)cc;
|
||||||
|
- (void)tRelayout;
|
||||||
|
@end
|
||||||
|
|
||||||
extern NSString *tAutoLayoutKey(uintmax_t);
|
extern NSString *tAutoLayoutKey(uintmax_t);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// 1 august 2015
|
||||||
|
#import "osxaltest.h"
|
||||||
|
|
||||||
|
NSString *tAutoLayoutKey(uintmax_t n)
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"[view%ju]", n];
|
||||||
|
}
|
|
@ -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
|
Loading…
Reference in New Issue