-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFluidAppSliderCell.m
50 lines (40 loc) · 1.47 KB
/
FluidAppSliderCell.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
//
// FluidAppSliderCell.m
// FluidApp
//
#import "FluidAppSliderCell.h"
@implementation FluidAppSliderCell
- (void)drawBarInside:(NSRect)aRect flipped:(BOOL)flipped
{
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[ps setAlignment:NSCenterTextAlignment];
NSDictionary *fontBlack =
[NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:[NSColor blackColor],[NSFont fontWithName:@"Arial" size:10],ps,nil]
forKeys:
[NSArray arrayWithObjects:NSForegroundColorAttributeName,NSFontAttributeName,NSParagraphStyleAttributeName,nil]];
NSDictionary *fontWhite =
[NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:[NSColor whiteColor],[NSFont fontWithName:@"Arial" size:10],ps,nil]
forKeys:
[NSArray arrayWithObjects:NSForegroundColorAttributeName,NSFontAttributeName,NSParagraphStyleAttributeName,nil]];
NSString *szAmt = [NSString stringWithFormat:@"%0.2f", [self floatValue]];
aRect.origin.x++;
aRect.origin.y--;
[szAmt drawInRect:aRect withAttributes:fontWhite];
aRect.origin.x-=2;
[szAmt drawInRect:aRect withAttributes:fontWhite];
aRect.origin.x++;
aRect.origin.y++;
[szAmt drawInRect:aRect withAttributes:fontWhite];
aRect.origin.y-=2;
[szAmt drawInRect:aRect withAttributes:fontWhite];
aRect.origin.y++;
[szAmt drawInRect:aRect withAttributes:fontBlack];
}
- (void)drawKnob:(NSRect)knobRect
{
[super drawKnob:knobRect];
[[self controlView] setNeedsDisplay:YES];
}
@end