2019-02-14 07:05:31 +01:00
|
|
|
//
|
|
|
|
// TimelineContainerView.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/13/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
|
|
|
|
|
|
|
final class TimelineContainerView: NSView {
|
|
|
|
|
2019-02-17 07:14:06 +01:00
|
|
|
private var contentViewConstraints: [NSLayoutConstraint]?
|
2019-02-14 07:05:31 +01:00
|
|
|
|
|
|
|
var contentView: NSView? {
|
|
|
|
didSet {
|
|
|
|
if contentView == oldValue {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if let currentConstraints = contentViewConstraints {
|
|
|
|
NSLayoutConstraint.deactivate(currentConstraints)
|
|
|
|
}
|
|
|
|
contentViewConstraints = nil
|
|
|
|
oldValue?.removeFromSuperviewWithoutNeedingDisplay()
|
|
|
|
|
|
|
|
if let contentView = contentView {
|
|
|
|
contentView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
addSubview(contentView)
|
|
|
|
let constraints = constraintsToMakeSubViewFullSize(contentView)
|
|
|
|
NSLayoutConstraint.activate(constraints)
|
|
|
|
contentViewConstraints = constraints
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-17 07:14:06 +01:00
|
|
|
override var isOpaque: Bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2019-02-14 07:05:31 +01:00
|
|
|
override func draw(_ dirtyRect: NSRect) {
|
|
|
|
NSColor.textBackgroundColor.setFill()
|
|
|
|
dirtyRect.fill()
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 07:14:06 +01:00
|
|
|
|