macOS: Manage tunnels: Add a box around the detail view

This commit is contained in:
Roopesh Chander 2019-01-03 19:34:28 +05:30
parent 5ed147aa3e
commit f26f4b5e7d
1 changed files with 16 additions and 0 deletions

View File

@ -63,6 +63,13 @@ class TunnelDetailTableViewController: NSViewController {
return button return button
}() }()
let box: NSBox = {
let box = NSBox()
box.titlePosition = .noTitle
box.fillColor = .unemphasizedSelectedContentBackgroundColor
return box
}()
let tunnelsManager: TunnelsManager let tunnelsManager: TunnelsManager
let tunnel: TunnelContainer let tunnel: TunnelContainer
var tunnelViewModel: TunnelViewModel { var tunnelViewModel: TunnelViewModel {
@ -111,9 +118,11 @@ class TunnelDetailTableViewController: NSViewController {
let containerView = NSView() let containerView = NSView()
let bottomControlsContainer = NSLayoutGuide() let bottomControlsContainer = NSLayoutGuide()
containerView.addLayoutGuide(bottomControlsContainer) containerView.addLayoutGuide(bottomControlsContainer)
containerView.addSubview(box)
containerView.addSubview(scrollView) containerView.addSubview(scrollView)
containerView.addSubview(statusCheckbox) containerView.addSubview(statusCheckbox)
containerView.addSubview(editButton) containerView.addSubview(editButton)
box.translatesAutoresizingMaskIntoConstraints = false
scrollView.translatesAutoresizingMaskIntoConstraints = false scrollView.translatesAutoresizingMaskIntoConstraints = false
statusCheckbox.translatesAutoresizingMaskIntoConstraints = false statusCheckbox.translatesAutoresizingMaskIntoConstraints = false
editButton.translatesAutoresizingMaskIntoConstraints = false editButton.translatesAutoresizingMaskIntoConstraints = false
@ -133,6 +142,13 @@ class TunnelDetailTableViewController: NSViewController {
editButton.centerYAnchor.constraint(equalTo: bottomControlsContainer.centerYAnchor) editButton.centerYAnchor.constraint(equalTo: bottomControlsContainer.centerYAnchor)
]) ])
NSLayoutConstraint.activate([
scrollView.topAnchor.constraint(equalTo: box.topAnchor),
scrollView.bottomAnchor.constraint(equalTo: box.bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: box.leadingAnchor),
scrollView.trailingAnchor.constraint(equalTo: box.trailingAnchor)
])
view = containerView view = containerView
} }