2018-02-07 22:17:28 +01:00
|
|
|
//
|
|
|
|
// SidebarContextualMenuDelegate.swift
|
|
|
|
// Evergreen
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/7/18.
|
|
|
|
// Copyright © 2018 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
2018-02-10 07:10:52 +01:00
|
|
|
import RSCore
|
2018-02-07 22:17:28 +01:00
|
|
|
|
|
|
|
@objc final class SidebarContextualMenuDelegate: NSObject, NSMenuDelegate {
|
|
|
|
|
|
|
|
@IBOutlet weak var sidebarViewController: SidebarViewController?
|
|
|
|
|
|
|
|
public func menuNeedsUpdate(_ menu: NSMenu) {
|
|
|
|
|
|
|
|
guard let sidebarViewController = sidebarViewController else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
menu.removeAllItems()
|
|
|
|
|
2018-02-07 22:25:17 +01:00
|
|
|
guard let contextualMenu = sidebarViewController.contextualMenuForClickedRows() else {
|
2018-02-07 22:17:28 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-02-10 07:10:52 +01:00
|
|
|
menu.takeItems(from: contextualMenu)
|
2018-02-07 22:17:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|