diff options
author | Roopesh Chander <roop@roopc.net> | 2019-01-06 18:51:06 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-01-14 14:52:33 +0530 |
commit | c2633987c3bc98c94981c599ac63e8a081ab605c (patch) | |
tree | 99f222c48ae28d1fdc8929c35e8d731bb897390a /WireGuard/WireGuard/UI/macOS/View | |
parent | macOS: Rename *Cell to *Row (diff) | |
download | wireguard-apple-c2633987c3bc98c94981c599ac63e8a081ab605c.tar.xz wireguard-apple-c2633987c3bc98c94981c599ac63e8a081ab605c.zip |
macOS: Tunnel edit view
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/View')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/View/KeyValueRow.swift | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/View/KeyValueRow.swift b/WireGuard/WireGuard/UI/macOS/View/KeyValueRow.swift index 4e9fa7d..cdf682c 100644 --- a/WireGuard/WireGuard/UI/macOS/View/KeyValueRow.swift +++ b/WireGuard/WireGuard/UI/macOS/View/KeyValueRow.swift @@ -3,7 +3,7 @@ import Cocoa -class KeyValueRow: NSView { +class EditableKeyValueRow: NSView { let keyLabel: NSTextField = { let keyLabel = NSTextField() keyLabel.isEditable = false @@ -18,12 +18,9 @@ class KeyValueRow: NSView { let valueLabel: NSTextField = { let valueLabel = NSTextField() - valueLabel.isEditable = false valueLabel.isSelectable = true - valueLabel.isBordered = false valueLabel.maximumNumberOfLines = 1 valueLabel.lineBreakMode = .byTruncatingTail - valueLabel.backgroundColor = .clear return valueLabel }() @@ -46,6 +43,11 @@ class KeyValueRow: NSView { } } + override var intrinsicContentSize: NSSize { + let height = max(keyLabel.intrinsicContentSize.height, valueLabel.intrinsicContentSize.height) + return NSSize(width: NSView.noIntrinsicMetric, height: height) + } + init() { super.init(frame: CGRect.zero) @@ -74,3 +76,16 @@ class KeyValueRow: NSView { isKeyInBold = false } } + +class KeyValueRow: EditableKeyValueRow { + override init() { + super.init() + valueLabel.isEditable = false + valueLabel.isBordered = false + valueLabel.backgroundColor = .clear + } + + required init?(coder decoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} |