You need to subclass the NSButton class (or even better the NSButtonCell class).
- (void)mouseEntered:(NSEvent *)theEvent; - (void)mouseExited:(NSEvent *)theEvent;
They should be called when the mouse enters and leaves the area. You may also need to create a tracking zone, see here:
- (void)updateTrackingAreas
For the fade and fade effect, I played with an animator and an alpha value, for example:
[[self animator]setAlphaValue:0.9];
EDIT: This is just for reference, so you can take some ideas
@interface MyButton : NSButton { - (void)mouseEntered:(NSEvent *)theEvent; - (void)mouseExited:(NSEvent *)theEvent; - (void)updateTrackingAreas; @end
source share