PrefUI // Windows Aero support.
This commit is contained in:
parent
bb7b4eb46a
commit
dfd258d314
|
@ -149,3 +149,26 @@ extension View {
|
||||||
overlay(Tooltip(tooltip: tooltip))
|
overlay(Tooltip(tooltip: tooltip))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Windows Aero in Swift UI
|
||||||
|
|
||||||
|
// Ref: https://stackoverflow.com/questions/62461957
|
||||||
|
|
||||||
|
@available(macOS 10.15, *)
|
||||||
|
struct VisualEffectView: NSViewRepresentable {
|
||||||
|
let material: NSVisualEffectView.Material
|
||||||
|
let blendingMode: NSVisualEffectView.BlendingMode
|
||||||
|
|
||||||
|
func makeNSView(context _: Context) -> NSVisualEffectView {
|
||||||
|
let visualEffectView = NSVisualEffectView()
|
||||||
|
visualEffectView.material = material
|
||||||
|
visualEffectView.blendingMode = blendingMode
|
||||||
|
visualEffectView.state = NSVisualEffectView.State.active
|
||||||
|
return visualEffectView
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateNSView(_ visualEffectView: NSVisualEffectView, context _: Context) {
|
||||||
|
visualEffectView.material = material
|
||||||
|
visualEffectView.blendingMode = blendingMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -90,7 +90,9 @@ struct suiPrefPaneDevZone: View {
|
||||||
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
|
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
}
|
||||||
|
.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
||||||
|
.background(VisualEffectView(material: .sidebar, blendingMode: .behindWindow))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,9 @@ struct suiPrefPaneDictionary: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
}
|
||||||
|
.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
||||||
|
.background(VisualEffectView(material: .sidebar, blendingMode: .behindWindow))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,9 @@ struct suiPrefPaneExperience: View {
|
||||||
.preferenceDescription()
|
.preferenceDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
}
|
||||||
|
.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
||||||
|
.background(VisualEffectView(material: .sidebar, blendingMode: .behindWindow))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,9 @@ struct suiPrefPaneGeneral: View {
|
||||||
.controlSize(.small)
|
.controlSize(.small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
}
|
||||||
|
.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
||||||
|
.background(VisualEffectView(material: .sidebar, blendingMode: .behindWindow))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,9 @@ struct suiPrefPaneKeyboard: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
}
|
||||||
|
.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
|
||||||
|
.background(VisualEffectView(material: .sidebar, blendingMode: .behindWindow))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue