diff options
| -rw-r--r-- | Info.plist | 14 | ||||
| -rw-r--r-- | src/Document.h | 4 | ||||
| -rw-r--r-- | src/Document.m | 38 | ||||
| -rw-r--r-- | src/DocumentWindowController.h | 4 | ||||
| -rw-r--r-- | src/DocumentWindowController.m | 11 | 
5 files changed, 71 insertions, 0 deletions
| @@ -24,5 +24,19 @@  	<string>10.12</string>  	<key>NSHumanReadableCopyright</key>  	<string>Copyright © 2023 Teddy Wing</string> + +	<key>CFBundleDocumentTypes</key> +	<array> +		<dict> +			<key>CFBundleTypeRole</key> +			<string>Editor</string> +			<key>LSItemContentTypes</key> +			<array> +				<string>public.plain-text</string> +			</array> +			<key>NSDocumentClass</key> +			<string>Document</string> +		</dict> +	</array>  </dict>  </plist> diff --git a/src/Document.h b/src/Document.h new file mode 100644 index 0000000..e566ac0 --- /dev/null +++ b/src/Document.h @@ -0,0 +1,4 @@ +#import <Cocoa/Cocoa.h> + +@interface Document : NSDocument +@end diff --git a/src/Document.m b/src/Document.m new file mode 100644 index 0000000..7b514eb --- /dev/null +++ b/src/Document.m @@ -0,0 +1,38 @@ +#import "Document.h" + +@implementation Document + +- (id)init +{ +	self = [super init]; +	if (self) { +	} +	return self; +} + +// TODO: Are window controllers deallocated automatically by the parent? +// [[NSWindowController alloc] initWithWindow:]? + +- (void)makeWindowControllers +{ +	// DocumentWindowController *controller = [[DocumentWindowController alloc] init]; + +	NSWindow *window = [[NSWindow alloc] +		initWithContentRect:NSMakeRect(0, 0, 600, 500) +		styleMask: +			NSWindowStyleMaskTitled +			| NSWindowStyleMaskClosable +			| NSWindowStyleMaskMiniaturizable +			| NSWindowStyleMaskResizable +		backing:NSBackingStoreBuffered +		defer:NO]; +	// [window setFrameAutosaveName:@"document"]; // document name? + +	NSWindowController *window_controller = [[NSWindowController alloc] +		initWithWindow:window]; +	// [window_controller setShouldCascadeWindows:YES]; + +	[self addWindowController:window_controller]; +} + +@end diff --git a/src/DocumentWindowController.h b/src/DocumentWindowController.h new file mode 100644 index 0000000..e3b277b --- /dev/null +++ b/src/DocumentWindowController.h @@ -0,0 +1,4 @@ +#import <Cocoa/Cocoa.h> + +@interface DocumentWindowController : NSWindowController +@end diff --git a/src/DocumentWindowController.m b/src/DocumentWindowController.m new file mode 100644 index 0000000..e83af36 --- /dev/null +++ b/src/DocumentWindowController.m @@ -0,0 +1,11 @@ +#import "DocumentWindowController.h" + +@implementation DocumentWindowController + +- (void)windowWillLoad +{ +	// NSWindow *window = ; +	// self = [self initWithWindow:window]; +} + +@end | 
