Re: NSCursor category
Re: NSCursor category
- Subject: Re: NSCursor category
- From: Hamish Allan <email@hidden>
- Date: Wed, 30 Jun 2004 13:20:42 +0100
On Jun 30, 2004, at 8:20, Yann Bizeul wrote:
From Apple's docs : (NSCursor/mouseEntered:)
"This message is automatically sent to the receiver when the cursor
enters a tracking rectangle owned by the receiver..."
What I understand from this, is that this method is called for a
trackingRect, not a cursorRect, and only if the owner is your cursor.
Is this the case ?
I had been assuming that [view addCursorRect: rect cursor:cursor] just
calls [view addTrackingRect: rect owner:cursor user
data:nil
assumeInside:NO] and keeps a collection of any ids returned (so that it
can make the appropriate removeTrackingRect: calls from within
discardCursorRects).
That would work if the default NSCursor mouseEntered/mouseExited
behaviour pushed and popped itself as the current cursor. But looking
at it again, given the existence of setOnMouseEntered: which is used to
decide whether or not a cursor will do just that, it seems unlikely, so
my latest guess is that [view addCursorRect:rect cursor:cursor]
actually calls [[view window] addCursorRect:rect cursor:cursor], which
handles a collection of tracking rects that push and pop cursors for
every view in the window.
Personaly, I always use resetCursorRect in my view to play with
trackingRect *and* cursorrect. Because this method is always called
when rects need to be reset, you can do your stuff here. The only
thing to not forget, is keep a reference for each of your
trackingRect, delete them all in resetCursorRect, and re create them
after this.
I think this is the approach I'll take. Do you use an NSMutableSet or
is there a better alternative?
Thanks!
Hamish
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.