-
Notifications
You must be signed in to change notification settings - Fork 7
/
TranslucentWindow.m
61 lines (45 loc) · 1.61 KB
/
TranslucentWindow.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
60
61
//
// TranslucentView.m
//
// Created by Takashi T. Hamada on Thu Nov 01 2000.
// Copyright (c) 2000,2001 Takashi T. Hamada. All rights reserved.
//
// Modifications:
// bb 26.06.2002 - removed the _transparency method
//
#import "TranslucentWindow.h"
@implementation TranslucentWindow
//-------------------------------------------------------------
// set the transparency
//-------------------------------------------------------------
//- (float)_transparency
//{
// return 0.9999999999;
//}
// Not much here, just calling the following private API.
extern void _NSSetWindowOpacity(int windowNumber, BOOL isOpaque);
//-------------------------------------------------------------
// make the window (pseudo) transparent
//-------------------------------------------------------------
- initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
{
if (self = [super initWithContentRect:contentRect styleMask:aStyle backing:bufferingType defer:flag])
_NSSetWindowOpacity([self windowNumber], NO);
[self setAcceptsMouseMovedEvents:YES]; // for dragging itself by receiving the mouse events
return self;
}
//-------------------------------------------------------------
// no shadow is needed
//-------------------------------------------------------------
- (BOOL)hasShadow
{
return NO;
}
//-------------------------------------------------------------
// For displaying the tooltips with transparent window
//-------------------------------------------------------------
- (BOOL)canBecomeKeyWindow
{
return YES;
}
@end