mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Update template project for a new application
Use an application controller instead of embedding a window with a custom view in the nib.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
2
Applications/NewApplication/src/ApplicationController.h
Normal file
2
Applications/NewApplication/src/ApplicationController.h
Normal file
@@ -0,0 +1,2 @@
|
||||
@interface ApplicationController : NSObject
|
||||
@end
|
||||
22
Applications/NewApplication/src/ApplicationController.mm
Normal file
22
Applications/NewApplication/src/ApplicationController.mm
Normal file
@@ -0,0 +1,22 @@
|
||||
#import "ApplicationController.h"
|
||||
|
||||
@interface ApplicationController () <NSApplicationDelegate, NSWindowDelegate>
|
||||
@property (nonatomic) NSWindow* window;
|
||||
@end
|
||||
|
||||
@implementation ApplicationController
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
|
||||
{
|
||||
_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 400) styleMask:(NSTitledWindowMask|NSResizableWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO];
|
||||
_window.releasedWhenClosed = NO;
|
||||
_window.delegate = self;
|
||||
_window.title = @"New Application";
|
||||
[_window center];
|
||||
[_window makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)aNotification
|
||||
{
|
||||
[NSApp terminate:self];
|
||||
}
|
||||
@end
|
||||
@@ -1,4 +0,0 @@
|
||||
@interface MyView : NSView
|
||||
{
|
||||
}
|
||||
@end
|
||||
@@ -1,8 +0,0 @@
|
||||
#import "MyView.h"
|
||||
|
||||
@implementation MyView
|
||||
- (void)drawRect:(NSRect)aRect
|
||||
{
|
||||
NSEraseRect(aRect);
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user