Applying Actions

Actions are processes that can be applied to the images attached to cells within the container/image viewer. LEADTOOLS supports several standard or "built-in" actions and custom or "user-defined" actions. The built-in actions LEADTOOLS supports are listed below:

image\sqrblit.gif Window Leveling: Maps grayscale intensities using a user defined color map (LUT).

image\sqrblit.gif Alpha: A window-leveling factor used when the window leveling lookup table is not linear.

image\sqrblit.gif Scale: Increases or decreases the size of the image in the cell.

image\sqrblit.gif Offset: Changes the offset of the image within the cell.

image\sqrblit.gif Magnifying Glass: Magnifies the image in the cell.

image\sqrblit.gif Stack: Scrolls the images within the cell.

Custom actions are completely controlled by the user, including any mouse movement and keystroke association. The user handles these custom actions through a DISPCONTAINERACTIONCALLBACK callback function. This callback function must be set by setting LImageViewer::EnableActionCallback to TRUE.

Regardless of whether the action is built-in or custom, any action must be added to a container before it can be used. To add an action to a container, call LImageViewer::AddAction. Since the Image Viewer supports custom actions, there is no limit on how many actions a container can have. However, an action cannot be added to a container twice. To determine how many actions are currently in a particular container, call LImageViewer::GetActionCount.

Once the action has been added, assign it to a mouse button using LImageViewer::SetAction. An action can be assigned to more than one mouse button. If an action has been assigned to a mouse button, it is considered "active". To determine whether a specific action is active, call LImageViewer::IsActionActive. The LImageViewer::SetAction function also lets the user decide whether the applied action will affect one cell, selected cells, or all cells in the container, and whether the action is applied during mouse movement or after mouse button release.

In addition to assigning an action to a mouse button, an action can also be assigned to a keystroke combination. To set the keystroke combination for an action, call LImageViewer::SetKeyboardAction. To get the current keystroke combination associated with a specific action, call LImageViewer::GetKeyboardAction.

Each action has both general and specific properties. The general properties, like the cursor, are common to all cells within the container. These are applied at the container level. Specific properties, such as the width used by the window level action, are used to manually change values used by the action. These are applied at the cell level. The properties used by each action are contained in an action-specific structure. Action properties that apply to the entire container can be found in the DISPCONTAINERACTIONPROPS structure. Each of the action-specific structures contains a DISPCONTAINERACTIONPROPS structure, as well as other properties, related to the specific action. Some of the additional properties related to the specific properties are also applied at the container level and are therefore "general" properties, while others are applied at the cell level and are therefore "specific" properties. For more information on the properties of the various actions, refer to the structures listed below:

DISPWLEVELACTIONPROPS

DISPALPHAACTIONPROPS

DISPMAGACTIONPROPS

DISPOFFSETACTIONPROPS

DISPSCALEACTIONPROPS

DISPSTACKACTIONPROPS

DISPOWNERACTIONPROPS

The current properties associated with a specific action can be retrieved by calling LImageViewer::GetActionProperties. To change the properties for a specific action, call LImageViewer::SetActionProperties.

When an action is no longer needed in a container, it can be removed by calling LImageViewer::RemoveAction.