KMTableView.swift 561 B

12345678910111213141516171819202122232425262728
  1. //
  2. // KMTableView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2022/11/11.
  6. //
  7. import Cocoa
  8. class KMTableView: NSTableView {
  9. var menuClickedAction: ((_ clickPoint: NSPoint) -> NSMenu)?
  10. override func draw(_ dirtyRect: NSRect) {
  11. super.draw(dirtyRect)
  12. // Drawing code here.
  13. }
  14. override func menu(for event: NSEvent) -> NSMenu? {
  15. let point = event.locationInWindow
  16. if let menu = menuClickedAction?(point) {
  17. return menu
  18. }
  19. return super.menu(for: event)
  20. }
  21. }