1234567891011121314151617181920212223 |
- //
- // KMMenuTableView.swift
- // PDF Master
- //
- // Created by tangchao on 2022/12/16.
- //
- import Cocoa
- protocol KMMenuTableViewDelegate: NSObjectProtocol {
- func km_menu(for event: NSEvent) -> NSMenu?
- }
- class KMMenuTableView: NSTableView {
- weak var menuDelegate: KMMenuTableViewDelegate!
- override func menu(for event: NSEvent) -> NSMenu? {
- guard let myDelegate = self.menuDelegate else {
- return super.menu(for: event)
- }
-
- return myDelegate.km_menu(for: event)
- }
- }
|