forked from ttscoff/nv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BTTransparentScroller.m
53 lines (43 loc) · 1.63 KB
/
BTTransparentScroller.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
//
// BTTransparentScroller.m
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
// Modified by Brett Terpstra on 12/8/10.
// Copyright 2010 Circle Six Design. All rights reserved.
//
// Modified again by ElasticThreads on 03/10/11
#import "BTTransparentScroller.h"
@implementation BTTransparentScroller
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ (BOOL)isCompatibleWithOverlayScrollers {
return self == [BTTransparentScroller class];
}
#endif
- (id)initWithFrame:(NSRect)frameRect{
if ((self=[super initWithFrame:frameRect])) {
NSBundle *bundle = [NSBundle mainBundle];
knobTop = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"greyscrollerverttop3.tif"]];
knobVerticalFill = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"greyscrollervertfill3.tif"]];
knobBottom = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"greyscrollervertbottom3.tif"]];
slotTop = [NSImage imageNamed:nil];
slotVerticalFill = [NSImage imageNamed:nil];
slotBottom = [NSImage imageNamed:nil];
verticalPaddingLeft = 5.0f;
verticalPaddingRight = 4.0f;
verticalPaddingTop = 3.5f;
verticalPaddingBottom = 3.5f;
knobAlpha=0.95f;
}
return self;
}
- (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag{
if (!IsLionOrLater) {
[[NSColor whiteColor]set];
NSRectFill([self bounds]);
}else{
[super drawKnobSlotInRect:slotRect highlight:flag];
}
}
@end