forked from damariei/wiiscale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFPLevelIndicator.m
More file actions
40 lines (33 loc) · 949 Bytes
/
FPLevelIndicator.m
File metadata and controls
40 lines (33 loc) · 949 Bytes
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
//
// FPLevelIndicator.m
// GoogleHealthWeight
//
// Created by Ford Parsons on 11/23/10.
// Copyright 2010 Ford Parsons. All rights reserved.
//
#import "FPLevelIndicator.h"
@implementation FPLevelIndicator
@synthesize lowCriticalValue, lowWarningValue, highWarningValue, highCriticalValue;
- (id)initWithFrame:(NSRect)frameRect
{
if(self = [super initWithFrame:frameRect])
{
[self.cell setLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle];
}
return self;
}
- (void)setDoubleValue:(double)aDouble
{
[super setDoubleValue:aDouble];
if(aDouble < lowCriticalValue || aDouble > highCriticalValue) {
[self setWarningValue:aDouble - 2];
[self setCriticalValue:aDouble - 1];
} else if(aDouble < lowWarningValue || aDouble > highWarningValue) {
[self setWarningValue:aDouble - 1];
[self setCriticalValue:aDouble + 1];
} else {
[self setWarningValue:aDouble + 1];
[self setCriticalValue:aDouble + 2];
}
}
@end