remove IB menu and move everything to code
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
import Cocoa
|
||||
|
||||
class StatusBarController: NSObject, NSUserInterfaceValidations {
|
||||
var statusBar = NSMenu()
|
||||
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
let matchesAPI = MatchesAPI()
|
||||
var matches = [Match]()
|
||||
|
||||
func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
if let menuitem = item as? NSMenuItem {
|
||||
menuitem.state = .on
|
||||
@@ -16,12 +21,6 @@ class StatusBarController: NSObject, NSUserInterfaceValidations {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@IBOutlet weak var statusBar: NSMenu!
|
||||
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
let matchesAPI = MatchesAPI()
|
||||
var matches = [Match]()
|
||||
|
||||
override func awakeFromNib() {
|
||||
// Set the icon of the statusbar item and put it into the statusbar
|
||||
let icon = NSImage(named: "statusBarIcon")
|
||||
@@ -42,7 +41,7 @@ class StatusBarController: NSObject, NSUserInterfaceValidations {
|
||||
}
|
||||
|
||||
statusBar.addItem(NSMenuItem.separator())
|
||||
statusBar.addItem(withTitle: "Quit", action: #selector(quitClicked), keyEquivalent: "")
|
||||
statusBar.addItem(withTitle: "Quit", action: #selector(self.quitClicked), keyEquivalent: "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user