Use ELEMENT_ICON to toggle between one of several images at a static location on a gauge. The resource_id member of the structure specifies the first icon image. The Panel system loads the first icon image using the resource_id. The Panel system loads the next icon image by adding three to the resource_id. It then adds three more to the resource_id and loads the next image, and so on. The Panel system continues this process as many times as num_icons specifies.
Icon images can be any size, although all images in the same ELEMENT_ICON have the same upper left location.
Tip: If you specify IMAGE_USE_ERASE in the image flags for ELEMENT_ICON, the save buffer will only be as large as the first image.
If source_var.n is set to -1, the icon image is automatically hidden.
typedef struct ELEMENT_ICON
{
HEADER;
MODULE_VARsource_var;
PMODULE_VAR_CBsource_var_cb;
longswitch_type;
longswitch_count;
FLOAT64scale;
longoffset;
longnum_icons;
longcur_icon;
longdst_icon;
PIMAGE_SETpicon_data;
PIMAGEsave_buffer;
} ELEMENT_ICON, *PELEMENT_ICON, **PPELEMENT_ICON;
ELEMENT_ICON uses the following members:
Member | Description |
HEADER | Discussed in detail in the topic Using Drawing Elements. |
source_var | Token value used to determine the currently rendered icon. |
source_var_cb | Callback function used for source_var. |
switch_type | Used to determine how source_var is interpreted to select the current icon. It can be set to one of the following values: |
ICON_SWITCH_TYPE_SET_CUR_ICON The value is interpreted as an index to the current icon, where 0 is the first icon and the number of icons minus one is the last icon. ICON_SWITCH_TYPE_SET_CUR_USING_RANGE The value is subtracted from offset and divided by scale to get the current index. You can specify a range that is linearly interpolated into the valid range of icon index. ICON_SWITCH_TYPE_STEP_TO This is the same as ICON_SWITCH_TYPE_SET_CUR_ICON except that it will step through (animate) each icon. ICON_SWITCH_TYPE_STEP_TO_USING_RANGE This is the same as ICON_SWITCH_TYPE_SET_CUR_USING_RANGE except that it will step through (animate) each icon. |
|
switch_count | Used internally by the Panel system; do not use. Must be set to 0. |
scale | Specifies the range of values for source_var. This value is only used if switch_type is ICON_SWITCH_TYPE_SET_CUR_USING_RANGE or ICON_SWITCH_TYPE_STEP_TO_USING_RANGE. |
offset | Specifies the minimum value for source_var. The maximum values is calculated as: max_value = offset + scale. This value is only used if switch type is ICON_SWITCH_TYPE_SET_CUR_USING_RANGE or ICON_SWITCH_TYPE_STEP_TO_USING_RANGE. |
num_icons | Specifies the number of icons loaded. |
cur_icon | Used internally by the Panel system; do not use. Must be set to 0. |
dst_icon | Used internally by the Panel system; do not use. Must be set to 0. |
picon_data | Used internally by the Panel system; do not use. Must be set to 0. |
save_buffer | Used internally by the Panel system; do not use. Must be set to 0. |