mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-20 22:34:10 +01:00
64 lines
1.3 KiB
Swift
64 lines
1.3 KiB
Swift
//
|
||
// SidebarOutlineView.swift
|
||
// Evergreen
|
||
//
|
||
// Created by Brent Simmons on 11/17/15.
|
||
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
||
//
|
||
|
||
import AppKit
|
||
import RSCore
|
||
import RSTree
|
||
|
||
class SidebarOutlineView : NSOutlineView {
|
||
|
||
weak var sidebarViewController: SidebarViewController?
|
||
@IBOutlet var keyboardDelegate: KeyboardDelegate!
|
||
|
||
//MARK: NSResponder
|
||
|
||
override func keyDown(with event: NSEvent) {
|
||
|
||
if keyboardDelegate.keydown(event, in: self) {
|
||
return
|
||
}
|
||
|
||
super.keyDown(with: event)
|
||
}
|
||
|
||
override func frameOfCell(atColumn column: Int, row: Int) -> NSRect {
|
||
|
||
// Don’t allow the pseudo-feeds at the top level to be indented.
|
||
|
||
var frame = super.frameOfCell(atColumn: column, row: row)
|
||
|
||
let node = item(atRow: row) as! Node
|
||
guard let parentNode = node.parent, parentNode.isRoot else {
|
||
return frame
|
||
}
|
||
guard node.representedObject is PseudoFeed else {
|
||
return frame
|
||
}
|
||
|
||
frame.origin.x -= indentationPerLevel
|
||
frame.size.width += indentationPerLevel
|
||
return frame
|
||
}
|
||
|
||
override func viewWillStartLiveResize() {
|
||
|
||
if let scrollView = self.enclosingScrollView {
|
||
scrollView.hasVerticalScroller = false
|
||
}
|
||
super.viewWillStartLiveResize()
|
||
}
|
||
|
||
override func viewDidEndLiveResize() {
|
||
|
||
if let scrollView = self.enclosingScrollView {
|
||
scrollView.hasVerticalScroller = true
|
||
}
|
||
super.viewDidEndLiveResize()
|
||
}
|
||
}
|