forked from glushchenko/fsnotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebarTableRowView.swift
More file actions
65 lines (52 loc) · 2.2 KB
/
Copy pathSidebarTableRowView.swift
File metadata and controls
65 lines (52 loc) · 2.2 KB
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
63
64
65
//
// SidebarTableRowView.swift
// FSNotes
//
// Created by Oleksandr Glushchenko on 4/11/18.
// Copyright © 2018 Oleksandr Glushchenko. All rights reserved.
//
import Cocoa
class SidebarTableRowView: NSTableRowView {
override func drawSelection(in dirtyRect: NSRect) {
guard UserDefaults.standard.value(forKey: "AppleAccentColor") == nil else {
if self.selectionHighlightStyle != .none {
let selectionRect = NSInsetRect(self.bounds, 0, 0)
if isSelected {
if #available(macOS 10.14, *) {
let color = NSColor.init(named: "background_selected_not_fr")!
color.setStroke()
color.setFill()
let selectionPath = NSBezierPath.init(roundedRect: selectionRect, xRadius: 2, yRadius: 2)
selectionPath.fill()
selectionPath.stroke()
return
}
}
}
super.drawSelection(in: dirtyRect)
return
}
if self.selectionHighlightStyle != .none {
let selectionRect = NSInsetRect(self.bounds, 0, 0)
if isSelected {
if window?.firstResponder == ViewController.shared()?.sidebarOutlineView {
if let color = NSColor.init(named: "background_selected_fr") {
color.setStroke()
color.setFill()
}
let selectionPath = NSBezierPath.init(roundedRect: selectionRect, xRadius: 2, yRadius: 2)
selectionPath.fill()
selectionPath.stroke()
} else {
if let color = NSColor.init(named: "background_selected_not_fr") {
color.setStroke()
color.setFill()
}
let selectionPath = NSBezierPath.init(roundedRect: selectionRect, xRadius: 2, yRadius: 2)
selectionPath.fill()
selectionPath.stroke()
}
}
}
}
}