fix: improve settings ui on macos 10.13 (#5255)

This commit is contained in:
lwouis committed 2026-02-19 23:34:56 +01:00
1 parent 35eae11389
commit 75347adc8d
3 files changed
+11 -2

No files matched your search

+1
View File
@@ -82,6 +82,7 @@ class DebugWindow: NSPanel {
filterControl = NSSegmentedControl(labels: ["Debug", "Info", "Warning", "Error"], filterControl = NSSegmentedControl(labels: ["Debug", "Info", "Warning", "Error"],
trackingMode: .selectOne, target: nil, action: nil) trackingMode: .selectOne, target: nil, action: nil)
filterControl.translatesAutoresizingMaskIntoConstraints = false filterControl.translatesAutoresizingMaskIntoConstraints = false
LabelAndControl.applySystemSelectedSegmentStyle(filterControl)
filterControl.selectedSegment = 0 filterControl.selectedSegment = 0
filterControl.onAction = { [weak self] _ in self?.filterChanged() } filterControl.onAction = { [weak self] _ in self?.filterChanged() }
for i in 0..<Self.levels.count { for i in 0..<Self.levels.count {
+9 -1
View File
@@ -245,7 +245,7 @@ class LabelAndControl: NSObject {
$0.localizedString $0.localizedString
}, trackingMode: .selectOne, target: nil, action: nil) }, trackingMode: .selectOne, target: nil, action: nil)
button.translatesAutoresizingMaskIntoConstraints = false button.translatesAutoresizingMaskIntoConstraints = false
button.segmentStyle = .automatic applySystemSelectedSegmentStyle(button)
for (i, preference) in macroPreferences.enumerated() { for (i, preference) in macroPreferences.enumerated() {
if segmentWidth > 0 { if segmentWidth > 0 {
button.setWidth(segmentWidth, forSegment: i) button.setWidth(segmentWidth, forSegment: i)
@@ -266,6 +266,14 @@ class LabelAndControl: NSObject {
return button 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, static func makeLabelWithSlider(_ labelText: String, _ rawName: String, _ minValue: Double, _ maxValue: Double,
_ numberOfTickMarks: Int = 0, _ allowsTickMarkValuesOnly: Bool = false, _ numberOfTickMarks: Int = 0, _ allowsTickMarkValuesOnly: Bool = false,
_ unitText: String = "", width: CGFloat = 200, extraAction: ActionClosure? = nil) -> [NSView] { _ unitText: String = "", width: CGFloat = 200, extraAction: ActionClosure? = nil) -> [NSView] {
@@ -32,7 +32,7 @@ class CustomizeStyleSheet: SheetWindow {
NSLocalizedString("Advanced", comment: "") NSLocalizedString("Advanced", comment: "")
], trackingMode: .selectOne, target: self, action: #selector(switchTab(_:))) ], trackingMode: .selectOne, target: self, action: #selector(switchTab(_:)))
control.selectedSegment = 0 control.selectedSegment = 0
control.segmentStyle = .automatic LabelAndControl.applySystemSelectedSegmentStyle(control)
control.widthAnchor.constraint(equalToConstant: CustomizeStyleSheet.width).isActive = true control.widthAnchor.constraint(equalToConstant: CustomizeStyleSheet.width).isActive = true
let view = TableGroupSetView(originalViews: [illustratedImageView, control, showHideView, advancedView], padding: 0) let view = TableGroupSetView(originalViews: [illustratedImageView, control, showHideView, advancedView], padding: 0)
return view return view