L_AnnRestrictCursor

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnRestrictCursor( hContainer, lpRect, pPoint, prcOldClip, bRestrictClient)

HANNOBJECT hContainer;

/* handle to the container object */

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.

Parameter

Description

hContainer

Handle to the container object

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:

image\AnnRestrict.gif

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.

Platforms

Win32, x64.

See Also

Functions:

L_AnnDefine, L_AnnAddUserHandle, L_AnnAdjustPoint, L_AnnChangeUserHandle, L_AnnConvert, L_AnnDefine2, L_AnnDeleteUserHandle, L_AnnEnumerateHandles, L_AnnGetRestrictToContainer, L_AnnGetRotateAngle, L_AnnGetUserHandle, L_AnnGetUserHandles, L_AnnRestrictCursor, L_AnnSetRestrictToContainer, L_AnnSetAutoSnapCursor, L_AnnGetAutoSnapCursor

Topics:

Annotation Functions: Creating and Deleting Annotations

 

Implementing Custom Annotations

 

Implementing Annotations

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

Example

Example for L_AnnConvert, L_AnnRestrictCursor 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_INT AnnRestrictCursorExample(HANNOBJECT hObject)
{
   L_INT nRet;
   L_UINT      uType;
   ANNRECT     arcBounds;
   RECT        rcBounds;
   HANNOBJECT  hContainer;
   RECT        rcClipOld;

   nRet = L_AnnGetType(hObject, &uType);
   if(nRet != SUCCESS)
      return nRet;

   if ((uType != ANNOBJECT_AUTOMATION) && (uType != ANNOBJECT_CONTAINER))
   {
      nRet = L_AnnGetTopContainer(hObject, &hContainer);
      if(nRet != SUCCESS)
         return nRet;
      nRet = L_AnnGetRect(hObject, &arcBounds, NULL);
      if(nRet != SUCCESS)
         return nRet;
      nRet = L_AnnConvert(hObject, (LPPOINT)&rcBounds, (pANNPOINT)&arcBounds, 2, ANNCONVERT_TO_CLIENT);
      if(nRet != SUCCESS)
         return nRet;

      rcBounds.left -= 10;
      rcBounds.top -= 10;
      rcBounds.right += 10;
      rcBounds.bottom += 10;

      nRet = L_AnnRestrictCursor(hContainer, &rcBounds, NULL, &rcClipOld, FALSE);
      if(nRet != SUCCESS)
         return nRet;

      // When done with restricting cursor, call the line below
      // ClipCursor(&rcClipOld);
   }
   return SUCCESS;
}