Created
September 23, 2013 04:20
-
-
Save BekaValentine/6666438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)newDocument:(id)sender { | |
NSLog(@"creating document"); | |
NSWindow* newWindow = [[NSWindow alloc] | |
initWithContentRect: NSMakeRect(100,100,500,500) | |
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | |
backing: NSBackingStoreBuffered | |
defer: NO]; | |
[[newWindow contentView] setAutoresizesSubviews: YES]; | |
NSTextView* codeView = [[NSTextView alloc] initWithFrame: NSMakeRect(0,0,400,400)]; | |
[[codeView textContainer] setContainerSize: NSMakeSize(FLT_MAX, FLT_MAX)]; | |
[[codeView textContainer] setWidthTracksTextView: NO]; | |
[[codeView textContainer] setHeightTracksTextView: NO]; | |
[codeView setHorizontallyResizable: YES]; | |
[codeView setVerticallyResizable: YES]; | |
[codeView setString: @"MMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMM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MMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n"]; | |
[codeView sizeToFit]; | |
[[newWindow contentView] addSubview: codeView]; | |
NSString* title = @"test window"; | |
[newWindow setTitle: title]; | |
[newWindow makeKeyAndOrderFront: self]; | |
[[NSApplication sharedApplication] addWindowsItem: newWindow | |
title: title | |
filename: NO]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment