root/trunk/VoxTransParentWindow.m @ 41

Revision 41, 1.5 kB (checked in by ngerakines, 3 years ago)

* Put into place the real icons that Wiley sent over
* Fixed the prefs on login
* Removed the TypePadSuper class
* General code cleanup

Line 
1#import "VoxTransParentWindow.h"
2
3@implementation VoxTransParentWindow
4
5- (id)initWithContentRect:(NSRect)contentRect
6                                styleMask:(unsigned int)aStyle
7                                  backing:(NSBackingStoreType)bufferingType
8                                        defer:(BOOL)flag
9{
10   
11    if (self = [super initWithContentRect:contentRect
12                                                                styleMask:NSBorderlessWindowMask
13                                                                  backing:NSBackingStoreBuffered
14                                                                        defer:NO]) {
15        [self setLevel: NSStatusWindowLevel];
16        [self setBackgroundColor: [NSColor clearColor]];
17        [self setAlphaValue:1.0];
18        [self setOpaque:NO];
19        [self setHasShadow:NO];
20        return self;
21    }
22    return nil;
23}
24
25- (BOOL) canBecomeKeyWindow {
26    return YES;
27}
28
29- (void)mouseDragged:(NSEvent *)theEvent {
30    NSPoint currentLocation;
31    NSPoint newOrigin;
32    NSRect  screenFrame = [[NSScreen mainScreen] frame];
33    NSRect  windowFrame = [self frame];
34    currentLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
35    newOrigin.x = currentLocation.x - initialLocation.x;
36    newOrigin.y = currentLocation.y - initialLocation.y;
37    if( (newOrigin.y + windowFrame.size.height) > (NSMaxY(screenFrame) - [NSMenuView menuBarHeight]) ){
38                newOrigin.y = NSMaxY(screenFrame) - windowFrame.size.height - [NSMenuView menuBarHeight];
39    }
40    [self setFrameOrigin:newOrigin];
41}
42
43- (void)mouseDown:(NSEvent *)theEvent {
44    NSRect windowFrame = [self frame];
45    initialLocation = [self convertBaseToScreen:[theEvent locationInWindow]];
46    initialLocation.x -= windowFrame.origin.x;
47    initialLocation.y -= windowFrame.origin.y;
48}
49
50
51@end
Note: See TracBrowser for help on using the browser.