Make DetailContainerView a separate file.

This commit is contained in:
Brent Simmons 2019-02-12 22:56:19 -08:00
parent af150b9b42
commit bdf94c21f0
2 changed files with 57 additions and 0 deletions

View File

@ -14,6 +14,8 @@
6581C73D20CED60100F4AD34 /* SafariExtensionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73B20CED60100F4AD34 /* SafariExtensionViewController.xib */; };
6581C74020CED60100F4AD34 /* netnewswire-subscribe-to-feed.js in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73F20CED60100F4AD34 /* netnewswire-subscribe-to-feed.js */; };
6581C74220CED60100F4AD34 /* ToolbarItemIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 6581C74120CED60100F4AD34 /* ToolbarItemIcon.pdf */; };
8405DD8A2213E0E3008CE1BF /* DetailContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8405DD892213E0E3008CE1BF /* DetailContainerView.swift */; };
8405DD8B2213E0E3008CE1BF /* DetailContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8405DD892213E0E3008CE1BF /* DetailContainerView.swift */; };
840958632201629A002C1579 /* Subscribe to Feed.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 6581C73320CED60000F4AD34 /* Subscribe to Feed.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
840BEE4121D70E64009BBAFA /* CrashReportWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840BEE4021D70E64009BBAFA /* CrashReportWindowController.swift */; };
840D617F2029031C009BC708 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840D617E2029031C009BC708 /* AppDelegate.swift */; };
@ -733,6 +735,7 @@
6581C74120CED60100F4AD34 /* ToolbarItemIcon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = ToolbarItemIcon.pdf; sourceTree = "<group>"; };
6581C74320CED60100F4AD34 /* Subscribe_to_Feed.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Subscribe_to_Feed.entitlements; sourceTree = "<group>"; };
8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListKeyboardDelegate.swift; sourceTree = "<group>"; };
8405DD892213E0E3008CE1BF /* DetailContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContainerView.swift; sourceTree = "<group>"; };
840BEE4021D70E64009BBAFA /* CrashReportWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportWindowController.swift; sourceTree = "<group>"; };
840D617C2029031C009BC708 /* NetNewsWire.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetNewsWire.app; sourceTree = BUILT_PRODUCTS_DIR; };
840D617E2029031C009BC708 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -1319,6 +1322,7 @@
isa = PBXGroup;
children = (
849A977E1ED9EC42007D329B /* DetailViewController.swift */,
8405DD892213E0E3008CE1BF /* DetailContainerView.swift */,
84216D0222128B9D0049B9B9 /* DetailWebViewController.swift */,
84E8E0EA202F693600562D8F /* DetailWebView.swift */,
849A977D1ED9EC42007D329B /* ArticleRenderer.swift */,
@ -2347,6 +2351,7 @@
840F7C2221BDA4B40057E851 /* Account+Scriptability.swift in Sources */,
840F7C2321BDA4B40057E851 /* NothingInspectorViewController.swift in Sources */,
840F7C2521BDA4B40057E851 /* AppNotifications.swift in Sources */,
8405DD8B2213E0E3008CE1BF /* DetailContainerView.swift in Sources */,
840F7C2621BDA4B40057E851 /* TimelineKeyboardDelegate.swift in Sources */,
84216D0422128B9D0049B9B9 /* DetailWebViewController.swift in Sources */,
840F7C2821BDA4B40057E851 /* Browser.swift in Sources */,
@ -2509,6 +2514,7 @@
84A1500520048DDF0046AD9A /* SendToMarsEditCommand.swift in Sources */,
D5907DB22004BB37005947E5 /* ScriptingObjectContainer.swift in Sources */,
849A978A1ED9ECEF007D329B /* ArticleStylesManager.swift in Sources */,
8405DD8A2213E0E3008CE1BF /* DetailContainerView.swift in Sources */,
519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */,
84E8E0DB202EC49300562D8F /* TimelineViewController+ContextualMenus.swift in Sources */,
849A97791ED9EC04007D329B /* TimelineStringFormatter.swift in Sources */,

View File

@ -0,0 +1,51 @@
//
// DetailContainerView.swift
// NetNewsWire
//
// Created by Brent Simmons on 2/12/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Cocoa
final class DetailContainerView: NSView {
@IBOutlet var detailStatusBarView: DetailStatusBarView!
override var isOpaque: Bool {
return true
}
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)
let leadingConstraint = NSLayoutConstraint(item: contentView, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1.0, constant: 0.0)
let trailingConstraint = NSLayoutConstraint(item: contentView, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: 0.0)
let topConstraint = NSLayoutConstraint(item: contentView, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0)
let bottomConstraint = NSLayoutConstraint(item: contentView, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0)
let constraints = [leadingConstraint, trailingConstraint, topConstraint, bottomConstraint]
NSLayoutConstraint.activate(constraints)
contentViewConstraints = constraints
}
}
}
override func draw(_ dirtyRect: NSRect) {
NSColor.textBackgroundColor.setFill()
dirtyRect.fill()
}
}