Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Added cursor tracking area to set arrowCursor when mouse enters plugin view #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions WDL/IPlug/IGraphicsCocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ NSString* ToNSString(const char* cStr);
- (BOOL) acceptsFirstResponder;
- (BOOL) acceptsFirstMouse: (NSEvent*) pEvent;
- (void) viewDidMoveToWindow;
- (void) updateTrackingAreas;
- (void) mouseEntered:(NSEvent *) pEvent;
- (void) drawRect: (NSRect) rect;
- (void) onTimer: (NSTimer*) pTimer;
- (void) getMouseXY: (NSEvent*) pEvent x: (int*) pX y: (int*) pY;
Expand Down
25 changes: 25 additions & 0 deletions WDL/IPlug/IGraphicsCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,31 @@ - (void) viewDidMoveToWindow
}
}

- (void) updateTrackingAreas
{
[ super updateTrackingAreas];

NSTrackingArea *trackingArea;

for (trackingArea in [[[self trackingAreas] copy] autorelease]) {
[self removeTrackingArea:trackingArea];
}

trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
options:(NSTrackingMouseEnteredAndExited |
NSTrackingActiveAlways |
NSTrackingInVisibleRect)
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
}

- (void) mouseEntered:(NSEvent *) pEvent
{
[super mouseEntered:pEvent];
[[NSCursor arrowCursor] set];
}

- (void) drawRect: (NSRect) rect
{
if (mGraphics)
Expand Down