Add Sidebar toggle
This commit is contained in:
parent
d05b450cc5
commit
38d01eb151
|
@ -211,6 +211,11 @@ struct AppAssets {
|
||||||
return NSImage(systemSymbolName: "square.and.arrow.up", accessibilityDescription: nil)!
|
return NSImage(systemSymbolName: "square.and.arrow.up", accessibilityDescription: nil)!
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@available(macOS 11.0, *)
|
||||||
|
static var sidebarToggleImage: RSImage = {
|
||||||
|
return NSImage(systemSymbolName: "sidebar.left", accessibilityDescription: nil)!
|
||||||
|
}()
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 11.0, *)
|
||||||
static var starClosedImage: RSImage = {
|
static var starClosedImage: RSImage = {
|
||||||
return NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
return NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||||
|
|
|
@ -695,6 +695,7 @@ extension MainWindowController : ScriptingMainWindowController {
|
||||||
// MARK: - NSToolbarDelegate
|
// MARK: - NSToolbarDelegate
|
||||||
|
|
||||||
extension NSToolbarItem.Identifier {
|
extension NSToolbarItem.Identifier {
|
||||||
|
static let sidebarToggle = NSToolbarItem.Identifier("sidebarToggle")
|
||||||
static let newFeed = NSToolbarItem.Identifier("newFeed")
|
static let newFeed = NSToolbarItem.Identifier("newFeed")
|
||||||
static let newFolder = NSToolbarItem.Identifier("newFolder")
|
static let newFolder = NSToolbarItem.Identifier("newFolder")
|
||||||
static let refresh = NSToolbarItem.Identifier("refresh")
|
static let refresh = NSToolbarItem.Identifier("refresh")
|
||||||
|
@ -718,6 +719,10 @@ extension MainWindowController: NSToolbarDelegate {
|
||||||
|
|
||||||
switch itemIdentifier {
|
switch itemIdentifier {
|
||||||
|
|
||||||
|
case .sidebarToggle:
|
||||||
|
let title = NSLocalizedString("Toggle Sidebar", comment: "Toggle Sidebar")
|
||||||
|
return buildToolbarButton(.toggleSidebar, title, AppAssets.sidebarToggleImage, "toggleTheSidebar:")
|
||||||
|
|
||||||
case .refresh:
|
case .refresh:
|
||||||
let title = NSLocalizedString("Refresh", comment: "Refresh")
|
let title = NSLocalizedString("Refresh", comment: "Refresh")
|
||||||
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
|
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
|
||||||
|
@ -792,6 +797,7 @@ extension MainWindowController: NSToolbarDelegate {
|
||||||
func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
return [
|
return [
|
||||||
|
.sidebarToggle,
|
||||||
.refresh,
|
.refresh,
|
||||||
.newSidebarItemMenu,
|
.newSidebarItemMenu,
|
||||||
.sidebarTrackingSeparator,
|
.sidebarTrackingSeparator,
|
||||||
|
@ -830,6 +836,8 @@ extension MainWindowController: NSToolbarDelegate {
|
||||||
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
return [
|
return [
|
||||||
|
.sidebarToggle,
|
||||||
|
.flexibleSpace,
|
||||||
.refresh,
|
.refresh,
|
||||||
.newSidebarItemMenu,
|
.newSidebarItemMenu,
|
||||||
.sidebarTrackingSeparator,
|
.sidebarTrackingSeparator,
|
||||||
|
|
Loading…
Reference in New Issue