OSDN Git Service

UAをVersion/10.0.3 Safari/602.4.8に変更
[kcd/KCD.git] / KCD / BorderTextField.swift
1 //
2 //  BorderTextField.swift
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2017/01/02.
6 //  Copyright © 2017年 Hori,Masaki. All rights reserved.
7 //
8
9 import Cocoa
10
11 class BorderTextField: NSTextField {
12     override func draw(_ dirtyRect: NSRect) {
13         super.draw(dirtyRect)
14
15         let bounds = self.bounds
16         let width = bounds.width
17         let height = bounds.height
18         NSColor.controlShadowColor.set()
19         NSBezierPath.setDefaultLineWidth(1.0)
20         multiline {
21             [(NSPoint, NSPoint)]()
22                 .appended { (NSPoint(x: 3, y: height), NSPoint(x: bounds.maxX, y: height)) }
23                 .appended { (NSPoint(x: width, y: 0), NSPoint(x: width, y: height)) }
24             }
25             .map { $0.stroke() }
26     }
27 }