Re: Snap-to-edge palettes / dragging windows
Re: Snap-to-edge palettes / dragging windows
- Subject: Re: Snap-to-edge palettes / dragging windows
- From: Matt Gemmell <email@hidden>
- Date: Fri, 10 May 2002 00:05:36 +0100
On 9/5/02 at 2:38 pm, Joel Rosenblum <email@hidden> wrote:
>
> I have an NSPanel subclass, which I've created in order to try to
>
> implement a so-called "snap-to-edge" floating palette. For the
>
> moment, I only want to implement snapping to the edges of the main
>
> screen.
>
>
Maybe you should take a look at the source for Fire. They seem to be
>
able to make windows snap to the edges of the screen pretty well...
Hi Joel,
Thanks for your reply.
What Fire does is have an NSWindow subclass which registers to observe
NSWindowDidMoveNotification. When it receives a notification, it snaps
the window as appropriate. The problem with that is that it's held
hostage by when the notifications are sent; you get a "bottle in the
bath" effect, with the window being dragged and then "bobbing" back to
the appropriate snapped location. I don't like that much. :)
I'm really looking to implement more typical "magnetic" snapping, the
likes of which can be seen in Adobe apps, BBEdit 6.5, and so on.
The root of the problem is that I need to be able to veto the window
dragging mechanism. I need to be able to disallow certain types of
window dragging, or at least constrain the dragging with my own code. I
really need something like this fictional NSWindow delegate method:
- (BOOL)window:(NSWindow*)win shouldDragToNewOrigin:(NSPoint)pt;
I'm at a bit of a loss as to how to implement this behaviour. I don't
know of any way to seize control of a window dragging operation.
Best,
-Matt
--
Matt Gemmell
Scotland Software
<
http://www.scotlandsoftware.com/>
_______________________________________________
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.