/
DMDResizeWindowController.m
59 lines (51 loc) · 1.26 KB
/
DMDResizeWindowController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// DMDDocumentController.m
// DMDAnimator
//
// Created by Adam Preble on 6/27/09.
// Copyright 2009 Giraffe Lab. All rights reserved.
//
#import "DMDResizeWindowController.h"
#import "Animation.h"
#import "NSWindowAdditions.h"
@implementation DMDResizeWindowController
@synthesize width, height;
- (id)init
{
if (self = [super init])
{
[self setWidth:[NSNumber numberWithInt:128]];
[self setHeight:[NSNumber numberWithInt:32]];
}
return self;
}
- (void)dealloc
{
[self setWidth:nil];
[self setHeight:nil];
[super dealloc];
}
- (void)awakeFromNib
{
}
- (void)show
{
if (resizeSheet == nil)
[NSBundle loadNibNamed:@"DMDResizeWindow" owner:self];
[NSApp beginSheet:resizeSheet modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:NULL];
}
- (IBAction)okButton:(id)sender
{
[resizeSheet commitChanges];
[(Animation*)[self document] resize:NSMakeSize([width intValue], [height intValue])];
[NSApp endSheet:resizeSheet returnCode:NSRunStoppedResponse];
}
- (IBAction)cancelButton:(id)sender
{
[NSApp endSheet:resizeSheet returnCode:NSRunAbortedResponse];
}
- (void)didEndSheet:(NSWindow *)theSheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[theSheet orderOut:nil];
}
@end