Resources | Resources |



Using image static widget

By default, the layout of an image static widget has the image on the left and the label on the right. This orientation can be changed, however, with the label on the left and the image on the right, by setting the appropriate bit in the widget's property flags (ISWF_LAYOUT_IMAGERIGHT bit of PROP_FLAGS).

The label text is vertically centered in the parent container, immediately to the right (or left, if the image/label orientation has been changed) of the image. By default, there is a two pixel padding between the image and the start of the label text -- a value that could be overridden by calling IWidget_SetLeftPadding() on the label portion of the image. An application could change this or any other property of the label or image widgets to customize color, alignment or justification.

The widget interface provides APIs to allow applications to access either the image or label parts of the image static widget, thereby allowing an application to have great control over the widget behavior and appearance. For example, the application could retrieve the label portion of the object, then alter the font, color, or alignment of the text. Likewise, the image portion could be retrieved and manipulated. For example, to add a transparency effect to the graphic.

To create a static image widget, an application would do the following:

  1. Call ISHELL_CreateInstance() with the AEECLSID_CImageStaticWidget ClassID to retrieve a reference counted instance of the static image widget.
    ISHELL_CreateInstance(me->piShell, AEECLSID_CImageStaticWidget,
  2. Applications specify the image to be displayed in the widget by calling IWidget_SetImageStaticInfo(), passing in a pointer to an ImageStaticInfo data structure. The ImageStaticInfo structure contains two members:
    • A pointer to an AECHAR - a pointer to the text to be displayed as the text component of the static widget
    • A pointer to an IImage - a pointer to an image to be displayed as the image component of the static widget
    // Pass the static info object to the widget.
    IWidget_SetImageStaticInfo(piw, pImgStaticInfo, free);