Revert "[kit] Dynamically build the style dropdown menu"

This reverts commit f6e7217b2c.
This commit is contained in:
Eryn Wells 2017-08-16 21:15:03 -07:00
parent f6e7217b2c
commit e89c858ab7

View file

@ -11,6 +11,15 @@ import Cocoa
internal let PreferencesDidChange_Color = Notification.Name("PreferencesDidChange_Color")
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
private var colorStackView = NSStackView()
@ -21,8 +30,13 @@ class PreferencesViewController: NSViewController {
button.translatesAutoresizingMaskIntoConstraints = false
let menu = NSMenu()
menu.addItem(withTitle: NSLocalizedString("Single Color", comment: "single color menu item"), action: nil, keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("Two Color Gradient — Horizontal", comment: "two color horizontal gradient menu item"), action: nil, keyEquivalent: "")
for item in PreferencesViewController.styleItems {
// 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
return button