Make Extension Point maintenance Voice Over compatible

This commit is contained in:
Maurice Parker 2020-10-27 20:18:26 -05:00
parent de2171bbd0
commit 8f08d0d691
3 changed files with 37 additions and 16 deletions

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -32,7 +33,7 @@
<tableViewGridLines key="gridStyleMask" horizontal="YES"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="475" minWidth="40" maxWidth="1000" id="SlU-lH-CzT">
<tableColumn width="466" minWidth="40" maxWidth="1000" id="SlU-lH-CzT">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -49,7 +50,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" spacing="17" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iCD-Yx-4V5">
<rect key="frame" x="20" y="8" width="173" height="24"/>
<rect key="frame" x="20" y="8" width="174" height="24"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="KmN-Zk-TBU">
<rect key="frame" x="0.0" y="0.0" width="24" height="24"/>
@ -60,7 +61,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="oGL-yl-27S"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="uyu-5W-IaW">
<rect key="frame" x="39" y="1" width="136" height="23"/>
<rect key="frame" x="39" y="0.0" width="137" height="24"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="iOW-VJ-bkx">
<font key="font" metaFont="system" size="20"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -77,6 +78,17 @@
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<button id="y48-E2-CL3">
<rect key="frame" x="0.0" y="0.0" width="475" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="yf7-Ye-Pcd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="pressed:" target="EGi-CQ-lPc" id="hgF-B0-Dyh"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="iCD-Yx-4V5" firstAttribute="centerY" secondItem="EGi-CQ-lPc" secondAttribute="centerY" id="IS1-7W-BWY"/>
@ -94,7 +106,7 @@
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="qOf-Dj-ubR">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<rect key="frame" x="1" y="255" width="478" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="XFQ-Xy-wny">

View File

@ -8,9 +8,21 @@
import AppKit
protocol ExtensionPointTableCellViewDelegate: class {
func addExtensionPoint(_ extensionPointType: ExtensionPoint.Type)
}
class ExtensionPointAddTableCellView: NSTableCellView {
weak var delegate: ExtensionPointTableCellViewDelegate?
var extensionPointType: ExtensionPoint.Type?
@IBOutlet weak var templateImageView: NSImageView?
@IBOutlet weak var titleLabel: NSTextField?
@IBAction func pressed(_ sender: Any) {
guard let extensionPointType = extensionPointType else { return }
delegate?.addExtensionPoint(extensionPointType)
}
}

View File

@ -43,6 +43,7 @@ extension ExtensionPointAddViewController: NSTableViewDataSource {
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return nil
}
}
// MARK: - NSTableViewDelegate
@ -50,9 +51,10 @@ extension ExtensionPointAddViewController: NSTableViewDataSource {
extension ExtensionPointAddViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "Cell"), owner: nil) as? ExtensionPointAddTableCellView {
let extensionPointType = availableExtensionPointTypes[row]
cell.extensionPointType = extensionPointType
cell.delegate = self
cell.titleLabel?.stringValue = extensionPointType.title
cell.imageView?.image = extensionPointType.templateImage
return cell
@ -60,20 +62,15 @@ extension ExtensionPointAddViewController: NSTableViewDelegate {
return nil
}
func tableViewSelectionDidChange(_ notification: Notification) {
let selectedRow = tableView.selectedRow
guard selectedRow != -1 else {
return
}
}
let extensionPointType = availableExtensionPointTypes[selectedRow]
extension ExtensionPointAddViewController: ExtensionPointTableCellViewDelegate {
func addExtensionPoint(_ extensionPointType: ExtensionPoint.Type) {
let windowController = ExtensionPointEnableWindowController()
windowController.extensionPointType = extensionPointType
windowController.runSheetOnWindow(self.view.window!)
extensionPointAddWindowController = windowController
tableView.selectRowIndexes([], byExtendingSelection: false)
}
}