blob: 28449049b5563b2a9417309b88af000055b27d40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#import "DownloadStatusView.h"
@implementation DownloadStatusView (NSCoding)
- (id)initWithCoder: (NSCoder *)aCoder
{
self = [super initWithCoder: aCoder];
if ([aCoder allowsKeyedCoding]) {
theFilename = [aCoder decodeObjectForKey: @"filename"];
theIcon = [aCoder decodeObjectForKey: @"icon"];
theProgressBar = [aCoder decodeObjectForKey: @"progressBar"];
theButton = [aCoder decodeObjectForKey: @"button"];
} else {
theFilename = [aCoder decodeObject];
theIcon = [aCoder decodeObject];
theProgressBar = [aCoder decodeObject];
theButton = [aCoder decodeObject];
}
[theFilename retain];
[theIcon retain];
[theProgressBar retain];
[theButton retain];
return self;
}
- (void)encodeWithCoder: (NSCoder *)aCoder
{
if ([aCoder allowsKeyedCoding]) {
[aCoder encodeObject: theFilename forKey: @"filename"];
[aCoder encodeObject: theIcon forKey: @"icon"];
[aCoder encodeObject: theProgressBar forKey: @"progressBar"];
[aCoder encodeObject: theButton forKey: @"button"];
} else {
[aCoder encodeObject: theFilename];
[aCoder encodeObject: theIcon];
[aCoder encodeObject: theProgressBar];
[aCoder encodeObject: theButton];
}
[super encodeWithCoder: aCoder];
}
@end
@implementation DownloadStatusView (NSViewSubclass)
- (id)initWithFrame:(NSRect)frameRect
{
self = [super initWithFrame:frameRect];
return self;
}
- (void)drawRect:(NSRect)rect
{
[super drawRect: rect];
}
@end
@implementation DownloadStatusView
- (void)dealloc
{
[self setFileHandle: nil];
[super dealloc];
}
- (LiFileHandle *)fileHandle
{
return theFileHandle;
}
- (void)setFileHandle: (LiFileHandle *)aFileHandle
{
[aFileHandle retain];
[theFileHandle release];
theFileHandle = aFileHandle;
}
- (void)setIcon: (NSImage *)anIcon
{
[theIcon setImage: anIcon];
}
- (void)setFilename: (NSString *)aFilename
{
[theFilename setStringValue: aFilename];
}
- (void)setProgress: (double)aProgress
{
[theProgressBar setDoubleValue: aProgress];
}
- (void)setButtonImage: (NSImage *)anImage
{
[theButton setImage: anImage];
}
- (void)setButtonAltImage: (NSImage *)anImage
{
[theButton setAlternateImage: anImage];
}
- (void)setButtonTarget: (id)aTarget
{
[theButton setTarget: aTarget];
}
- (void)setButtonAction: (SEL)anAction
{
[theButton setAction: anAction];
}
@synthesize theFileHandle;
@synthesize theButton;
@synthesize theProgressBar;
@synthesize theIcon;
@synthesize theFilename;
@end
|