2019-01-01 19:37:46 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-01-18 05:49:38 +00:00
|
|
|
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
|
2019-01-01 19:37:46 +00:00
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
2019-01-02 19:46:27 +00:00
|
|
|
protocol TunnelsListTableViewControllerDelegate: class {
|
2019-03-10 14:32:19 +00:00
|
|
|
func tunnelsSelected(tunnelIndices: [Int])
|
2019-01-05 12:54:45 +00:00
|
|
|
func tunnelsListEmpty()
|
2019-01-02 19:46:27 +00:00
|
|
|
}
|
|
|
|
|
2019-01-01 19:37:46 +00:00
|
|
|
class TunnelsListTableViewController: NSViewController {
|
|
|
|
|
|
|
|
let tunnelsManager: TunnelsManager
|
2019-01-02 19:46:27 +00:00
|
|
|
weak var delegate: TunnelsListTableViewControllerDelegate?
|
2019-06-13 12:55:13 +00:00
|
|
|
var isRemovingTunnelsFromWithinTheApp = false
|
2019-01-01 19:37:46 +00:00
|
|
|
|
|
|
|
let tableView: NSTableView = {
|
|
|
|
let tableView = NSTableView()
|
|
|
|
tableView.addTableColumn(NSTableColumn(identifier: NSUserInterfaceItemIdentifier("TunnelsList")))
|
|
|
|
tableView.headerView = nil
|
|
|
|
tableView.rowSizeStyle = .medium
|
2019-03-10 14:32:19 +00:00
|
|
|
tableView.allowsMultipleSelection = true
|
2019-01-01 19:37:46 +00:00
|
|
|
return tableView
|
|
|
|
}()
|
|
|
|
|
2019-02-22 11:05:46 +00:00
|
|
|
let addButton: NSPopUpButton = {
|
|
|
|
let imageItem = NSMenuItem(title: "", action: nil, keyEquivalent: "")
|
|
|
|
imageItem.image = NSImage(named: NSImage.addTemplateName)!
|
|
|
|
|
|
|
|
let menu = NSMenu()
|
|
|
|
menu.addItem(imageItem)
|
|
|
|
menu.addItem(withTitle: tr("macMenuAddEmptyTunnel"), action: #selector(handleAddEmptyTunnelAction), keyEquivalent: "n")
|
|
|
|
menu.addItem(withTitle: tr("macMenuImportTunnels"), action: #selector(handleImportTunnelAction), keyEquivalent: "o")
|
|
|
|
menu.autoenablesItems = false
|
|
|
|
|
|
|
|
let button = NSPopUpButton(frame: NSRect.zero, pullsDown: true)
|
|
|
|
button.menu = menu
|
|
|
|
button.bezelStyle = .smallSquare
|
|
|
|
(button.cell as? NSPopUpButtonCell)?.arrowPosition = .arrowAtBottom
|
|
|
|
return button
|
2019-01-01 21:34:01 +00:00
|
|
|
}()
|
|
|
|
|
2019-02-22 11:05:46 +00:00
|
|
|
let removeButton: NSButton = {
|
|
|
|
let image = NSImage(named: NSImage.removeTemplateName)!
|
|
|
|
let button = NSButton(image: image, target: self, action: #selector(handleRemoveTunnelAction))
|
|
|
|
button.bezelStyle = .smallSquare
|
|
|
|
button.imagePosition = .imageOnly
|
|
|
|
return button
|
2019-01-01 21:34:01 +00:00
|
|
|
}()
|
|
|
|
|
2019-02-22 11:05:46 +00:00
|
|
|
let actionButton: NSPopUpButton = {
|
|
|
|
let imageItem = NSMenuItem(title: "", action: nil, keyEquivalent: "")
|
|
|
|
imageItem.image = NSImage(named: NSImage.actionTemplateName)!
|
|
|
|
|
|
|
|
let menu = NSMenu()
|
|
|
|
menu.addItem(imageItem)
|
2019-03-27 12:26:38 +00:00
|
|
|
menu.addItem(withTitle: tr("macMenuViewLog"), action: #selector(handleViewLogAction), keyEquivalent: "")
|
2019-02-22 11:05:46 +00:00
|
|
|
menu.addItem(withTitle: tr("macMenuExportTunnels"), action: #selector(handleExportTunnelsAction), keyEquivalent: "")
|
|
|
|
menu.autoenablesItems = false
|
|
|
|
|
|
|
|
let button = NSPopUpButton(frame: NSRect.zero, pullsDown: true)
|
|
|
|
button.menu = menu
|
|
|
|
button.bezelStyle = .smallSquare
|
|
|
|
(button.cell as? NSPopUpButtonCell)?.arrowPosition = .arrowAtBottom
|
|
|
|
return button
|
2019-01-01 21:34:01 +00:00
|
|
|
}()
|
|
|
|
|
2019-01-01 19:37:46 +00:00
|
|
|
init(tunnelsManager: TunnelsManager) {
|
|
|
|
self.tunnelsManager = tunnelsManager
|
|
|
|
super.init(nibName: nil, bundle: nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override func loadView() {
|
|
|
|
tableView.dataSource = self
|
|
|
|
tableView.delegate = self
|
2019-01-24 13:05:07 +00:00
|
|
|
|
2019-03-18 06:27:09 +00:00
|
|
|
tableView.doubleAction = #selector(listDoubleClicked(sender:))
|
|
|
|
|
2019-01-24 13:05:07 +00:00
|
|
|
let isSelected = selectTunnelInOperation() || selectTunnel(at: 0)
|
2019-01-05 12:54:45 +00:00
|
|
|
if !isSelected {
|
|
|
|
delegate?.tunnelsListEmpty()
|
|
|
|
}
|
2019-03-19 02:25:38 +00:00
|
|
|
tableView.allowsEmptySelection = false
|
2019-01-01 19:37:46 +00:00
|
|
|
|
|
|
|
let scrollView = NSScrollView()
|
|
|
|
scrollView.hasVerticalScroller = true
|
|
|
|
scrollView.autohidesScrollers = true
|
2019-01-02 12:52:07 +00:00
|
|
|
scrollView.borderType = .bezelBorder
|
2019-01-01 19:37:46 +00:00
|
|
|
|
|
|
|
let clipView = NSClipView()
|
|
|
|
clipView.documentView = tableView
|
|
|
|
scrollView.contentView = clipView
|
|
|
|
|
2019-02-22 11:05:46 +00:00
|
|
|
let buttonBar = NSStackView(views: [addButton, removeButton, actionButton])
|
|
|
|
buttonBar.orientation = .horizontal
|
|
|
|
buttonBar.spacing = -1
|
|
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
|
|
|
removeButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 26),
|
|
|
|
removeButton.topAnchor.constraint(equalTo: buttonBar.topAnchor),
|
|
|
|
removeButton.bottomAnchor.constraint(equalTo: buttonBar.bottomAnchor)
|
|
|
|
])
|
|
|
|
|
2019-01-02 13:27:09 +00:00
|
|
|
let fillerButton = FillerButton()
|
|
|
|
|
2019-01-01 21:34:01 +00:00
|
|
|
let containerView = NSView()
|
|
|
|
containerView.addSubview(scrollView)
|
|
|
|
containerView.addSubview(buttonBar)
|
2019-01-02 13:27:09 +00:00
|
|
|
containerView.addSubview(fillerButton)
|
2019-01-01 21:34:01 +00:00
|
|
|
scrollView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
buttonBar.translatesAutoresizingMaskIntoConstraints = false
|
2019-01-02 13:27:09 +00:00
|
|
|
fillerButton.translatesAutoresizingMaskIntoConstraints = false
|
2019-01-01 21:34:01 +00:00
|
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
|
|
|
containerView.topAnchor.constraint(equalTo: scrollView.topAnchor),
|
|
|
|
containerView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor),
|
|
|
|
containerView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor),
|
2019-01-02 12:52:07 +00:00
|
|
|
scrollView.bottomAnchor.constraint(equalTo: buttonBar.topAnchor, constant: 1),
|
2019-01-01 21:34:01 +00:00
|
|
|
containerView.leadingAnchor.constraint(equalTo: buttonBar.leadingAnchor),
|
2019-01-02 13:27:09 +00:00
|
|
|
containerView.bottomAnchor.constraint(equalTo: buttonBar.bottomAnchor),
|
|
|
|
scrollView.bottomAnchor.constraint(equalTo: fillerButton.topAnchor, constant: 1),
|
|
|
|
containerView.bottomAnchor.constraint(equalTo: fillerButton.bottomAnchor),
|
|
|
|
buttonBar.trailingAnchor.constraint(equalTo: fillerButton.leadingAnchor, constant: 1),
|
|
|
|
fillerButton.trailingAnchor.constraint(equalTo: containerView.trailingAnchor)
|
2019-01-01 21:34:01 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
2019-02-15 10:10:08 +00:00
|
|
|
containerView.widthAnchor.constraint(equalToConstant: 180),
|
2019-01-01 21:34:01 +00:00
|
|
|
containerView.heightAnchor.constraint(greaterThanOrEqualToConstant: 120)
|
|
|
|
])
|
|
|
|
|
2019-02-22 11:05:46 +00:00
|
|
|
addButton.menu?.items.forEach { $0.target = self }
|
|
|
|
actionButton.menu?.items.forEach { $0.target = self }
|
2019-01-01 21:34:01 +00:00
|
|
|
|
|
|
|
view = containerView
|
|
|
|
}
|
|
|
|
|
2019-01-24 13:05:07 +00:00
|
|
|
override func viewWillAppear() {
|
|
|
|
selectTunnelInOperation()
|
|
|
|
}
|
|
|
|
|
|
|
|
@discardableResult
|
|
|
|
func selectTunnelInOperation() -> Bool {
|
|
|
|
if let currentTunnel = tunnelsManager.tunnelInOperation(), let indexToSelect = tunnelsManager.index(of: currentTunnel) {
|
|
|
|
return selectTunnel(at: indexToSelect)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-01-16 19:08:44 +00:00
|
|
|
@objc func handleAddEmptyTunnelAction() {
|
2019-01-08 19:47:46 +00:00
|
|
|
let tunnelEditVC = TunnelEditViewController(tunnelsManager: tunnelsManager, tunnel: nil)
|
2019-02-05 11:09:19 +00:00
|
|
|
tunnelEditVC.delegate = self
|
2019-01-08 19:47:46 +00:00
|
|
|
presentAsSheet(tunnelEditVC)
|
2019-01-01 21:34:01 +00:00
|
|
|
}
|
|
|
|
|
2019-01-16 19:08:44 +00:00
|
|
|
@objc func handleImportTunnelAction() {
|
2019-01-05 13:46:16 +00:00
|
|
|
ImportPanelPresenter.presentImportPanel(tunnelsManager: tunnelsManager, sourceVC: self)
|
2019-01-01 21:34:01 +00:00
|
|
|
}
|
|
|
|
|
2019-01-16 19:08:44 +00:00
|
|
|
@objc func handleRemoveTunnelAction() {
|
2019-01-04 14:39:28 +00:00
|
|
|
guard let window = view.window else { return }
|
2019-04-06 09:52:05 +00:00
|
|
|
|
2019-04-05 13:52:42 +00:00
|
|
|
let selectedTunnelIndices = tableView.selectedRowIndexes.sorted().filter { $0 >= 0 && $0 < tunnelsManager.numberOfTunnels() }
|
|
|
|
guard !selectedTunnelIndices.isEmpty else { return }
|
2019-04-06 09:52:05 +00:00
|
|
|
var nextSelection = selectedTunnelIndices.last! + 1
|
|
|
|
if nextSelection >= tunnelsManager.numberOfTunnels() {
|
|
|
|
nextSelection = max(selectedTunnelIndices.first! - 1, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
let alert = DeleteTunnelsConfirmationAlert()
|
2019-04-05 13:52:42 +00:00
|
|
|
if selectedTunnelIndices.count == 1 {
|
|
|
|
let firstSelectedTunnel = tunnelsManager.tunnel(at: selectedTunnelIndices.first!)
|
|
|
|
alert.messageText = tr(format: "macDeleteTunnelConfirmationAlertMessage (%@)", firstSelectedTunnel.name)
|
2019-03-10 14:32:19 +00:00
|
|
|
} else {
|
2019-04-05 13:52:42 +00:00
|
|
|
alert.messageText = tr(format: "macDeleteMultipleTunnelsConfirmationAlertMessage (%d)", selectedTunnelIndices.count)
|
2019-03-10 14:32:19 +00:00
|
|
|
}
|
2019-01-04 14:39:28 +00:00
|
|
|
alert.informativeText = tr("macDeleteTunnelConfirmationAlertInfo")
|
2019-04-06 09:52:05 +00:00
|
|
|
alert.onDeleteClicked = { [weak self] completion in
|
2019-04-05 13:52:42 +00:00
|
|
|
guard let self = self else { return }
|
2019-04-06 09:52:05 +00:00
|
|
|
self.selectTunnel(at: nextSelection)
|
|
|
|
let selectedTunnels = selectedTunnelIndices.map { self.tunnelsManager.tunnel(at: $0) }
|
2019-06-13 12:55:13 +00:00
|
|
|
self.isRemovingTunnelsFromWithinTheApp = true
|
2019-04-06 09:52:05 +00:00
|
|
|
self.tunnelsManager.removeMultiple(tunnels: selectedTunnels) { [weak self] error in
|
|
|
|
guard let self = self else { return }
|
2019-06-13 12:55:13 +00:00
|
|
|
self.isRemovingTunnelsFromWithinTheApp = false
|
2019-04-06 09:52:05 +00:00
|
|
|
defer { completion() }
|
|
|
|
if let error = error {
|
|
|
|
ErrorPresenter.showErrorAlert(error: error, from: self)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
2019-01-04 14:39:28 +00:00
|
|
|
}
|
2019-04-06 09:52:05 +00:00
|
|
|
alert.beginSheetModal(for: window)
|
2019-04-05 13:52:42 +00:00
|
|
|
}
|
|
|
|
|
2019-03-27 12:26:38 +00:00
|
|
|
@objc func handleViewLogAction() {
|
|
|
|
let logVC = LogViewController()
|
|
|
|
self.presentAsSheet(logVC)
|
2019-01-01 21:34:01 +00:00
|
|
|
}
|
2019-01-04 10:55:57 +00:00
|
|
|
|
2019-01-16 19:08:44 +00:00
|
|
|
@objc func handleExportTunnelsAction() {
|
2019-02-06 02:23:51 +00:00
|
|
|
PrivateDataConfirmation.confirmAccess(to: tr("macExportPrivateData")) { [weak self] in
|
|
|
|
guard let self = self else { return }
|
|
|
|
guard let window = self.view.window else { return }
|
|
|
|
let savePanel = NSSavePanel()
|
|
|
|
savePanel.allowedFileTypes = ["zip"]
|
|
|
|
savePanel.prompt = tr("macSheetButtonExportZip")
|
|
|
|
savePanel.nameFieldLabel = tr("macNameFieldExportZip")
|
|
|
|
savePanel.nameFieldStringValue = "wireguard-export.zip"
|
|
|
|
let tunnelsManager = self.tunnelsManager
|
|
|
|
savePanel.beginSheetModal(for: window) { [weak tunnelsManager] response in
|
|
|
|
guard let tunnelsManager = tunnelsManager else { return }
|
|
|
|
guard response == .OK else { return }
|
|
|
|
guard let destinationURL = savePanel.url else { return }
|
|
|
|
let count = tunnelsManager.numberOfTunnels()
|
|
|
|
let tunnelConfigurations = (0 ..< count).compactMap { tunnelsManager.tunnel(at: $0).tunnelConfiguration }
|
|
|
|
ZipExporter.exportConfigFiles(tunnelConfigurations: tunnelConfigurations, to: destinationURL) { [weak self] error in
|
|
|
|
if let error = error {
|
|
|
|
ErrorPresenter.showErrorAlert(error: error, from: self)
|
|
|
|
return
|
|
|
|
}
|
2019-01-04 10:55:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-01 19:37:46 +00:00
|
|
|
}
|
2019-01-03 17:46:44 +00:00
|
|
|
|
2019-03-18 06:27:09 +00:00
|
|
|
@objc func listDoubleClicked(sender: AnyObject) {
|
|
|
|
let tunnelIndex = tableView.clickedRow
|
|
|
|
guard tunnelIndex >= 0 && tunnelIndex < tunnelsManager.numberOfTunnels() else { return }
|
|
|
|
let tunnel = tunnelsManager.tunnel(at: tunnelIndex)
|
|
|
|
if tunnel.status == .inactive {
|
|
|
|
tunnelsManager.startActivation(of: tunnel)
|
|
|
|
} else if tunnel.status == .active {
|
|
|
|
tunnelsManager.startDeactivation(of: tunnel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 17:46:44 +00:00
|
|
|
@discardableResult
|
2019-01-04 14:39:28 +00:00
|
|
|
private func selectTunnel(at index: Int) -> Bool {
|
|
|
|
if index < tunnelsManager.numberOfTunnels() {
|
2019-02-22 12:48:51 +00:00
|
|
|
tableView.scrollRowToVisible(index)
|
2019-01-04 14:39:28 +00:00
|
|
|
tableView.selectRowIndexes(IndexSet(integer: index), byExtendingSelection: false)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
2019-01-03 17:46:44 +00:00
|
|
|
}
|
2019-01-01 19:37:46 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 11:09:19 +00:00
|
|
|
extension TunnelsListTableViewController: TunnelEditViewControllerDelegate {
|
|
|
|
func tunnelSaved(tunnel: TunnelContainer) {
|
|
|
|
if let tunnelIndex = tunnelsManager.index(of: tunnel), tunnelIndex >= 0 {
|
|
|
|
self.selectTunnel(at: tunnelIndex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func tunnelEditingCancelled() {
|
|
|
|
// Nothing to do
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-04 13:03:46 +00:00
|
|
|
extension TunnelsListTableViewController {
|
|
|
|
func tunnelAdded(at index: Int) {
|
|
|
|
tableView.insertRows(at: IndexSet(integer: index), withAnimation: .slideLeft)
|
2019-01-05 13:48:36 +00:00
|
|
|
if tunnelsManager.numberOfTunnels() == 1 {
|
|
|
|
selectTunnel(at: 0)
|
|
|
|
}
|
2019-01-08 21:34:41 +00:00
|
|
|
if !NSApp.isActive {
|
|
|
|
// macOS's VPN prompt might have caused us to lose focus
|
|
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
|
|
}
|
2019-01-04 13:03:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func tunnelModified(at index: Int) {
|
|
|
|
tableView.reloadData(forRowIndexes: IndexSet(integer: index), columnIndexes: IndexSet(integer: 0))
|
|
|
|
}
|
|
|
|
|
|
|
|
func tunnelMoved(from oldIndex: Int, to newIndex: Int) {
|
|
|
|
tableView.moveRow(at: oldIndex, to: newIndex)
|
|
|
|
}
|
|
|
|
|
|
|
|
func tunnelRemoved(at index: Int) {
|
2019-06-13 12:55:13 +00:00
|
|
|
let selectedIndices = tableView.selectedRowIndexes
|
|
|
|
let isSingleSelectedTunnelBeingRemoved = selectedIndices.contains(index) && selectedIndices.count == 1
|
2019-01-04 13:03:46 +00:00
|
|
|
tableView.removeRows(at: IndexSet(integer: index), withAnimation: .slideLeft)
|
2019-01-05 12:54:45 +00:00
|
|
|
if tunnelsManager.numberOfTunnels() == 0 {
|
|
|
|
delegate?.tunnelsListEmpty()
|
2019-06-13 12:55:13 +00:00
|
|
|
} else if !isRemovingTunnelsFromWithinTheApp && isSingleSelectedTunnelBeingRemoved {
|
|
|
|
let newSelection = min(index, tunnelsManager.numberOfTunnels() - 1)
|
|
|
|
tableView.selectRowIndexes(IndexSet(integer: newSelection), byExtendingSelection: false)
|
2019-01-05 12:54:45 +00:00
|
|
|
}
|
2019-01-04 13:03:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-01 19:37:46 +00:00
|
|
|
extension TunnelsListTableViewController: NSTableViewDataSource {
|
|
|
|
func numberOfRows(in tableView: NSTableView) -> Int {
|
|
|
|
return tunnelsManager.numberOfTunnels()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension TunnelsListTableViewController: NSTableViewDelegate {
|
|
|
|
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
2019-01-07 07:34:50 +00:00
|
|
|
let cell: TunnelListRow = tableView.dequeueReusableCell()
|
2019-01-01 19:37:46 +00:00
|
|
|
cell.tunnel = tunnelsManager.tunnel(at: row)
|
|
|
|
return cell
|
|
|
|
}
|
2019-01-02 19:46:27 +00:00
|
|
|
|
|
|
|
func tableViewSelectionDidChange(_ notification: Notification) {
|
2019-03-10 14:32:19 +00:00
|
|
|
let selectedTunnelIndices = tableView.selectedRowIndexes.sorted()
|
|
|
|
if !selectedTunnelIndices.isEmpty {
|
|
|
|
delegate?.tunnelsSelected(tunnelIndices: tableView.selectedRowIndexes.sorted())
|
|
|
|
}
|
2019-01-02 19:46:27 +00:00
|
|
|
}
|
2019-01-01 19:37:46 +00:00
|
|
|
}
|
2019-01-02 13:27:09 +00:00
|
|
|
|
2019-05-09 13:28:12 +00:00
|
|
|
extension TunnelsListTableViewController {
|
|
|
|
override func keyDown(with event: NSEvent) {
|
|
|
|
if event.specialKey == .delete {
|
|
|
|
handleRemoveTunnelAction()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-12 06:22:36 +00:00
|
|
|
extension TunnelsListTableViewController: NSMenuItemValidation {
|
|
|
|
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
|
|
|
if menuItem.action == #selector(TunnelsListTableViewController.handleRemoveTunnelAction) {
|
|
|
|
return !tableView.selectedRowIndexes.isEmpty
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-02 13:27:09 +00:00
|
|
|
class FillerButton: NSButton {
|
|
|
|
override var intrinsicContentSize: NSSize {
|
|
|
|
return NSSize(width: NSView.noIntrinsicMetric, height: NSView.noIntrinsicMetric)
|
|
|
|
}
|
|
|
|
|
|
|
|
init() {
|
|
|
|
super.init(frame: CGRect.zero)
|
|
|
|
title = ""
|
|
|
|
bezelStyle = .smallSquare
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override func mouseDown(with event: NSEvent) {
|
|
|
|
// Eat mouseDown event, so that the button looks enabled but is unresponsive
|
|
|
|
}
|
|
|
|
}
|