I'm trying to find out how can I detect a double-click on the NSSplitView divider. It seems to me that divider is exposed neither to the NSSplitViewDelegate, nor to the NSSplitViewController.
What I have found so far is that the divider is an instance of NSSplitDividerView which is a private class, thus cannot extend or subclass it.
Could you put me back on the correct track of investigation?
Thanks.
A possible solution is to subclass NSSplitView
and override mouseDown(with:)
. Check if the location of the event is between the subviews.
override func mouseDown(with event: NSEvent) {
if event.clickCount == 2 {
let location = self.convert(event.locationInWindow, from: nil)
if location.x > NSMaxX(self.arrangedSubviews[0].frame) && location.x < NSMinX(self.arrangedSubviews[1].frame) {
Swift.print("doubleclick")
return
}
}
super.mouseDown(with: event)
}