Rewire contextual menu in timeline view.

This commit is contained in:
Brent Simmons 2019-02-18 12:38:14 -08:00
parent 076df956f9
commit 19023f9168
2 changed files with 17 additions and 7 deletions

View File

@ -17,6 +17,16 @@ final class TimelineContainerViewController: NSViewController {
@IBOutlet var containerView: TimelineContainerView! @IBOutlet var containerView: TimelineContainerView!
var currentTimelineViewController: TimelineViewController? {
didSet {
let view = currentTimelineViewController?.view
if containerView.contentView === view {
return
}
containerView.contentView = view
}
}
weak var delegate: TimelineContainerViewControllerDelegate? weak var delegate: TimelineContainerViewControllerDelegate?
private lazy var regularTimelineViewController = { private lazy var regularTimelineViewController = {
@ -39,7 +49,7 @@ final class TimelineContainerViewController: NSViewController {
} }
func showTimeline(_ mode: TimelineSourceMode) { func showTimeline(_ mode: TimelineSourceMode) {
containerView.contentView = timelineViewController(for: mode).view currentTimelineViewController = timelineViewController(for: mode)
} }
} }

View File

@ -43,7 +43,7 @@
<connections> <connections>
<outlet property="dataSource" destination="-2" id="zir-Wd-WsF"/> <outlet property="dataSource" destination="-2" id="zir-Wd-WsF"/>
<outlet property="delegate" destination="-2" id="nbI-3q-mrc"/> <outlet property="delegate" destination="-2" id="nbI-3q-mrc"/>
<outlet property="menu" destination="zCu-LD-kHw" id="nNl-iz-nVl"/> <outlet property="menu" destination="MjV-3b-ZXR" id="kCm-mz-dAV"/>
</connections> </connections>
</tableView> </tableView>
</subviews> </subviews>
@ -57,20 +57,20 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</scroller> </scroller>
</scrollView> </scrollView>
<menu id="zCu-LD-kHw"> <menu id="MjV-3b-ZXR">
<items> <items>
<menuItem title="Item 1" id="AJc-Qw-NnP"> <menuItem title="Item 1" id="xfn-qr-Hmg">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
</menuItem> </menuItem>
<menuItem title="Item 2" id="YKj-q3-QDG"> <menuItem title="Item 2" id="CKG-yd-eyo">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
</menuItem> </menuItem>
<menuItem title="Item 3" id="IJ0-IS-a6R"> <menuItem title="Item 3" id="SwU-HI-Iqz">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
</menuItem> </menuItem>
</items> </items>
<connections> <connections>
<outlet property="delegate" destination="opA-RM-DKR" id="QpK-G8-xCm"/> <outlet property="delegate" destination="-2" id="t1E-bi-ix5"/>
</connections> </connections>
</menu> </menu>
</objects> </objects>