Changed things around a bit; going to build things from tWindow's perspective first.

This commit is contained in:
Pietro Gagliardi 2015-08-01 15:21:03 -04:00
parent cdbf2d5b5c
commit 9ecf15f4e0
3 changed files with 9 additions and 40 deletions

View File

@ -10,20 +10,15 @@
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
NSWindow *mainwin;
tWindowDelegate *delegate;
tWindow *mainwin;
tButton *button;
mainwin = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 320, 240)
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
backing:NSBackingStoreBuffered
defer:YES];
[mainwin setTitle:@"Auto Layout Test"];
mainwin = [[tWindow alloc] init];
delegate = [tWindowDelegate new];
[mainwin setDelegate:delegate];
button = [[tButton alloc] tInitWithText:@"Button"];
[mainwin tSetControl:button];
[mainwin cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
[mainwin makeKeyAndOrderFront:self];
[mainwin tShow];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a

View File

@ -8,8 +8,10 @@
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
@end
@interface tWindowDelegate : NSObject<NSWindowDelegate>
@interface tWindow : NSObject<tControl>
- (void)tSetControl:(id<tControl>)cc;
- (void)tShow;
// TODO this should probably in tControl
- (void)tRelayout;
@end

View File

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