root/trunk/TransparentWindow.m @ 41

Revision 41, 1.7 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//
2//  TransparentWindow.m
3//  TypePad-Uploader
4//
5//  Created by Nicholas Gerakines on 4/28/06.
6//  Copyright 2006 __MyCompanyName__. All rights reserved.
7//
8
9#import "TransparentWindow.h"
10
11@implementation TransparentWindow
12
13- (id)initWithContentRect:(NSRect)contentRect
14                                styleMask:(unsigned int)aStyle
15                                  backing:(NSBackingStoreType)bufferingType
16                                        defer:(BOOL)flag
17{
18   
19    if (self = [super initWithContentRect:contentRect
20                                                                styleMask:NSBorderlessWindowMask
21                                                                  backing:NSBackingStoreBuffered
22                                                                        defer:NO]) {
23        [self setLevel: NSStatusWindowLevel];
24        [self setBackgroundColor: [NSColor clearColor]];
25        [self setAlphaValue:1.0];
26        [self setOpaque:NO];
27        [self setHasShadow:NO];
28        return self;
29    }
30    return nil;
31}
32
33- (BOOL) canBecomeKeyWindow {
34    return YES;
35}
36
37- (void)mouseDragged:(NSEvent *)theEvent {
38    NSPoint currentLocation;
39    NSPoint newOrigin;
40    NSRect  screenFrame = [[NSScreen mainScreen] frame];
41    NSRect  windowFrame = [self frame];
42    currentLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
43    newOrigin.x = currentLocation.x - initialLocation.x;
44    newOrigin.y = currentLocation.y - initialLocation.y;
45    if( (newOrigin.y + windowFrame.size.height) > (NSMaxY(screenFrame) - [NSMenuView menuBarHeight]) ){
46                newOrigin.y = NSMaxY(screenFrame) - windowFrame.size.height - [NSMenuView menuBarHeight];
47    }
48    [self setFrameOrigin:newOrigin];
49}
50
51- (void)mouseDown:(NSEvent *)theEvent {
52    NSRect windowFrame = [self frame];
53    initialLocation = [self convertBaseToScreen:[theEvent locationInWindow]];
54    initialLocation.x -= windowFrame.origin.x;
55    initialLocation.y -= windowFrame.origin.y;
56}
57
58
59@end
Note: See TracBrowser for help on using the browser.