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];
31 /*************************************************************************/
33 #pragma mark APPEAR METHODS
34 /*************************************************************************/
38 CGAffineTransform transform;
41 //Set the location on the screen
42 if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) {
43 appearPoint.x = -( 32.0 + [[_window screen] visibleFrame].origin.x );
44 } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) {
45 appearPoint.x = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width);
46 } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) {
47 appearPoint.x = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2;
50 if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) {
51 appearPoint.y = ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height );
52 } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) {
53 appearPoint.y = -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) );
54 } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) {
55 appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2;
58 transform = CGAffineTransformMakeTranslation(appearPoint.x, appearPoint.y);
59 CGSSetWindowTransform([NSApp contextID],
60 (CGSWindowID)[_window windowNumber],
63 [_window orderFront:self];
64 [self setWindowVisibility:ITWindowVisibleState];
73 /*************************************************************************/
75 #pragma mark VANISH METHODS
76 /*************************************************************************/
80 [_window orderOut:self];
81 [self setWindowVisibility:ITWindowHiddenState];