LImageViewerCell::RegionCallBack

#include "ltwrappr.h"

virtual L_INT LImageViewerCell::RegionCallBack(hCellWnd, hRgn, nCellIndex, nSubCellIndex, uOperation)

HWND hCellWnd;

/* handle to the cell window */

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

hCellWnd

A handle to the window that represents the Medical Viewer Cell.

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 LImageViewerCell::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:

LImageViewerCell::EnableActionCallBack, LImageViewerCell::ActionCallBack, LImageViewerCell::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.

#if defined LTV17_CONFIG
#ifdef LImageViewerChild 
class LImageViewerChild :public LImageViewerCell
{
   virtual L_INT RegionCallBack(HWND hCellWnd,
                                HRGN     hRgn,
                                L_INT    nCellIndex,
                                L_INT    nSubCellIndex,
                                L_UINT   uOperation);
} ;
#endif
L_INT LImageViewerChild::RegionCallBack(HWND hCellWnd,
                                        HRGN     hRgn,
                                        L_INT    nCellIndex,
                                        L_INT    nSubCellIndex,
                                        L_UINT   uOperation)
{
   UNREFERENCED_PARAMETER(hCellWnd);
   UNREFERENCED_PARAMETER(hRgn);
   UNREFERENCED_PARAMETER(uOperation);
   UNREFERENCED_PARAMETER(nCellIndex);
   L_INT          nCount;
   HBITMAPLIST    hBitmapList;
   L_HRGN         hSubCellRgn;
   L_INT          nI;
   LBitmapList    BitmapList;
   L_INT nRet = GetCellBitmapList(&hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   BitmapList.SetHandle(NULL, NULL, FALSE);
   GetCellRegionHandle(nSubCellIndex, &hSubCellRgn, 0);
   for (nI = 0; nI < nCount; nI++)
   {
      if (nSubCellIndex == nI)
         continue;
      SetCellRegionHandle(nI, hSubCellRgn, L_RGN_SET, 0);
   }
   DeleteObject(hSubCellRgn);
   return SUCCESS;
}
L_INT LImageViewer_RegionHandleExample(LImageViewerCell& ImageViewerCell)
{
   ImageViewerCell.EnableRegionCallBack(TRUE);
   return SUCCESS;
}
#else
#ifdef LImageViewerChild 
class LImageViewerChild :public LImageViewerCell
{
   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;
}
#endif // LTV17_CONFIG