1 #import "ITWindowEffect.h"
2 #import "ITTransientStatusWindow.h"
5 #import <OpenGL/glext.h>
7 @implementation ITWindowEffect
9 + (NSArray *)effectClasses
11 NSMutableArray *classes = [NSArray arrayWithObjects:
12 NSClassFromString(@"ITCutWindowEffect"),
13 NSClassFromString(@"ITDissolveWindowEffect"),
14 NSClassFromString(@"ITSlideHorizontallyWindowEffect"),
15 NSClassFromString(@"ITSlideVerticallyWindowEffect"),
16 NSClassFromString(@"ITPivotWindowEffect"),
17 NSClassFromString(@"ITZoomWindowEffect"),
18 NSClassFromString(@"ITSpinWindowEffect"),
19 NSClassFromString(@"ITSpinAndZoomWindowEffect"),
22 NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 1, 1) pixelFormat:[NSOpenGLView defaultPixelFormat]];
23 if ([view openGLContext]) {
24 NSString *string = [NSString stringWithCString:glGetString(GL_EXTENSIONS)];
25 NSRange result = [string rangeOfString:@"ARB_fragment_program"];
26 if (result.location != NSNotFound) {
27 [classes addObject:NSClassFromString(@"ITCoreImageWindowEffect")];
35 - (id)initWithWindow:(NSWindow *)window
37 if ( (self = [super init]) ) {
38 _window = [window retain];
39 _effectTime = DEFAULT_EFFECT_TIME;
41 __shouldReleaseWhenIdle = NO;
44 if ( [window conformsToProtocol:@protocol(ITWindowPositioning)] ) {
45 _verticalPosition = (ITVerticalWindowPosition)[(ITTransientStatusWindow *)window verticalPosition];
46 _horizontalPosition = (ITHorizontalWindowPosition)[(ITTransientStatusWindow *)window horizontalPosition];
48 NSLog(@"ITWindowEffect - initWithWindow: - window does not conform to ITWindowPositioning.");
49 _verticalPosition = ITWindowPositionBottom;
50 _horizontalPosition = ITWindowPositionLeft;
61 - (void)setWindow:(NSWindow *)newWindow
63 [_window autorelease];
64 _window = [newWindow retain];
67 - (void)setWindowVisibility:(ITWindowVisibilityState)visibilityState
69 if ( [_window conformsToProtocol:@protocol(ITWindowMotility)] ) {
70 // Cast so the compiler won't gripe
71 [(ITTransientStatusWindow *)_window setVisibilityState:visibilityState];
73 NSLog(@"ITWindowEffect - setWindowVisibility: - window does not conform to ITWindowVisibility.");
82 - (void)setEffectTime:(float)newTime
84 _effectTime = newTime;
87 + (NSString *)effectName
89 NSLog(@"ITWindowEffect does not implement +effectName.");
93 + (NSDictionary *)supportedPositions
95 NSLog(@"ITWindowEffect does not implement +supportedPositions.");
97 // Below is an example dictionary. Modify it appropriately when subclassing.
98 return [NSDictionary dictionaryWithObjectsAndKeys:
99 [NSDictionary dictionaryWithObjectsAndKeys:
100 [NSNumber numberWithBool:NO], @"Left",
101 [NSNumber numberWithBool:NO], @"Center",
102 [NSNumber numberWithBool:NO], @"Right", nil] , @"Top" ,
103 [NSDictionary dictionaryWithObjectsAndKeys:
104 [NSNumber numberWithBool:NO], @"Left",
105 [NSNumber numberWithBool:NO], @"Center",
106 [NSNumber numberWithBool:NO], @"Right", nil] , @"Middle" ,
107 [NSDictionary dictionaryWithObjectsAndKeys:
108 [NSNumber numberWithBool:NO], @"Left",
109 [NSNumber numberWithBool:NO], @"Center",
110 [NSNumber numberWithBool:NO], @"Right", nil] , @"Bottom" , nil];
113 + (unsigned int)listOrder
115 NSLog(@"ITWindowEffect does not implement +listOrder.");
119 - (void)performAppear
121 NSLog(@"ITWindowEffect does not implement -performAppear.");
124 - (void)performVanish
126 NSLog(@"ITWindowEffect does not implement -performVanish.");
131 NSLog(@"ITWindowEffect does not implement -cancelAppear.");
136 NSLog(@"ITWindowEffect does not implement -cancelVanish.");
139 - (void)releaseWhenIdle;
144 __shouldReleaseWhenIdle = YES;