forked from irlabs/TransparentWebView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebViewWindow.m
48 lines (41 loc) · 1.28 KB
/
WebViewWindow.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
#import <WebKit/WebView.h>
#import <WebKit/WebFrame.h>
#import "WebViewWindow.h"
@implementation WebViewWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag {
//
if( self = [super initWithContentRect:contentRect
styleMask:aStyle//NSBorderlessWindowMask
backing:bufferingType
defer:flag] ) {
[self setBackgroundColor: [NSColor clearColor]];
[self setLevel: NSStatusWindowLevel];
[self setAlphaValue: 1.0];
[self setOpaque: NO];
[self setHasShadow: NO];
self.titleVisibility = NSWindowTitleHidden;
}
return self;
}
- (void)awakeFromNib {
NSLog(@"WebViewWindow awakes from Nib");
[self setDrawsBackgroundSettings];
}
- (void)setDrawsBackgroundSettings {
[thisWebView setDrawsBackground: NO];
[self setView: thisWebView onWindow: self];
}
- (void)setView:(WebView*)view onWindow: (NSWindow*) window {
//
[view setFrameLoadDelegate:window];
[view setUIDelegate:window];
[view setResourceLoadDelegate:window];
/*
// NOW all performed in App Delegate:
NSURL *url = [NSURL URLWithString:@"http://localhost:8080/"];
NSURLRequest *urlReq = [NSURLRequest requestWithURL:url];
WebFrame* webFrame = [view mainFrame];
[webFrame loadRequest: urlReq];
*/
}
@end