1 #import "ITCutWindowEffect.h"
2 #import "ITTransientStatusWindow.h"
3 #import "ITCoreGraphicsHacks.h"
5 @implementation ITCutWindowEffect
8 + (NSString *)effectName
13 + (NSDictionary *)supportedPositions
15 return [NSDictionary dictionaryWithObjectsAndKeys:
16 [NSDictionary dictionaryWithObjectsAndKeys:
17 [NSNumber numberWithBool:YES], @"Left",
18 [NSNumber numberWithBool:YES], @"Center",
19 [NSNumber numberWithBool:YES], @"Right", nil] , @"Top" ,
20 [NSDictionary dictionaryWithObjectsAndKeys:
21 [NSNumber numberWithBool:YES], @"Left",
22 [NSNumber numberWithBool:YES], @"Center",
23 [NSNumber numberWithBool:YES], @"Right", nil] , @"Middle" ,
24 [NSDictionary dictionaryWithObjectsAndKeys:
25 [NSNumber numberWithBool:YES], @"Left",
26 [NSNumber numberWithBool:YES], @"Center",
27 [NSNumber numberWithBool:YES], @"Right", nil] , @"Bottom" , nil];
30 + (unsigned int)listOrder
36 /*************************************************************************/
38 #pragma mark APPEAR METHODS
39 /*************************************************************************/
43 CGAffineTransform transform;
46 //Set the location on the screen
47 if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) {
48 appearPoint.x = -( 32.0 + [[_window screen] visibleFrame].origin.x );
49 } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) {
50 appearPoint.x = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width);
51 } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) {
52 appearPoint.x = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2;
55 if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) {
56 appearPoint.y = ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height );
57 } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) {
58 appearPoint.y = -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) );
59 } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) {
60 appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2;
63 transform = CGAffineTransformMakeTranslation(appearPoint.x, appearPoint.y);
64 CGSSetWindowTransform([NSApp contextID],
65 (CGSWindowID)[_window windowNumber],
68 [_window orderFront:self];
69 [self setWindowVisibility:ITWindowVisibleState];
78 /*************************************************************************/
80 #pragma mark VANISH METHODS
81 /*************************************************************************/
85 [_window orderOut:self];
86 [self setWindowVisibility:ITWindowHiddenState];