diff --git a/Frameworks/OakAppKit/src/OakRolloverButton.h b/Frameworks/OakAppKit/src/OakRolloverButton.h index f3d2618d..95555ac4 100644 --- a/Frameworks/OakAppKit/src/OakRolloverButton.h +++ b/Frameworks/OakAppKit/src/OakRolloverButton.h @@ -1,5 +1,8 @@ #include +extern NSString* const OakRolloverButtonMouseDidEnterNotification; +extern NSString* const OakRolloverButtonMouseDidLeaveNotification; + PUBLIC @interface OakRolloverButton : NSButton @property (nonatomic) NSImage* regularImage; @property (nonatomic) NSImage* pressedImage; diff --git a/Frameworks/OakAppKit/src/OakRolloverButton.mm b/Frameworks/OakAppKit/src/OakRolloverButton.mm index 36f669a0..343ee594 100644 --- a/Frameworks/OakAppKit/src/OakRolloverButton.mm +++ b/Frameworks/OakAppKit/src/OakRolloverButton.mm @@ -1,5 +1,8 @@ #import "OakRolloverButton.h" +NSString* const OakRolloverButtonMouseDidEnterNotification = @"OakRolloverButtonMouseDidEnterNotification"; +NSString* const OakRolloverButtonMouseDidLeaveNotification = @"OakRolloverButtonMouseDidLeaveNotification"; + typedef NS_ENUM(NSUInteger, OakImageState) { OakImageStateRegular = 0, OakImageStatePressed, @@ -163,7 +166,11 @@ typedef NS_ENUM(NSUInteger, OakImageState) { { if(_mouseInside == flag) return; + _mouseInside = flag; [self updateImage]; + + NSString* notification = _mouseInside ? OakRolloverButtonMouseDidEnterNotification : OakRolloverButtonMouseDidLeaveNotification; + [NSNotificationCenter.defaultCenter postNotificationName:notification object:self]; } @end