KMSeparatorCell.swift 708 B

12345678910111213141516171819202122
  1. //
  2. // KMSeparatorCell.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2024/2/21.
  6. //
  7. import Cocoa
  8. let SEPARATOR_LEFT_INDENT = 4.0
  9. let SEPARATOR_RIGHT_INDENT = 2.0
  10. class KMSeparatorCell: NSCell {
  11. override func draw(withFrame cellFrame: NSRect, in controlView: NSView) {
  12. NSGraphicsContext.saveGraphicsState()
  13. NSColor.gridColor.setStroke()
  14. NSBezierPath.defaultLineWidth = 1.0
  15. NSBezierPath.strokeLine(from: NSPoint(x: cellFrame.minX + SEPARATOR_LEFT_INDENT, y: floor(cellFrame.midY) + 0.5),
  16. to: NSPoint(x: cellFrame.maxX - SEPARATOR_RIGHT_INDENT, y: floor(cellFrame.midY) + 0.5))
  17. NSGraphicsContext.restoreGraphicsState()
  18. }
  19. }