1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 10:02:36 +03:00
vimr/VimR/OpenQuicklyFileViewRow.swift
2017-10-22 14:33:18 +02:00

28 lines
651 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Cocoa
class OpenQuicklyFileViewRow: NSTableRowView {
override func drawSelection(in dirtyRect: NSRect) {
if self.isSelected {
NSColor.selectedControlColor.set()
} else {
NSColor.clear.set()
}
self.rectsBeingDrawn().forEach { NSIntersectionRect($0, dirtyRect).fill(using: .sourceOver) }
}
fileprivate func rectsBeingDrawn() -> [CGRect] {
var rectsPtr: UnsafePointer<CGRect>? = nil
var count: Int = 0
self.getRectsBeingDrawn(&rectsPtr, count: &count)
return Array(UnsafeBufferPointer(start: rectsPtr, count: count))
}
}