class CustomTextFieldCell: NSTextFieldCell {
override func titleRect(forBounds rect: NSRect) -> NSRect {
var rect = super.titleRect(forBounds: rect)
// shift down a little so the draw rect is vertically centered in cell frame
rect.origin.y += (rect.height - cellSize.height) / 2
return rect
}
override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
super.drawInterior(withFrame: titleRect(forBounds: cellFrame), in: controlView)
}
override func select(withFrame rect: NSRect, in controlView: NSView, editor textObj: NSText, delegate: Any?, start selStart: Int, length selLength: Int) {
super.select(withFrame: titleRect(forBounds: rect), in: controlView, editor: textObj, delegate: delegate, start: selStart, length: selLength)
}
}