| @@ -59,7 +59,7 @@ class TitleBar: NSVisualEffectView { · 58 unmodified lines |
| 59 | 59 | window.titlebarAppearsTransparent = true |
| 60 | 60 | window.styleMask.insert(.fullSizeContentView) |
| 61 | 61 | set(appearance: option.mac.macos_title_bar_appearance) |
| 62 | | − set(material: Int(option.mac.macos_title_bar_material)) |
| 62 | + set(material: option.mac.macos_title_bar_material) |
| 63 | 63 | set(color: option.mac.macos_title_bar_color) |
| 64 | 64 | } |
| 65 | 65 | |
| @@ -107,12 +107,29 @@ class TitleBar: NSVisualEffectView { · 41 unmodified lines |
| 107 | 107 | }() |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | | − func set(material: Any) { |
| 111 | | − if material is Int { |
| 112 | | − self.material = materialFrom(string: String(material as? Int ?? 0)) |
| 113 | | − } else { |
| 114 | | − self.material = materialFrom(string: material as? String ?? "titlebar") |
| 115 | | − } |
| 110 | + func set(material: Int32) { |
| 111 | + self.material = { switch material { |
| 112 | + case 0: return .titlebar |
| 113 | + case 1: return .selection |
| 114 | + case 2: return .menu |
| 115 | + case 3: return .popover |
| 116 | + case 4: return .sidebar |
| 117 | + case 5: return .headerView |
| 118 | + case 6: return .sheet |
| 119 | + case 7: return .windowBackground |
| 120 | + case 8: return .hudWindow |
| 121 | + case 9: return .fullScreenUI |
| 122 | + case 10: return .toolTip |
| 123 | + case 11: return .contentBackground |
| 124 | + case 12: return .underWindowBackground |
| 125 | + case 13: return .underPageBackground |
| 126 | + case 14: return .dark |
| 127 | + case 15: return .light |
| 128 | + case 16: return .mediumLight |
| 129 | + case 17: return .ultraDark |
| 130 | + default: return .titlebar |
| 131 | + } |
| 132 | + }() |
| 116 | 133 | } |
| 117 | 134 | |
| 118 | 135 | func set(color: Any) { |
| @@ -174,28 +191,4 @@ class TitleBar: NSVisualEffectView { · 55 unmodified lines |
| 174 | 191 | object: nil) |
| 175 | 192 | perform(#selector(hide), with: nil, afterDelay: 0.5) |
| 176 | 193 | } |
| 177 | | − |
| 178 | | − func materialFrom(string: String) -> NSVisualEffectView.Material { |
| 179 | | − switch string { |
| 180 | | − case "0", "titlebar": return .titlebar |
| 181 | | − case "1", "selection": return .selection |
| 182 | | − case "2", "menu": return .menu |
| 183 | | − case "3", "popover": return .popover |
| 184 | | − case "4", "sidebar": return .sidebar |
| 185 | | − case "5", "headerView": return .headerView |
| 186 | | − case "6", "sheet": return .sheet |
| 187 | | − case "7", "windowBackground": return .windowBackground |
| 188 | | − case "8", "hudWindow": return .hudWindow |
| 189 | | − case "9", "fullScreen": return .fullScreenUI |
| 190 | | − case "10", "toolTip": return .toolTip |
| 191 | | − case "11", "contentBackground": return .contentBackground |
| 192 | | − case "12", "underWindowBackground": return .underWindowBackground |
| 193 | | − case "13", "underPageBackground": return .underPageBackground |
| 194 | | − case "14", "dark": return .dark |
| 195 | | − case "15", "light": return .light |
| 196 | | − case "16", "mediumLight": return .mediumLight |
| 197 | | − case "17", "ultraDark": return .ultraDark |
| 198 | | − default: return .titlebar |
| 199 | | − } |
| 200 | | − } |
| 201 | 194 | } |