LImageViewerCell::FreezeSubCell

#include "ltwrappr.h"

L_INT LImageViewerCell::FreezeSubCell(nSubCellIndex, bFreeze, uFlags)

L_INT nSubCellIndex;

/* index into the image list attached to the cell */

L_BOOL bFreeze;

/* flag */

L_UINT uFlags;

/* reserved for future use */

Freezes the sub-cell with the specified index.

Parameter

Description

nSubCellIndex

A zero-based index into the image list attached to the cell. This sub-cell will be toggled to frozen or not frozen. Pass -1 to apply this effect on all sub-cells. Pass -2 to apply this effect on the selected sub-cell.

bFreeze

Flag that indicates whether to freeze or unfreeze the sub-cell at the specified index. Possible values are:

 

Value

Meaning

 

TRUE

Freeze the sub-cell.

 

FALSE

Unfreeze the sub-cell.

uFlags

Flags that determine whether to apply the feature on the one cell only, or more than one cell. This value can only be used when the cell is attached to the LImageViewer through the function LImageViewer::InsertCell. Possible values are:

 

Value

Meaning

 

CELL_APPLYTOTHIS

[0x00000000] Apply the feature to this cell only.

 

CELL_APPLYTOALL

[0x10000000] Apply the feature to all the cells in the Image Viewer.

 

CELL_APPLYTOSELECTED

[0x20000000] Apply the feature to the selected cells in the Image Viewer.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The properties of a frozen sub-cell cannot be modified except by manually setting them using LImageViewerCell::SetActionProperties function.

To determine whether a sub-cell is frozen, call the LImageViewerCell::IsSubCellFrozen function. To determine whether a cell is frozen, call LImageViewerCell::IsCellFrozen function.

To freeze all cells call LImageViewerCell::FreezeCell 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::IsSubCellFrozen, LImageViewerCell::IsCellFrozen, LImageViewerCell::FreezeCell, LImageViewer::Create, LImageViewer::RemoveCell, LImageViewer::InsertCell, LImageViewer::GetCellCount, LImageViewer::GetCellWindowHandle, LImageViewerCell::SetCellTag, LImageViewerCell::SetCellProperties, LImageViewerCell::GetCellProperties, LImageViewer::RepositionCell, LImageViewer::GetCellPosition, LImageViewerCell::SetCellBitmapList, LImageViewerCell::GetCellBitmapList, LImageViewer::GetCellBounds, LImageViewerCell::SelectCell, LImageViewerCell::IsCellSelected

Topics:

Image Viewer Cells

 

Window Control/Image Viewer Functions: Image Viewer Cells

Example

This example will freeze the even subcell and then type the word frozen in the middle of the frozen sub-cells.

#if defined LTV17_CONFIG
#ifdef LImageViewerChild 
class LImageViewerChild :public LImageViewerCell
{
   virtual L_INT PostPaintCallBack (pDISPCONTAINERCELLINFO pCellInfo);
} ; 
#endif 
L_INT LImageViewerChild::PostPaintCallBack (pDISPCONTAINERCELLINFO pCellInfo)
{
   if (IsSubCellFrozen(pCellInfo->nSubCellIndex, 0))
   {
      HPEN hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
      HPEN hOldPen = (HPEN)SelectObject(pCellInfo->hDC, hPen);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.bottom);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.bottom);
      SelectObject(pCellInfo->hDC, hOldPen);
      DeleteObject(hPen);
   }
   return SUCCESS;
}
L_INT LImageViewer_FreezeSubCellExample(LImageViewerCell& ImageViewerCell)
{
   L_INT       nRet;
   HBITMAPLIST hBitmapList;
   L_INT       nCount;
   L_INT       nI;
   LBitmapList BitmapList;
   nRet = ImageViewerCell.GetCellBitmapList(&hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   BitmapList.SetHandle(NULL, NULL, FALSE);
   for (nI = 0; nI < nCount; nI++)
   {
      if (((nI >> 1) << 1) == nI )
         ImageViewerCell.FreezeSubCell(nI, TRUE, 0);
   }
   ImageViewerCell.EnablePostPaintCallBack(TRUE);
   //ImageViewerCell.RepaintCell(0, 0);
   return SUCCESS;
}
#else
#ifdef LImageViewerChild 
class LImageViewerChild :public LImageViewerCell
{
   virtual L_INT PostPaintCallBack (pDISPCONTAINERCELLINFO pCellInfo);
} ; 
#endif 
L_INT LImageViewerChild::PostPaintCallBack (pDISPCONTAINERCELLINFO pCellInfo)
{
   if (IsSubCellFrozen( pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, 0))
   {
      HPEN hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
      HPEN hOldPen = (HPEN)SelectObject(pCellInfo->hDC, hPen);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.bottom);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.bottom);
      SelectObject(pCellInfo->hDC, hOldPen);
      DeleteObject(hPen);
   }
   return SUCCESS;
}
L_INT LImageViewer_FreezeSubCellExample(LImageViewer& ImageViewer)
{
   L_INT       nRet;
   HBITMAPLIST hBitmapList;
   L_INT       nCount;
   L_INT       nI;
   LBitmapList BitmapList;
   nRet = ImageViewer.GetCellBitmapList( 0, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   BitmapList.SetHandle(NULL, NULL, FALSE);
   for (nI = 0; nI < nCount; nI++)
   {
      if (((nI >> 1) << 1) == nI )
         ImageViewer.FreezeSubCell( 0, nI, TRUE, 0);
   }
   ImageViewer.EnablePostPaintCallBack(TRUE);
   ImageViewer.RepaintCell( 0, 0, 0);
   return SUCCESS;
}
#endif // LTV17_CONFIG