mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-09 00:29:58 +00:00
Eject button - fix image when enabled status changes and mouseover active.
This commit is contained in:
parent
5d54bbd636
commit
0a78177485
@ -13,6 +13,7 @@ static NSImage *ejectHoverImage = nil;
|
||||
|
||||
@implementation EjectButton {
|
||||
NSTrackingRectTag _tracking;
|
||||
BOOL _mouse;
|
||||
}
|
||||
|
||||
+(void)initialize {
|
||||
@ -32,11 +33,22 @@ static NSImage *ejectHoverImage = nil;
|
||||
}
|
||||
|
||||
-(void)mouseEntered:(NSEvent *)event {
|
||||
_mouse = YES;
|
||||
if ([self isEnabled])
|
||||
[self setImage: ejectHoverImage];
|
||||
}
|
||||
-(void)mouseExited:(NSEvent *)event {
|
||||
[self setImage: ejectImage];
|
||||
_mouse = NO;
|
||||
if ([self isEnabled])
|
||||
[self setImage: ejectImage];
|
||||
}
|
||||
|
||||
-(void)setEnabled:(BOOL)enabled {
|
||||
[super setEnabled: enabled];
|
||||
if (_mouse) {
|
||||
[self setImage: enabled ? ejectHoverImage : ejectImage];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user