-
Notifications
You must be signed in to change notification settings - Fork 34
/
KKRow.m
executable file
·62 lines (49 loc) · 1.46 KB
/
KKRow.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
//
// CategoryRow.m
// KnockKnock
//
// Created by Patrick Wardle on 4/4/15.
// Copyright (c) 2015 Objective-See. All rights reserved.
//
#import "KKRow.h"
#import "Utilities.h"
@implementation KKRow
//custom row selection
-(void)drawSelectionInRect:(NSRect)dirtyRect
{
//selection rect
NSRect selectionRect = {0};
//selection path
NSBezierPath *selectionPath = nil;
//highlight selected rows
if(self.selectionHighlightStyle != NSTableViewSelectionHighlightStyleNone)
{
//make selection rect
selectionRect = NSInsetRect(self.bounds, 10.0, 1.0);
//dark mode highlight
if(YES == isDarkMode())
{
//set stroke
[[NSColor colorWithCalibratedWhite:.25 alpha:1.0] setStroke];
//set fill
[[NSColor colorWithCalibratedWhite:.50 alpha:1.0] setFill];
}
//light mode highlight
else
{
//set stroke
[[NSColor colorWithCalibratedWhite:.65 alpha:1.0] setStroke];
//set fill
[[NSColor colorWithCalibratedWhite:.82 alpha:1.0] setFill];
}
//create selection path
// ...with rounded corners
selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:5 yRadius:5];
//fill
[selectionPath fill];
//stroke
[selectionPath stroke];
}
return;
}
@end