mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-26 09:33:25 +01:00
69 lines
1.3 KiB
Swift
69 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
|
|
|
|
class SidebarOutlineView : NSOutlineView {
|
|
|
|
//MARK: NSResponder
|
|
|
|
override func keyDown(with event: NSEvent) {
|
|
|
|
guard !event.rs_keyIsModified() else {
|
|
super.keyDown(with: event)
|
|
return
|
|
}
|
|
|
|
let ch = Int(event.rs_unmodifiedCharacter())
|
|
if ch == NSNotFound {
|
|
super.keyDown(with: event)
|
|
return
|
|
}
|
|
|
|
var keyHandled = false
|
|
|
|
switch(ch) {
|
|
|
|
case NSRightArrowFunctionKey:
|
|
keyHandled = true
|
|
|
|
case NSDeleteFunctionKey:
|
|
keyHandled = true
|
|
Swift.print("NSDeleteFunctionKey")
|
|
|
|
default:
|
|
keyHandled = false
|
|
}
|
|
|
|
if keyHandled {
|
|
let appInfo = AppInfo()
|
|
appInfo.navigationKey = ch
|
|
NotificationCenter.default.post(name: .AppNavigationKeyPressed, object: self, userInfo: appInfo.userInfo)
|
|
}
|
|
else {
|
|
super.keyDown(with: event)
|
|
}
|
|
}
|
|
|
|
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()
|
|
}
|
|
}
|