2019-02-13 07:56:19 +01:00
|
|
|
//
|
|
|
|
// DetailContainerView.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/12/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2019-02-14 07:05:31 +01:00
|
|
|
import AppKit
|
2019-02-13 07:56:19 +01:00
|
|
|
|
|
|
|
final class DetailContainerView: NSView {
|
|
|
|
|
|
|
|
@IBOutlet var detailStatusBarView: DetailStatusBarView!
|
|
|
|
|
|
|
|
var contentViewConstraints: [NSLayoutConstraint]?
|
|
|
|
|
|
|
|
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, positioned: .below, relativeTo: detailStatusBarView)
|
2019-02-14 07:05:31 +01:00
|
|
|
let constraints = constraintsToMakeSubViewFullSize(contentView)
|
2019-02-13 07:56:19 +01:00
|
|
|
NSLayoutConstraint.activate(constraints)
|
|
|
|
contentViewConstraints = constraints
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-29 06:37:38 +01:00
|
|
|
|
|
|
|
override func draw(_ dirtyRect: NSRect) {
|
|
|
|
NSColor.controlBackgroundColor.set()
|
|
|
|
let r = NSIntersectionRect(dirtyRect, bounds)
|
|
|
|
r.fill()
|
|
|
|
}
|
2019-02-13 07:56:19 +01:00
|
|
|
}
|