Fairly large ITTSW checkin.
[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
16         if ( [window conformsToProtocol:@protocol(ITWindowPositioning)] ) {
17                                                            // Casts so the compiler won't gripe
18             _verticalPosition   = (ITVerticalWindowPosition)[(ITTransientStatusWindow *)window verticalPosition];
19             _horizontalPosition = (ITHorizontalWindowPosition)[(ITTransientStatusWindow *)window horizontalPosition];
20         } else {
21             NSLog(@"ITWindowEffect - initWithWindow: - window does not conform to ITWindowPositioning.");
22             _verticalPosition   = ITWindowPositionBottom;
23             _horizontalPosition = ITWindowPositionLeft;
24         }
25     }
26     return self;
27 }
28
29 - (NSWindow *)window
30 {
31     return _window;
32 }
33
34 - (void)setWindow:(NSWindow *)newWindow
35 {
36     [_window autorelease];
37     _window = [newWindow retain];
38 }
39
40 - (void)setWindowVisibility:(ITWindowVisibilityState)visibilityState
41 {
42     if ( [_window conformsToProtocol:@protocol(ITWindowMotility)] ) {
43        // Cast so the compiler won't gripe
44         [(ITTransientStatusWindow *)_window setVisibilityState:visibilityState];
45     } else {
46         NSLog(@"ITWindowEffect - setWindowVisibility: - window does not conform to ITWindowVisibility.");
47     }
48 }
49
50 - (float)effectTime
51 {
52     return _effectTime;
53 }
54
55 - (void)setEffectTime:(float)newTime
56 {
57     _effectTime = newTime;
58 }
59
60 - (void)performAppear
61 {
62     NSLog(@"ITWindowEffect does not implement performAppear.");
63 }
64
65 - (void)performVanish
66 {
67     NSLog(@"ITWindowEffect does not implement performVanish.");
68 }
69
70 - (void)cancelAppear
71 {
72     NSLog(@"ITWindowEffect does not implement cancelAppear.");
73 }
74
75 - (void)cancelVanish
76 {
77     NSLog(@"ITWindowEffect does not implement cancelVanish.");
78 }
79
80 - (void)dealloc
81 {
82         [_window release];
83         [super dealloc];
84 }
85
86
87 @end