Issue #331
From NSSegmentedControl
The features of a segmented control include the following: A segment can have an image, text (label), menu, tooltip, and tag. A segmented control can contain images or text, but not both.
let languageMenu = NSMenu(title: "")
let languages = ["Swift", "Javascript"]
languages.forEach {
let item = NSMenuItem(title: $0, action: #selector(handleSelectLanguage(_:)), keyEquivalent: "")
item.target = self
item.isEnabled = true
languageMenu.addItem(item)
}
let themeMenu = NSMenu(title: "")
let themes = ["one dark", "one light"]
themes.forEach {
let item = NSMenuItem(title: $0, action: #selector(handleSelectLanguage(_:)), keyEquivalent: "")
item.target = self
item.isEnabled = true
themeMenu.addItem(item)
}
segment.segmentCount = 2
segment.selectedSegmentBezelColor = NSColor.red
segment.setLabel("Language", forSegment: 0)
segment.setLabel("Theme", forSegment: 1
segment.setMenu(languageMenu, forSegment: 0)
segment.setMenu(themeMenu, forSegment: 1
segment.showsMenuIndicator(forSegment: 0)
segment.showsMenuIndicator(forSegment: 1)