NetNewsWire/Evergreen/MainWindow/Sidebar/SidebarContextualMenuDelegate.swift

32 lines
641 B
Swift
Raw Normal View History

//
// 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
@objc final class SidebarContextualMenuDelegate: NSObject, NSMenuDelegate {
@IBOutlet weak var sidebarViewController: SidebarViewController?
public func menuNeedsUpdate(_ menu: NSMenu) {
guard let sidebarViewController = sidebarViewController else {
return
}
menu.removeAllItems()
guard let contextualMenu = sidebarViewController.contextualMenuForClickedRows() else {
return
}
2018-02-10 07:10:52 +01:00
menu.takeItems(from: contextualMenu)
}
}