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"),
23 if ((Gestalt(gestaltSystemVersion, &version) == noErr) && (version >= 4160) && (version < 4166)) {
24 NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 1, 1) pixelFormat:[NSOpenGLView defaultPixelFormat]];
25 if ([view openGLContext]) {
26 NSString *string = [NSString stringWithCString:glGetString(GL_EXTENSIONS)];
27 NSRange result = [string rangeOfString:@"ARB_fragment_program"];
28 if (result.location != NSNotFound) {
29 [classes addObject:NSClassFromString(@"ITCoreImageWindowEffect")];
35 return [classes autorelease];
38 - (id)initWithWindow:(NSWindow *)window
40 if ( (self = [super init]) ) {
41 _window = [window retain];
42 _effectTime = DEFAULT_EFFECT_TIME;
44 __shouldReleaseWhenIdle = NO;
47 if ( [window conformsToProtocol:@protocol(ITWindowPositioning)] ) {
48 _verticalPosition = (ITVerticalWindowPosition)[(ITTransientStatusWindow *)window verticalPosition];
49 _horizontalPosition = (ITHorizontalWindowPosition)[(ITTransientStatusWindow *)window horizontalPosition];
51 NSLog(@"ITWindowEffect - initWithWindow: - window does not conform to ITWindowPositioning.");
52 _verticalPosition = ITWindowPositionBottom;
53 _horizontalPosition = ITWindowPositionLeft;
64 - (void)setWindow:(NSWindow *)newWindow
66 [_window autorelease];
67 _window = [newWindow retain];
70 - (void)setWindowVisibility:(ITWindowVisibilityState)visibilityState
72 if ( [_window conformsToProtocol:@protocol(ITWindowMotility)] ) {
73 // Cast so the compiler won't gripe
74 [(ITTransientStatusWindow *)_window setVisibilityState:visibilityState];
76 NSLog(@"ITWindowEffect - setWindowVisibility: - window does not conform to ITWindowVisibility.");
85 - (void)setEffectTime:(float)newTime
87 _effectTime = newTime;
90 + (NSString *)effectName
92 NSLog(@"ITWindowEffect does not implement +effectName.");
96 + (NSDictionary *)supportedPositions
98 NSLog(@"ITWindowEffect does not implement +supportedPositions.");
100 // Below is an example dictionary. Modify it appropriately when subclassing.
101 return [NSDictionary dictionaryWithObjectsAndKeys:
102 [NSDictionary dictionaryWithObjectsAndKeys:
103 [NSNumber numberWithBool:NO], @"Left",
104 [NSNumber numberWithBool:NO], @"Center",
105 [NSNumber numberWithBool:NO], @"Right", nil] , @"Top" ,
106 [NSDictionary dictionaryWithObjectsAndKeys:
107 [NSNumber numberWithBool:NO], @"Left",
108 [NSNumber numberWithBool:NO], @"Center",
109 [NSNumber numberWithBool:NO], @"Right", nil] , @"Middle" ,
110 [NSDictionary dictionaryWithObjectsAndKeys:
111 [NSNumber numberWithBool:NO], @"Left",
112 [NSNumber numberWithBool:NO], @"Center",
113 [NSNumber numberWithBool:NO], @"Right", nil] , @"Bottom" , nil];
116 + (unsigned int)listOrder
118 NSLog(@"ITWindowEffect does not implement +listOrder.");
122 - (void)performAppear
124 NSLog(@"ITWindowEffect does not implement -performAppear.");
127 - (void)performVanish
129 NSLog(@"ITWindowEffect does not implement -performVanish.");
134 NSLog(@"ITWindowEffect does not implement -cancelAppear.");
139 NSLog(@"ITWindowEffect does not implement -cancelVanish.");
142 - (void)releaseWhenIdle;
147 __shouldReleaseWhenIdle = YES;