mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Prefer default button implementation for standard toolbar items.
This commit is contained in:
@@ -1386,19 +1386,25 @@ private extension MainWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
func buildToolbarButton(_ itemIdentifier: NSToolbarItem.Identifier, _ title: String, _ image: NSImage, _ selector: String) -> NSToolbarItem {
|
||||
func buildToolbarButton(_ itemIdentifier: NSToolbarItem.Identifier, _ title: String, _ image: NSImage, _ selector: String, usesCustomButtonView: Bool = false) -> NSToolbarItem {
|
||||
let toolbarItem = RSToolbarItem(itemIdentifier: itemIdentifier)
|
||||
toolbarItem.autovalidates = true
|
||||
|
||||
let button = NSButton()
|
||||
button.bezelStyle = .texturedRounded
|
||||
button.image = image
|
||||
button.imageScaling = .scaleProportionallyDown
|
||||
button.action = Selector((selector))
|
||||
|
||||
toolbarItem.view = button
|
||||
toolbarItem.toolTip = title
|
||||
toolbarItem.label = title
|
||||
|
||||
if usesCustomButtonView {
|
||||
let button = NSButton()
|
||||
button.bezelStyle = .texturedRounded
|
||||
button.image = image
|
||||
button.imageScaling = .scaleProportionallyDown
|
||||
button.action = Selector((selector))
|
||||
toolbarItem.view = button
|
||||
} else {
|
||||
toolbarItem.image = image
|
||||
toolbarItem.isBordered = true
|
||||
toolbarItem.action = Selector((selector))
|
||||
}
|
||||
return toolbarItem
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user