LAnnContainer::RestrictCursor
#include "ltwrappr.h"
virtual L_INT LAnnContainer::RestrictCursor(lpRect, pPoint, prcOldClip, bRestrictClient)
LPRECT lpRect; |
/* pointer to a RECT structure */ |
LPPOINT pPoint; |
/* pointer to a POINT structure */ |
LPRECT prcOldClip; |
/* pointer a RECT structure that contains the previous clip rectangle */ |
L_BOOL bRestrictClient; |
/* flag that specifies whether the cursor is restricted to the client window */ |
Restricts the mouse cursor in conjunction with annotation objects. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
|
lpRect |
Pointer to a RECT structure that contains the rectangle within which the cursor is restricted. |
|
pPoint |
Pointer to a POINT structure that contains the point around which the lpRect rectangle is centered. |
|
prcOldClip |
Pointer to a RECT structure that contains the previous clip rectangle. |
|
bRestrictClient |
Flag that specifies whether the cursor is restricted to the client window. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Restrict the cursor to the client window. |
|
FALSE |
Do not restrict the cursor to the client window. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function is used to restrict the mouse cursor. It should be used when creating custom annotation objects.
Calling this function always restricts the mouse cursor to the annotation container. However, depending on the arguments passed, the mouse cursor can be restricted further .
This function can be used in the following ways:
To restrict the cursor to the bounds of the
container, pass NULL for lpRect
and NULL for pPoint.
To restrict the cursor to a box around pPoint (and the container), pass pPoint and lpRect.
This is used to restrict movement when dragging an annotation.
The pPoint parameter specifies the location at which the user begins the
dragging operation by pressing the mouse button. The lpRect parameter
specifies the bounding box of the annotation. Calling this function when
the mouse button is pressed restricts movement of the annotation so that
no part of the annotation can go outside the container. In the diagram
below, the red rectangle is restricted so it cannot move outside the container.
To restrict the cursor to a box (not centered
around a point), pass lpRect
and NULL for pPoint.
To do the above, and also restrict to the
client area, set bRestrictClient
to TRUE.
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
Class Members, LAnnotation::SetAutoSnapCursor, LAnnotation::GetAutoSnapCursor |
Topics: |
Annotation Functions (Document/Medical only)Realizing to a Bitmap |
|
|
|
|
|
Example
// Example for LAnnContainer::Convert, LAnnContainer::RestrictCursor
// This example restricts the cursor to 10 pixels on either side
// of the bounding box of the annotation object. For example,
// if the object is a rectangle, the mouse cursor will be restricted
// to an area that is 10 pixels larger than the rectangle.
L_VOID ExampleAnnRestrictCursor(LAnnContainer *pLContainer)
{
L_UINT uType;
ANNRECT arcBounds;
RECT rcBounds;
HANNOBJECT hContainer;
RECT rcClipOld;
uType = pLContainer->GetType();
if ((uType != ANNOBJECT_AUTOMATION) && (uType
!= ANNOBJECT_CONTAINER))
{
pLContainer->GetTopContainer(&hContainer);
pLContainer->GetRect(&arcBounds,
NULL);
pLContainer->Convert((LPPOINT)&rcBounds,
(pANNPOINT)&arcBounds, 2, ANNCONVERT_TO_CLIENT);
rcBounds.left -= 10;
rcBounds.top -= 10;
rcBounds.right += 10;
rcBounds.bottom += 10;
pLContainer->RestrictCursor(&rcBounds,
NULL, &rcClipOld, FALSE);
// When done with restricting cursor,
call the line below
// ClipCursor(&rcClipOld);
}
}