forked from AlessandroSangiuliano/rik.theme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RikScrollerKnobSlotCell.m
34 lines (29 loc) · 933 Bytes
/
RikScrollerKnobSlotCell.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
#include <AppKit/AppKit.h>
#include "RikScrollerKnobSlotCell.h"
@implementation RikScrollerKnobSlotCell
@synthesize horizontal;
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
if (NSIsEmptyRect(cellFrame))
return;
// cellFrame = NSInsetRect(cellFrame, 1, 1);
NSColor * baseColor = [NSColor colorWithCalibratedRed: 0.95
green: 0.95
blue: 0.95
alpha: 1.0];
NSColor *shadowColor = [baseColor shadowWithLevel: 0.15];
NSGradient* gr = [[NSGradient alloc] initWithColorsAndLocations:
shadowColor, 1.0,
baseColor, 0.7,
baseColor, 0.5,
baseColor, 0.3,
shadowColor, 0.0,
nil];
int a = 0;
if(horizontal)
a = 90;
[gr drawInRect: cellFrame angle: a];
[shadowColor set];
NSFrameRect(cellFrame);
}
@end