fix: improve settings ui on macos 10.13 (#5255)
This commit is contained in:
1 parent
35eae11389
commit
75347adc8d
3 files changed
+11
-2
No files matched your search
@@ -82,6 +82,7 @@ class DebugWindow: NSPanel {
|
||||
filterControl = NSSegmentedControl(labels: ["Debug", "Info", "Warning", "Error"],
|
||||
trackingMode: .selectOne, target: nil, action: nil)
|
||||
filterControl.translatesAutoresizingMaskIntoConstraints = false
|
||||
LabelAndControl.applySystemSelectedSegmentStyle(filterControl)
|
||||
filterControl.selectedSegment = 0
|
||||
filterControl.onAction = { [weak self] _ in self?.filterChanged() }
|
||||
for i in 0..<Self.levels.count {
|
||||
|
||||
@@ -245,7 +245,7 @@ class LabelAndControl: NSObject {
|
||||
$0.localizedString
|
||||
}, trackingMode: .selectOne, target: nil, action: nil)
|
||||
button.translatesAutoresizingMaskIntoConstraints = false
|
||||
button.segmentStyle = .automatic
|
||||
applySystemSelectedSegmentStyle(button)
|
||||
for (i, preference) in macroPreferences.enumerated() {
|
||||
if segmentWidth > 0 {
|
||||
button.setWidth(segmentWidth, forSegment: i)
|
||||
@@ -266,6 +266,14 @@ class LabelAndControl: NSObject {
|
||||
return button
|
||||
}
|
||||
|
||||
static func applySystemSelectedSegmentStyle(_ control: NSSegmentedControl) {
|
||||
if #available(macOS 10.14, *) {
|
||||
control.segmentStyle = .automatic
|
||||
} else {
|
||||
control.segmentStyle = .texturedRounded
|
||||
}
|
||||
}
|
||||
|
||||
static func makeLabelWithSlider(_ labelText: String, _ rawName: String, _ minValue: Double, _ maxValue: Double,
|
||||
_ numberOfTickMarks: Int = 0, _ allowsTickMarkValuesOnly: Bool = false,
|
||||
_ unitText: String = "", width: CGFloat = 200, extraAction: ActionClosure? = nil) -> [NSView] {
|
||||
|
||||
@@ -32,7 +32,7 @@ class CustomizeStyleSheet: SheetWindow {
|
||||
NSLocalizedString("Advanced", comment: "")
|
||||
], trackingMode: .selectOne, target: self, action: #selector(switchTab(_:)))
|
||||
control.selectedSegment = 0
|
||||
control.segmentStyle = .automatic
|
||||
LabelAndControl.applySystemSelectedSegmentStyle(control)
|
||||
control.widthAnchor.constraint(equalToConstant: CustomizeStyleSheet.width).isActive = true
|
||||
let view = TableGroupSetView(originalViews: [illustratedImageView, control, showHideView, advancedView], padding: 0)
|
||||
return view
|
||||
|
||||
Reference in new issue
Block a user