mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Post a notification when mouse enters/leaves OakRolloverButton
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include <oak/misc.h>
|
||||
|
||||
extern NSString* const OakRolloverButtonMouseDidEnterNotification;
|
||||
extern NSString* const OakRolloverButtonMouseDidLeaveNotification;
|
||||
|
||||
PUBLIC @interface OakRolloverButton : NSButton
|
||||
@property (nonatomic) NSImage* regularImage;
|
||||
@property (nonatomic) NSImage* pressedImage;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user