DragGrayRgn
DragGrayRgn Drag outline of a region as mouse moves
#include <Windows.h> Window Manager
long DragGrayRgn(theRgn, startPt, limitRect, slopRect, axis, actionProc );
RgnHandle theRgn ; the Region to drag
Point startPt ; control point (mouse position), in local coordinates
Rect *limitRect ; allowed destination area
Rect *slopRect ; allowed mousing area (e.g., size of window)
short axis ; 0=none, 1=horizontal only, 2=vertical only
ProcPtr actionProc ; NIL=let the system handle it
returns hiword=vertical distance moved; low=horiz dist
0x80008000 means released outside of slopRect
DragGrayRgn moves a dotted-line outline of a region, tracking the mouse as
it moves, and retaining control until the mouse is released. It provides means
to limit the axis of motion and the area within which the region may be moved.
theRgn is the handle of a region to be dragged.
startPt is a Point, expressed in coordinates local to the current GrafPort; it
is typically the position of a mouseDown event that is within the
bounds of the region theRgn .
limitRect is the address of an 8-byte Rect structure, expressed in local
coordinates. It sets the boundary within which the region will be
visible as the mouse is dragged. The mouse-pinned point within
theRgn will not be allowed outside of this area.
slopRect is the address of a Rect, in local coordinates, enclosing limitRect . It
sets an outer limit for dragging. When the mouse-pinned point
moves outside of this area, the outlined region will not be displayed.
If the button is released outside of this area, the return value is
0x80008000, and it means the user wanted to abort the drag
operation.
axis lets you limit the region's motion to horizontal or vertical only. It
is one of:
noConstraint (0) motion allowed in all directions
hAxisOnly (1) horizontal motion only
vAxisOnly (2) vertical motion only
actionProc is the address of a procedure that will be called repeatedly as the
mouse is tracked. A value of NIL specifies to let DragGrayRgn keep
control until the mouse is released.
Returns: a 32-bit long integer, defined as two 16-bit words indicating the
distance moved from startPt . The return value may be cast as a
Point; it is broken up as follows:
high word The vertical distance moved
low word The horizontal distance moved
A return value of -32768 (0x8000) in both words indicates that
the mouse was released outside of slopRect . In this case, the region
should not be moved.

Notes: This function works intuitively, as you come to expect dragging operations
to work:
Drags normally while in limitRect "Pinned" to limitRect
When the mouse is inside limitRect , the region's outline follows it
normally. If the mouse is released there, the region should be moved to the
new position.
When the mouse is outside of limitRect but inside of slopRect , the mouse
point is pinned to the border of limitRect . If the mouse is released there,
the region should be moved to its pinned location.
When the mouse goes outside of slopRect, the outline disappears until the
mouse moves back inside. If the mouse is released outside of slopRect , you
should not move the region.
This call does not redraw the region. Upon return, you should move (i.e.,
redraw) the region or abort the move, as described above.
This call modifies the region, so you may wish to make a copy (via
NewRgn and CopyRgn) and pass its handle as theRgn .
Use DragWindow to let a user reposition a window.