 
 	var mouseDown: (() -> ())?
 	var mouseUp: (() -> ())?
+	var mouseExited: (() -> ())?
+
+	private var tracking = false
 
 	private override func drawRect(dirtyRect: NSRect) {
 		let path: NSBezierPath

				strongSelf.mouseUp(strongSelf)
			}
		}
	}

	public override func elementDidRealize(realizedSelf: RealizedElement) {
		super.elementDidRealize(realizedSelf)
	}
}

	private override func mouseDown(event: NSEvent) {
		super.mouseDown(event)

		propagateMouseDown()
	}

	private override func mouseUp(event: NSEvent) {
		super.mouseUp(event)

		if tracking {
			mouseUp?()

			tracking = false
		}
	}

	private final func propagateMouseDown() {
		tracking = true

		mouseDown?()
	}

	private override func mouseDragged(event: NSEvent) {
		super.mouseDragged(event)

		let loc = convertPoint(event.locationInWindow, fromView: nil)
		let inView = NSMouseInRect(loc, bounds, flipped)
		// If the drag exited our bounds then treat it as a mouse up.
		if tracking && !inView {
			mouseExited?()
			tracking = false
		} else if !tracking && inView {
			propagateMouseDown()
		}
	}

	@objc var backgroundStyle: NSBackgroundStyle = .Light {
