2018-02-08 22:24:43 +01:00
|
|
|
//
|
|
|
|
// TimelineContextualMenuDelegate.swift
|
|
|
|
// Evergreen
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/8/18.
|
|
|
|
// Copyright © 2018 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
2018-02-10 08:16:12 +01:00
|
|
|
import RSCore
|
2018-02-08 22:24:43 +01:00
|
|
|
|
|
|
|
@objc final class TimelineContextualMenuDelegate: NSObject, NSMenuDelegate {
|
|
|
|
|
|
|
|
@IBOutlet weak var timelineViewController: TimelineViewController?
|
|
|
|
|
|
|
|
public func menuNeedsUpdate(_ menu: NSMenu) {
|
|
|
|
|
2018-02-10 08:16:12 +01:00
|
|
|
guard let timelineViewController = timelineViewController else {
|
|
|
|
return
|
|
|
|
}
|
2018-02-08 22:24:43 +01:00
|
|
|
|
2018-02-10 08:16:12 +01:00
|
|
|
menu.removeAllItems()
|
2018-02-08 22:24:43 +01:00
|
|
|
|
2018-02-10 08:16:12 +01:00
|
|
|
guard let contextualMenu = timelineViewController.contextualMenuForClickedRows() else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
menu.takeItems(from: contextualMenu)
|
2018-02-08 22:24:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|