HUGE ITTSW Checkin. For those only interested in the short version, it is as
[ITKit.git] / ITWindowEffect.m
1 #import "ITWindowEffect.h"
2 #import "ITTransientStatusWindow.h"
3
4
5 @implementation ITWindowEffect
6
7
8 - (id)initWithWindow:(NSWindow *)window
9 {
10     if ( (self = [super init]) ) {
11     
12         _window                 = [window retain];
13         _effectTime             = DEFAULT_EFFECT_TIME;
14         _effectTimer            = nil;
15         __shouldReleaseWhenIdle = NO;
16         __idle                  = YES;
17
18         if ( [window conformsToProtocol:@protocol(ITWindowPositioning)] ) {
19                                                            // Casts so the compiler won't gripe
20             _verticalPosition   = (ITVerticalWindowPosition)[(ITTransientStatusWindow *)window verticalPosition];
21             _horizontalPosition = (ITHorizontalWindowPosition)[(ITTransientStatusWindow *)window horizontalPosition];
22         } else {
23             NSLog(@"ITWindowEffect - initWithWindow: - window does not conform to ITWindowPositioning.");
24             _verticalPosition   = ITWindowPositionBottom;
25             _horizontalPosition = ITWindowPositionLeft;
26         }
27     }
28     return self;
29 }
30
31 - (NSWindow *)window
32 {
33     return _window;
34 }
35
36 - (void)setWindow:(NSWindow *)newWindow
37 {
38     [_window autorelease];
39     _window = [newWindow retain];
40 }
41
42 - (void)setWindowVisibility:(ITWindowVisibilityState)visibilityState
43 {
44     if ( [_window conformsToProtocol:@protocol(ITWindowMotility)] ) {
45        // Cast so the compiler won't gripe
46         [(ITTransientStatusWindow *)_window setVisibilityState:visibilityState];
47     } else {
48         NSLog(@"ITWindowEffect - setWindowVisibility: - window does not conform to ITWindowVisibility.");
49     }
50 }
51
52 - (float)effectTime
53 {
54     return _effectTime;
55 }
56
57 - (void)setEffectTime:(float)newTime
58 {
59     _effectTime = newTime;
60 }
61
62 - (void)performAppear
63 {
64     NSLog(@"ITWindowEffect does not implement performAppear.");
65 }
66
67 - (void)performVanish
68 {
69     NSLog(@"ITWindowEffect does not implement performVanish.");
70 }
71
72 - (void)cancelAppear
73 {
74     NSLog(@"ITWindowEffect does not implement cancelAppear.");
75 }
76
77 - (void)cancelVanish
78 {
79     NSLog(@"ITWindowEffect does not implement cancelVanish.");
80 }
81
82 - (void)releaseWhenIdle;
83 {
84     if ( __idle ) {
85         [self release];
86     } else {
87         __shouldReleaseWhenIdle = YES;
88     }
89 }
90
91 - (void)dealloc
92 {
93         [_window release];
94         [super dealloc];
95 }
96
97
98 @end