7153700: [macosx] add support for MouseMotionListener to the TrayIcon
Reviewed-by: serb, aniyogi
This commit is contained in:
parent
36bb41faf9
commit
9fc6d8f3aa
@ -26,6 +26,7 @@
|
||||
#include <jni.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <AppKit/NSTrackingArea.h>
|
||||
|
||||
#import "CPopupMenu.h"
|
||||
|
||||
@ -64,12 +65,14 @@ extern "C" {
|
||||
@public
|
||||
AWTTrayIcon *trayIcon;
|
||||
NSImage* image;
|
||||
NSTrackingArea *trackingArea;
|
||||
BOOL isHighlighted;
|
||||
}
|
||||
-(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon;
|
||||
-(void)setHighlighted:(BOOL)aFlag;
|
||||
-(void)setImage:(NSImage*)anImage;
|
||||
-(void)setTrayIcon:(AWTTrayIcon*)theTrayIcon;
|
||||
-(void)addTrackingArea;
|
||||
|
||||
@end //AWTTrayIconView
|
||||
|
||||
|
@ -171,12 +171,27 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) {
|
||||
[self setTrayIcon: theTrayIcon];
|
||||
isHighlighted = NO;
|
||||
image = nil;
|
||||
|
||||
trackingArea = nil;
|
||||
|
||||
[self addTrackingArea];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addTrackingArea {
|
||||
NSTrackingAreaOptions options = NSTrackingMouseMoved |
|
||||
NSTrackingInVisibleRect |
|
||||
NSTrackingActiveAlways;
|
||||
trackingArea = [[NSTrackingArea alloc] initWithRect: CGRectZero
|
||||
options: options
|
||||
owner: self
|
||||
userInfo: nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
}
|
||||
|
||||
-(void) dealloc {
|
||||
[image release];
|
||||
[trackingArea release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@ -269,6 +284,10 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) {
|
||||
[trayIcon deliverJavaMouseEvent: event];
|
||||
}
|
||||
|
||||
- (void) mouseMoved: (NSEvent *)event {
|
||||
[trayIcon deliverJavaMouseEvent: event];
|
||||
}
|
||||
|
||||
- (void) rightMouseDown:(NSEvent *)event {
|
||||
[trayIcon deliverJavaMouseEvent: event];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user