|
@@ -22,7 +22,7 @@ class KMComboBox: NSComboBox {
|
|
|
switch type {
|
|
|
case .none:
|
|
|
var p = comboxRect.origin
|
|
|
- p.x += comboxRect.width - 20
|
|
|
+ p.x += comboxRect.width - 23
|
|
|
p.y += (comboxRect.height - 16) / 2
|
|
|
|
|
|
NSColor.clear.setFill()
|
|
@@ -50,8 +50,8 @@ class KMComboBox: NSComboBox {
|
|
|
self.wantsLayer = true
|
|
|
self.layer?.cornerRadius = 1.0
|
|
|
self.layer?.borderWidth = 0.5
|
|
|
- self.layer?.borderColor = .black
|
|
|
- self.backgroundColor = .white
|
|
|
+ self.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
|
|
|
+ self.backgroundColor = KMAppearance.Layout.w0Color()
|
|
|
self.isButtonBordered = false
|
|
|
default:
|
|
|
break
|
|
@@ -63,8 +63,7 @@ class KMComboBox: NSComboBox {
|
|
|
class KMComboBoxCell: NSComboBoxCell {
|
|
|
private func adjustedFrameToVerticallyCenterText(_ frame: NSRect) -> NSRect {
|
|
|
let offset = floor((frame.size.height / 2 - (font!.ascender + font!.descender)))
|
|
|
- let rect = NSRect(x: 8, y: 0, width: frame.size.width, height: frame.size.height)
|
|
|
- return NSInsetRect(rect, 0.0, offset)
|
|
|
+ return NSInsetRect(frame, 0.0, offset)
|
|
|
}
|
|
|
|
|
|
override func edit(withFrame aRect: NSRect, in controlView: NSView, editor textObj: NSText, delegate anObject: Any?, event: NSEvent?) {
|
|
@@ -82,12 +81,12 @@ class KMComboBoxCell: NSComboBoxCell {
|
|
|
|
|
|
class KMStampComboBoxCell: NSComboBoxCell {
|
|
|
override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
|
|
|
- self.backgroundColor = NSColor.white
|
|
|
+ backgroundColor = KMAppearance.Layout.l1Color()
|
|
|
super.drawInterior(withFrame: adjustedFrameToVerticallyCenterText(cellFrame), in: controlView)
|
|
|
}
|
|
|
|
|
|
func adjustedFrameToVerticallyCenterText(_ frame: NSRect) -> NSRect {
|
|
|
- let offset = floor((NSHeight(frame) / 2 - (font!.ascender + font!.descender)))
|
|
|
- return frame.insetBy(dx: 0.0, dy: offset)
|
|
|
+ let offset = floor((frame.height / 2 - (font?.ascender ?? 0.0 + font!.descender)))
|
|
|
+ return NSInsetRect(frame, 0.0, offset)
|
|
|
}
|
|
|
}
|