mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
30 lines
590 B
Swift
30 lines
590 B
Swift
//
|
|
// NSMenuExtension.swift
|
|
// PHP Monitor
|
|
//
|
|
// Created by Nico Verbruggen on 14/04/2021.
|
|
// Copyright © 2021 Nico Verbruggen. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
extension NSMenu {
|
|
|
|
open func addItem(_ newItem: NSMenuItem, withKeyModifier modifier: NSEvent.ModifierFlags) {
|
|
newItem.keyEquivalentModifierMask = modifier
|
|
self.addItem(newItem)
|
|
}
|
|
|
|
}
|
|
|
|
@IBDesignable class LocalizedMenuItem: NSMenuItem {
|
|
|
|
@IBInspectable
|
|
var localizationKey: String? {
|
|
didSet {
|
|
self.title = localizationKey?.localized ?? self.title
|
|
}
|
|
}
|
|
|
|
}
|