mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-01 18:39:52 +03:00
40 lines
775 B
Swift
40 lines
775 B
Swift
/**
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
* See LICENSE
|
|
*/
|
|
|
|
import Cocoa
|
|
|
|
extension CGRect {
|
|
|
|
func fill() {
|
|
NSRectFill(self)
|
|
}
|
|
}
|
|
|
|
extension NSRange: CustomStringConvertible {
|
|
|
|
public var description: String {
|
|
var location = ""
|
|
if self.location == NSNotFound {
|
|
location = "NotFound"
|
|
} else {
|
|
location = String(self.location)
|
|
}
|
|
return "NSRange<\(location), \(self.length)>"
|
|
}
|
|
}
|
|
|
|
extension NSView {
|
|
|
|
/// - Returns: Rects currently being drawn
|
|
/// - Warning: Call only in drawRect()
|
|
func rectsBeingDrawn() -> [CGRect] {
|
|
var rectsPtr: UnsafePointer<CGRect>? = nil
|
|
var count: Int = 0
|
|
self.getRectsBeingDrawn(&rectsPtr, count: &count)
|
|
|
|
return Array(UnsafeBufferPointer(start: rectsPtr, count: count))
|
|
}
|
|
}
|