Disallow selecting group items. Fix #193.
This commit is contained in:
parent
f885c918d2
commit
8fc7445a7a
|
@ -151,6 +151,21 @@ import RSCore
|
||||||
return node.isGroupItem
|
return node.isGroupItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func outlineView(_ outlineView: NSOutlineView, selectionIndexesForProposedSelection proposedSelectionIndexes: IndexSet) -> IndexSet {
|
||||||
|
|
||||||
|
// Don’t allow selecting group items.
|
||||||
|
// If any index in IndexSet contains a group item,
|
||||||
|
// return the current selection (not a modified version of the proposed selection).
|
||||||
|
|
||||||
|
for index in proposedSelectionIndexes {
|
||||||
|
if let node = nodeForRow(index), node.isGroupItem {
|
||||||
|
return outlineView.selectedRowIndexes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return proposedSelectionIndexes
|
||||||
|
}
|
||||||
|
|
||||||
func outlineViewSelectionDidChange(_ notification: Notification) {
|
func outlineViewSelectionDidChange(_ notification: Notification) {
|
||||||
|
|
||||||
// TODO: support multiple selection
|
// TODO: support multiple selection
|
||||||
|
|
Loading…
Reference in New Issue