This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
DCFileUploadsRowView.j
executable file
·57 lines (48 loc) · 1.74 KB
/
DCFileUploadsRowView.j
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
@import <AppKit/CPView.j>
@import "DCProgressIndicator.j"
@implementation DCFileUploadsRowView : CPView {
CPTextField nameField;
CPProgressIndicator progressIndicator;
}
- (id)initWithFrame:(CGRect)theFrame {
self = [super initWithFrame:theFrame];
nameField = [[CPTextField alloc] initWithFrame:CGRectMake(
theFrame.origin.x + 20,
theFrame.origin.y,
theFrame.size.width - 40,
20)];
[nameField setAutoresizingMask:CPViewWidthSizable | CPViewMaxYMargin];
[nameField setLineBreakMode:CPLineBreakByTruncatingTail];
[nameField setVerticalAlignment:CPCenterVerticalTextAlignment];
[nameField setFont:[CPFont systemFontOfSize:12.0]];
[nameField setTextColor:[CPColor whiteColor]];
[nameField setBackgroundColor:[CPColor clearColor]];
[self addSubview:nameField];
progressIndicator = [[DCProgressIndicator alloc] initWithFrame:CGRectMake(
theFrame.origin.x + 20,
theFrame.origin.y + 22,
theFrame.size.width - 40,
15)];
[progressIndicator setAutoresizingMask:CPViewWidthSizable | CPViewMaxYMargin];
[progressIndicator setControlSize:CPRegularControlSize];
[progressIndicator setMinValue:0.0];
[progressIndicator setMaxValue:1.0];
[self addSubview:progressIndicator];
return self;
}
- (void)setObjectValue:(Object)anObject {
[nameField setStringValue:[anObject name]];
[progressIndicator setDoubleValue:[anObject progress]];
}
- (id)initWithCoder:(CPCoder)aCoder {
self = [super initWithCoder:aCoder];
nameField = [aCoder decodeObjectForKey:"nameField"];
progressIndicator = [aCoder decodeObjectForKey:"progressIndicator"];
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder {
[super encodeWithCoder:aCoder];
[aCoder encodeObject:nameField forKey:"nameField"];
[aCoder encodeObject:progressIndicator forKey:"progressIndicator"];
}
@end