1 #import "ITWindowEffect.h"
2 #import "ITTransientStatusWindow.h"
5 @implementation ITWindowEffect
7 + (NSArray *)effectsInfo
10 NSMutableArray *finalArray = [[[NSMutableArray alloc] initWithCapacity:5] autorelease];
12 NSArray *effectKeys = [NSArray arrayWithObjects:
18 NSArray *effectNames = [NSArray arrayWithObjects:
21 @"Slide Horizontally",
26 NSArray *classNames = [NSArray arrayWithObjects:
28 @"ITDissolveWindowEffect",
29 @"ITSlideHorizontallyWindowEffect",
30 @"ITSlideVerticallyWindowEffect",
31 @"ITPivotWindowEffect",
34 NSArray *positionKeys = [NSArray arrayWithObjects:
46 NSArray *cutPositionValues = [NSArray arrayWithObjects:
47 [NSNumber numberWithBool:YES],
48 [NSNumber numberWithBool:YES],
49 [NSNumber numberWithBool:YES],
50 [NSNumber numberWithBool:YES],
51 [NSNumber numberWithBool:YES],
52 [NSNumber numberWithBool:YES],
53 [NSNumber numberWithBool:YES],
54 [NSNumber numberWithBool:YES],
55 [NSNumber numberWithBool:YES],
58 NSArray *dissolvePositionValues = [NSArray arrayWithObjects:
59 [NSNumber numberWithBool:YES],
60 [NSNumber numberWithBool:YES],
61 [NSNumber numberWithBool:YES],
62 [NSNumber numberWithBool:YES],
63 [NSNumber numberWithBool:YES],
64 [NSNumber numberWithBool:YES],
65 [NSNumber numberWithBool:YES],
66 [NSNumber numberWithBool:YES],
67 [NSNumber numberWithBool:YES],
70 NSArray *slideVerticallyPositionValues = [NSArray arrayWithObjects:
71 [NSNumber numberWithBool:YES],
72 [NSNumber numberWithBool:YES],
73 [NSNumber numberWithBool:YES],
74 [NSNumber numberWithBool:NO],
75 [NSNumber numberWithBool:NO],
76 [NSNumber numberWithBool:NO],
77 [NSNumber numberWithBool:YES],
78 [NSNumber numberWithBool:YES],
79 [NSNumber numberWithBool:YES],
82 NSArray *slideHorizontallyPositionValues = [NSArray arrayWithObjects:
83 [NSNumber numberWithBool:YES],
84 [NSNumber numberWithBool:NO],
85 [NSNumber numberWithBool:YES],
86 [NSNumber numberWithBool:YES],
87 [NSNumber numberWithBool:NO],
88 [NSNumber numberWithBool:YES],
89 [NSNumber numberWithBool:YES],
90 [NSNumber numberWithBool:NO],
91 [NSNumber numberWithBool:YES],
94 NSArray *pivotPositionValues = [NSArray arrayWithObjects:
95 [NSNumber numberWithBool:YES],
96 [NSNumber numberWithBool:NO],
97 [NSNumber numberWithBool:YES],
98 [NSNumber numberWithBool:NO],
99 [NSNumber numberWithBool:NO],
100 [NSNumber numberWithBool:NO],
101 [NSNumber numberWithBool:YES],
102 [NSNumber numberWithBool:NO],
103 [NSNumber numberWithBool:YES],
106 NSArray *positionDicts = [NSArray arrayWithObjects:
107 [NSDictionary dictionaryWithObjects:cutPositionValues
108 forKeys:positionKeys],
109 [NSDictionary dictionaryWithObjects:dissolvePositionValues
110 forKeys:positionKeys],
111 [NSDictionary dictionaryWithObjects:slideVerticallyPositionValues
112 forKeys:positionKeys],
113 [NSDictionary dictionaryWithObjects:slideHorizontallyPositionValues
114 forKeys:positionKeys],
115 [NSDictionary dictionaryWithObjects:pivotPositionValues
116 forKeys:positionKeys],
119 for ( ce = 0 ; ce < [effectNames count] ; ce++ ) {
121 NSArray *entryValues = [NSArray arrayWithObjects:
122 [effectNames objectAtIndex:ce],
123 [classNames objectAtIndex:ce],
124 [positionDicts objectAtIndex:ce],
127 NSDictionary *entryDict = [NSDictionary dictionaryWithObjects:entryValues
129 [finalArray addObject:entryDict];
135 - (id)initWithWindow:(NSWindow *)window
137 if ( (self = [super init]) ) {
139 _window = [window retain];
140 _effectTime = DEFAULT_EFFECT_TIME;
142 __shouldReleaseWhenIdle = NO;
145 if ( [window conformsToProtocol:@protocol(ITWindowPositioning)] ) {
146 // Casts so the compiler won't gripe
147 _verticalPosition = (ITVerticalWindowPosition)[(ITTransientStatusWindow *)window verticalPosition];
148 _horizontalPosition = (ITHorizontalWindowPosition)[(ITTransientStatusWindow *)window horizontalPosition];
150 NSLog(@"ITWindowEffect - initWithWindow: - window does not conform to ITWindowPositioning.");
151 _verticalPosition = ITWindowPositionBottom;
152 _horizontalPosition = ITWindowPositionLeft;
163 - (void)setWindow:(NSWindow *)newWindow
165 [_window autorelease];
166 _window = [newWindow retain];
169 - (void)setWindowVisibility:(ITWindowVisibilityState)visibilityState
171 if ( [_window conformsToProtocol:@protocol(ITWindowMotility)] ) {
172 // Cast so the compiler won't gripe
173 [(ITTransientStatusWindow *)_window setVisibilityState:visibilityState];
175 NSLog(@"ITWindowEffect - setWindowVisibility: - window does not conform to ITWindowVisibility.");
184 - (void)setEffectTime:(float)newTime
186 _effectTime = newTime;
189 - (void)performAppear
191 NSLog(@"ITWindowEffect does not implement performAppear.");
194 - (void)performVanish
196 NSLog(@"ITWindowEffect does not implement performVanish.");
201 NSLog(@"ITWindowEffect does not implement cancelAppear.");
206 NSLog(@"ITWindowEffect does not implement cancelVanish.");
209 - (void)releaseWhenIdle;
214 __shouldReleaseWhenIdle = YES;