Checks the validity of assigning a button to a specific action.
#include "ltivw.h"
L_LTIVW_API L_INT L_DispContainerIsButtonValid(hCellWnd, nAction, nMouseButton, uFlags)
A handle to the window that represents the Medical Viewer Cell.
Value that represents the action, which the user wants to check the validity of assigning a button to it. If nAction is equal to or greater than 100 then its a user-defined action. Otherwise it should be one of the following predefined actions:
Value | Meaning |
---|---|
CONTAINER_ACTION_WINDOWLEVEL | [1] Window leveling |
CONTAINER_ACTION_SCALE | [2] Scaling |
CONTAINER_ACTION_OFFSET | [3] Offset |
CONTAINER_ACTION_STACK | [4] Stacking |
CONTAINER_ACTION_MAG | [5] Magnifying glass |
CONTAINER_ACTION_ALPHA | [6] Alpha |
CONTAINER_ACTION_ANNOTATION_RULER | [7] Ruler annotation |
CONTAINER_ACTION_ANNOTATION_ANGLE | [8] Angle annotation |
CONTAINER_ACTION_ANNOTATION_TEXT | [9] Text annotation |
CONTAINER_ACTION_ANNOTATION_ARROW | [10] Arrow annotation |
CONTAINER_ACTION_ANNOTATION_RECTANGLE | [11] Rectangle annotation |
CONTAINER_ACTION_ANNOTATION_ELLIPSE | [12] Ellipse annotation |
CONTAINER_ACTION_ANNOTATION_HILITE | [13] Hilite annotation |
CONTAINER_ACTION_REGION_RECTANGLE | [14] Rectangular region |
CONTAINER_ACTION_REGION_ELLIPSE | [15] Elliptical region |
CONTAINER_ACTION_REGION_FREEHAND | [16] Free hand region |
CONTAINER_ACTION_REGION_POLYGON | [17] Polygon region |
CONTAINER_ACTION_REGION_MAGICWAND | [18] Magic wand (contiguous color) region |
CONTAINER_ACTION_REGION_COLORRANGE | [19] Color range region |
CONTAINER_ACTION_REGION_CIRCLE | [20] Circular region |
CONTAINER_ACTION_REGION_SQUARE | [21] Square region |
CONTAINER_ACTION_REGION_NUDGETOOL | [22] Nudge tool |
CONTAINER_ACTION_REGION_SHRINKTOOL | [23] Shrink tool |
Pointer to a variable to be updated with the mouse button value. Possible values are:
Value | Meaning |
---|---|
CONTAINER_MOUSE_BUTTON_NONE | [0x000] No button is assigned. |
CONTAINER_MOUSE_BUTTON_LEFT | [0x001] Left mouse button. |
CONTAINER_MOUSE_BUTTON_RIGHT | [0x002] Right mouse button. |
CONTAINER_MOUSE_BUTTON_MIDDLE | [0x003] Middle mouse button. |
CONTAINER_MOUSE_WHEEL | [0x004] Mouse wheel. |
CONTAINER_MOUSE_BUTTON_XBUTTON1 | [0x005] X button 1. |
CONTAINER_MOUSE_BUTTON_XBUTTON2 | [0x006] X button 2. |
Reserved for future use. Pass 0.
Value | Meaning |
---|---|
SUCCESS | The mouse button is valid for this action. |
0 | The mouse button is not valid for this action. |
< 1 | An error occurred. Refer to Return Codes. |
This function is preferred to use before calling the L_DispContainerSetAction function to check the validity of assigning a button to a specific action. For example, if the user passed CONTAINER_MOUSE_WHEEL to the MouseButton parameter and CONTAINER_ACTION_MAG to the nAction parameter of the L_DispContainerSetAction function, it will return ERROR_INV_PARAMETER, while if the same values are passed as parameters to this function, it will return 0 as an indication that the mouse button is not valid for this action.
This function assigns the magnify glass to the mouse button, but it will do nothing if the magnify glass was already assigned.
L_INT DispContainerIsButtonValidExample(HDISPCONTAINER hCon, L_INT nMouseButton)
{
L_INT nButton;
L_UINT uFlag;
L_INT nRet;
HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, 0, 0);
nRet = L_DispContainerGetActionButton(hCellWnd, CONTAINER_ACTION_MAG, &nButton, &uFlag);
if (nRet != SUCCESS)
return nRet;
if (!nButton)
{
if (L_DispContainerIsButtonValid(hCellWnd, CONTAINER_ACTION_MAG, nMouseButton, 0))
{
nRet = L_DispContainerSetAction(hCellWnd, CONTAINER_ACTION_MAG, nMouseButton, 0);
if (nRet != SUCCESS)
return nRet;
}
}
return SUCCESS;
}