blob: 2765a2e3cb49298c2f368913930bf1e98073e825 (
plain)
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
|
#import "WindowController.h"
@interface WindowController() {
}
-(void) notificationCenter;
@end
@implementation WindowController
@synthesize contentView, url;
- (id) initWithURL:(NSString *) relativeURL{
self = [super initWithWindowNibName:@"Window"];
self.url = [NSURL URLWithString:relativeURL relativeToURL:[[NSBundle mainBundle] resourceURL]];
[self.window setFrameAutosaveName:@"MacGapWindow"];
[self notificationCenter];
return self;
}
-(id) initWithRequest: (NSURLRequest *)request{
self = [super initWithWindowNibName:@"Window"];
[self notificationCenter];
[[self.contentView.webView mainFrame] loadRequest:request];
return self;
}
-(void) notificationCenter{
[[NSNotificationCenter defaultCenter] addObserver:self.contentView
selector:@selector(windowResized:)
name:NSWindowDidResizeNotification
object:[self window]];
}
- (void)windowDidLoad
{
[super windowDidLoad];
if (self.url != nil) {
[self.contentView.webView setMainFrameURL:[self.url absoluteString]];
}
// Implement this method to handle any initialization after your
// window controller's window has been loaded from its nib file.
}
@end
|