Changed things around a bit; going to build things from tWindow's perspective first.
This commit is contained in:
parent
cdbf2d5b5c
commit
9ecf15f4e0
|
@ -10,20 +10,15 @@
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
||||||
{
|
{
|
||||||
NSWindow *mainwin;
|
tWindow *mainwin;
|
||||||
tWindowDelegate *delegate;
|
tButton *button;
|
||||||
|
|
||||||
mainwin = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 320, 240)
|
mainwin = [[tWindow alloc] init];
|
||||||
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
|
|
||||||
backing:NSBackingStoreBuffered
|
|
||||||
defer:YES];
|
|
||||||
[mainwin setTitle:@"Auto Layout Test"];
|
|
||||||
|
|
||||||
delegate = [tWindowDelegate new];
|
button = [[tButton alloc] tInitWithText:@"Button"];
|
||||||
[mainwin setDelegate:delegate];
|
[mainwin tSetControl:button];
|
||||||
|
|
||||||
[mainwin cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
|
[mainwin tShow];
|
||||||
[mainwin makeKeyAndOrderFront:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)a
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
|
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface tWindowDelegate : NSObject<NSWindowDelegate>
|
@interface tWindow : NSObject<tControl>
|
||||||
- (void)tSetControl:(id<tControl>)cc;
|
- (void)tSetControl:(id<tControl>)cc;
|
||||||
|
- (void)tShow;
|
||||||
|
// TODO this should probably in tControl
|
||||||
- (void)tRelayout;
|
- (void)tRelayout;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue