Created
January 6, 2013 16:00
-
-
Save nickludlam/4468122 to your computer and use it in GitHub Desktop.
A MacRuby subclass of NSWindow which will fade away when closed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FadeWindow < NSWindow | |
def fadeInAndMakeKeyAndOrderFront(orderFront) | |
self.setAlphaValue(0); | |
if orderFront | |
self.makeKeyAndOrderFront(nil) | |
end | |
self.animator.setAlphaValue(1.0) | |
end | |
def fadeOutAndOrderOut(orderOut) | |
if orderOut | |
delay = NSAnimationContext.currentContext.duration + 0.1 | |
self.performSelector('orderOut:', withObject:nil, afterDelay:delay) | |
end | |
self.animator.setAlphaValue(0) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment