Revert "[kit] Dynamically build the style dropdown menu"
This reverts commit f6e7217b2c
.
This commit is contained in:
parent
f6e7217b2c
commit
e89c858ab7
1 changed files with 16 additions and 2 deletions
|
@ -11,6 +11,15 @@ import Cocoa
|
||||||
internal let PreferencesDidChange_Color = Notification.Name("PreferencesDidChange_Color")
|
internal let PreferencesDidChange_Color = Notification.Name("PreferencesDidChange_Color")
|
||||||
|
|
||||||
class PreferencesViewController: NSViewController {
|
class PreferencesViewController: NSViewController {
|
||||||
|
private static var styleItems: [(name: String, tag: Int)] {
|
||||||
|
return [
|
||||||
|
(name: NSLocalizedString("Single Color", comment: "single color menu item"),
|
||||||
|
tag: Int(ColorStyle.singleColor.rawValue)),
|
||||||
|
(name: NSLocalizedString("Two Color Gradient — Horizontal", comment: "two color horizontal gradient menu item"),
|
||||||
|
tag: Int(ColorStyle.gradient2Horizontal.rawValue)),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
public var defaults = UserDefaults.standard
|
public var defaults = UserDefaults.standard
|
||||||
|
|
||||||
private var colorStackView = NSStackView()
|
private var colorStackView = NSStackView()
|
||||||
|
@ -21,8 +30,13 @@ class PreferencesViewController: NSViewController {
|
||||||
button.translatesAutoresizingMaskIntoConstraints = false
|
button.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
let menu = NSMenu()
|
let menu = NSMenu()
|
||||||
menu.addItem(withTitle: NSLocalizedString("Single Color", comment: "single color menu item"), action: nil, keyEquivalent: "")
|
for item in PreferencesViewController.styleItems {
|
||||||
menu.addItem(withTitle: NSLocalizedString("Two Color Gradient — Horizontal", comment: "two color horizontal gradient menu item"), action: nil, keyEquivalent: "")
|
// TODO: Set action here.
|
||||||
|
let menuItem = NSMenuItem(title: item.name, action: nil, keyEquivalent: "")
|
||||||
|
menuItem.target = self
|
||||||
|
menuItem.tag = item.tag
|
||||||
|
menu.addItem(menuItem)
|
||||||
|
}
|
||||||
button.menu = menu
|
button.menu = menu
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue