2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// TimelineTableRowView.swift
|
|
|
|
// Evergreen
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 8/31/15.
|
|
|
|
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-02-03 07:51:32 +01:00
|
|
|
import AppKit
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
class TimelineTableRowView : NSTableRowView {
|
|
|
|
|
2018-01-05 06:20:09 +01:00
|
|
|
var cellAppearance: TimelineCellAppearance! {
|
|
|
|
didSet {
|
|
|
|
if cellAppearance != oldValue {
|
|
|
|
invalidateGridRect()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-18 22:00:54 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
// override var interiorBackgroundStyle: NSBackgroundStyle {
|
|
|
|
// return .Light
|
|
|
|
// }
|
2018-02-18 22:00:54 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
private var cellView: TimelineTableCellView? {
|
2018-02-14 22:14:25 +01:00
|
|
|
for oneSubview in subviews {
|
|
|
|
if let foundView = oneSubview as? TimelineTableCellView {
|
|
|
|
return foundView
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
}
|
2018-02-14 22:14:25 +01:00
|
|
|
return nil
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override var isEmphasized: Bool {
|
|
|
|
didSet {
|
|
|
|
if let cellView = cellView {
|
|
|
|
cellView.isEmphasized = isEmphasized
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override var isSelected: Bool {
|
|
|
|
didSet {
|
|
|
|
if let cellView = cellView {
|
|
|
|
cellView.isSelected = isSelected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var gridRect: NSRect {
|
2018-02-14 22:14:25 +01:00
|
|
|
return NSMakeRect(0.0, NSMaxY(bounds) - 1.0, NSWidth(bounds), 1)
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-18 22:00:54 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
override func drawSeparator(in dirtyRect: NSRect) {
|
2018-01-05 06:20:09 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
let path = NSBezierPath()
|
|
|
|
let originX = floor(cellAppearance.boxLeftMargin)
|
|
|
|
let destinationX = ceil(NSMaxX(bounds))
|
|
|
|
let y = floor(NSMaxY(bounds)) - 0.5
|
|
|
|
path.move(to: NSPoint(x: originX, y: y))
|
|
|
|
path.line(to: NSPoint(x: destinationX, y: y))
|
2018-01-05 06:20:09 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
cellAppearance.gridColor.set()
|
|
|
|
path.stroke()
|
|
|
|
}
|
2018-01-05 06:20:09 +01:00
|
|
|
|
2018-02-20 00:56:15 +01:00
|
|
|
// override func draw(_ dirtyRect: NSRect) {
|
|
|
|
//
|
|
|
|
// super.draw(dirtyRect)
|
|
|
|
//
|
|
|
|
// if cellAppearance.drawsGrid && !isSelected && !isNextRowSelected {
|
|
|
|
// drawSeparator(in: dirtyRect)
|
|
|
|
// }
|
|
|
|
// }
|
2018-01-05 06:20:09 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
func invalidateGridRect() {
|
|
|
|
|
2018-02-20 00:56:15 +01:00
|
|
|
// setNeedsDisplay(gridRect)
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
}
|