LImageViewer::RegionCallBack

#include "ltwrappr.h"

virtual L_INT LImageViewer::RegionCallBack(hRgn, nCellIndex, nSubCellIndex, uOperation)

HRGN hRgn;

/* handle to the Windows region */

L_INT nCellIndex;

/* index of the cell */

L_INT nSubCellIndex;

/* index of the sub-cell */

L_UINT uOperation;

/* action taking regarding the existing region */

This callback is called every time the user creates, changes or removes a region from one of the bitmaps displayed in a cell.

Parameter

Description

hRgn

Handle to the Windows region.

nCellIndex

A zero-based index of the cell that contains the region update.

nSubCellIndex

A zero-based index of the sub-cell. This sub-cell contains the image that contains the region changed. Pass -2 to refer to the selected sub-cell.

uOperation

The action taken regarding the existing bitmap region, if one was defined. It can be one of the following values:

 

Value

Meaning

 

L_RGN_AND

[0] An AND operation has been applied to the existing region.

 

L_RGN_SET

[1] A new region has been created.

 

L_RGN_ANDNOTRGN

[3] The existing region has been reduced.

 

L_RGN_OR

[4] A new region has been combined with the existing one.

 

L_RGN_SETNOT

[6] An inverted region has been created.

 

L_RGN_REMOVE

[8] The existing region has been removed.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

In order to use this callback function, it must first be set by calling the LImageViewer::EnableRegionCallBack function.

Required DLLs and Libraries

LTIVW

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:

LImageViewer::EnableActionCallBack, LImageViewer::ActionCallBack, LImageViewer::EnableRegionCallBack, Class Members

Topics:

Image Viewer Cells

 

Image Viewer Functions: Image Viewer Cells

 

Image Viewer Functions: Callbacks

Example

This function will make the cell set the region handle for all the frame if the user create or updated a region on one of hte frames.

#ifdef LImageViewerChild 
class LImageViewerChild :public LImageViewer
{
   virtual L_INT RegionCallBack(HRGN     hRgn,
                                L_INT    nCellIndex,
                                L_INT    nSubCellIndex,
                                L_UINT   uOperation);
} ;
#endif
L_INT LImageViewerChild::RegionCallBack(HRGN     hRgn,
                                        L_INT    nCellIndex,
                                        L_INT    nSubCellIndex,
                                        L_UINT   uOperation)
{
   UNREFERENCED_PARAMETER(hRgn);
   UNREFERENCED_PARAMETER(uOperation);
   L_INT          nCount;
   HBITMAPLIST    hBitmapList;
   L_HRGN         hSubCellRgn;
   L_INT          nI;
   LBitmapList    BitmapList;
   L_INT nRet = GetCellBitmapList( 0, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   BitmapList.SetHandle(NULL, NULL, FALSE);
   GetCellRegionHandle( nCellIndex, nSubCellIndex, &hSubCellRgn, 0);
   for (nI = 0; nI < nCount; nI++)
   {
      if (nSubCellIndex == nI)
         continue;
      SetCellRegionHandle( nCellIndex, nI, hSubCellRgn, L_RGN_SET, 0);
   }
   DeleteObject(hSubCellRgn);
   return SUCCESS;
}
L_INT LImageViewer_RegionHandleExample(LImageViewer& ImageViewer)
{
   ImageViewer.EnableRegionCallBack(TRUE);
   return SUCCESS;
}