-
Notifications
You must be signed in to change notification settings - Fork 0
/
BarItem.m
88 lines (58 loc) · 1.66 KB
/
BarItem.m
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
//
// BarItem.m
// Bartender
//
// Created by Tom Houpt on 09/6/14.
// Copyright 2009 Behavioral Cybernetics. All rights reserved.
//
#import "BarItem.h"
@implementation BarItem
//-(id)init; {
//
// self = [super init];
//
// if (self) {
//
// }
// return self;
//
//}
-(void) setDefaults; {
// should be called by "init"
[super setDefaults];
NSLog(@"BarItem setDefaults");
unit = @"g";
onOffType = NSControlStateValueOn;
minWeight = 0;
maxWeight = 5000;
}
-(NSString *)unit; {return unit; }
-(void) setUnit:(NSString *)u; {
if (nil == u) { unit = [NSString string]; }
else { unit = [u copy]; }
}
-(double)minWeight {return minWeight; }
-(double)maxWeight {return maxWeight; }
-(NSString *)minWeightText; { return [NSString stringWithFormat:@"%lf",minWeight]; }
-(NSString *)maxWeightText; { return [NSString stringWithFormat:@"%lf",maxWeight]; }
-(void)setMinWeight:(double)newMinWeight { minWeight = newMinWeight; }
-(void)setMaxWeight:(double)newMaxWeight { maxWeight = newMaxWeight; };
-(double)minY {return minY; }
-(double)maxY {return maxY; }
-(void)setMinY:(double)newMinY { minY = newMinY; }
-(void)setMaxY:(double)newMaxY { maxY = newMaxY; }
-(int) onOffType; { return onOffType; }
-(void) setOnOffType:(int)type; { onOffType = type; }
- (id)copyWithZone:(NSZone *)zone {
BarItem *copy = [super copyWithZone:zone];
// copy using superclass BarObject routine
// copy the specific subclass properties
[copy setMinWeight:[self minWeight]];
[copy setMaxWeight:[self maxWeight]];
[copy setMinY:[self minY]];
[copy setMaxY:[self maxY]];
[copy setUnit:[self unit]];
[copy setOnOffType:[self onOffType]];
return copy;
}
@end