You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
6 years ago
|
// Copyright © 2015 Abhishek Banthia
|
||
|
|
||
|
import Cocoa
|
||
|
|
||
3 years ago
|
class UpcomingEventView: NSView {
|
||
6 years ago
|
private var trackingArea: NSTrackingArea?
|
||
|
|
||
|
override func mouseEntered(with event: NSEvent) {
|
||
|
super.mouseEntered(with: event)
|
||
6 years ago
|
let dismissalButton = subviews.filter { $0.tag == 55 }.first
|
||
6 years ago
|
if let firstMatch = dismissalButton, firstMatch.isHidden {
|
||
|
firstMatch.isHidden = false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
override func mouseExited(with event: NSEvent) {
|
||
|
super.mouseExited(with: event)
|
||
6 years ago
|
let dismissalButton = subviews.filter { $0.tag == 55 }.first
|
||
6 years ago
|
if let firstMatch = dismissalButton, !firstMatch.isHidden {
|
||
|
firstMatch.isHidden = true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
override func updateTrackingAreas() {
|
||
|
super.updateTrackingAreas()
|
||
|
|
||
|
if let trackingArea = self.trackingArea {
|
||
|
removeTrackingArea(trackingArea)
|
||
|
}
|
||
|
|
||
|
let options: NSTrackingArea.Options = [.mouseEnteredAndExited, .activeAlways]
|
||
|
let trackingArea = NSTrackingArea(rect: bounds, options: options, owner: self, userInfo: nil)
|
||
|
addTrackingArea(trackingArea)
|
||
|
}
|
||
|
}
|
||
3 years ago
|
|
||
|
class ModernSliderContainerView: NSView {
|
||
|
private var trackingArea: NSTrackingArea?
|
||
|
public var currentlyInFocus = false
|
||
|
|
||
|
override func mouseEntered(with event: NSEvent) {
|
||
|
super.mouseEntered(with: event)
|
||
|
currentlyInFocus = true
|
||
|
}
|
||
|
|
||
|
override func mouseExited(with event: NSEvent) {
|
||
|
super.mouseExited(with: event)
|
||
|
currentlyInFocus = false
|
||
|
}
|
||
|
|
||
|
override func updateTrackingAreas() {
|
||
|
super.updateTrackingAreas()
|
||
|
|
||
|
if let trackingArea = self.trackingArea {
|
||
|
removeTrackingArea(trackingArea)
|
||
|
}
|
||
|
|
||
|
let options: NSTrackingArea.Options = [.mouseEnteredAndExited, .activeAlways]
|
||
|
let trackingArea = NSTrackingArea(rect: bounds, options: options, owner: self, userInfo: nil)
|
||
|
addTrackingArea(trackingArea)
|
||
|
}
|
||
|
}
|