mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-24 06:29:47 +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 {
|
@implementation EjectButton {
|
||||||
NSTrackingRectTag _tracking;
|
NSTrackingRectTag _tracking;
|
||||||
|
BOOL _mouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
+(void)initialize {
|
+(void)initialize {
|
||||||
@ -32,11 +33,22 @@ static NSImage *ejectHoverImage = nil;
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)mouseEntered:(NSEvent *)event {
|
-(void)mouseEntered:(NSEvent *)event {
|
||||||
|
_mouse = YES;
|
||||||
if ([self isEnabled])
|
if ([self isEnabled])
|
||||||
[self setImage: ejectHoverImage];
|
[self setImage: ejectHoverImage];
|
||||||
}
|
}
|
||||||
-(void)mouseExited:(NSEvent *)event {
|
-(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
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user