A ImageList contains a list of images, which can be used to supply images/icons to controls. The images are stored in an unspecified form and can have masks for transparent drawing. The images in a list can be supplied by a variety of classes including bitmaps and icons. In almost all cases, it’s easier to use Bitmap as the formats supported by this class are more consistent across platforms.
ImageList is used in conjunction with TreeCtrl, ListCtrl and Notebook classes. All of these classes have methods to assign an ImageList to the control, and then methods to select which image to use for a particular item within the control, by using the index of the image in the list. Note that a particular ImageList should only be assigned to one control – don’t try to share an ImageList instance between different Windows.
ImageList.new(Integer width, Integer height,
Boolean mask = true,
Integer initialCount = 1)
Constructor specifying the image size, whether image masks should be created, and the initial size of the list.
Integer add(Bitmap bitmap, Bitmap mask = NullBitmap)
Adds a new image using a bitmap and optional mask bitmap.
Integer add(Bitmap bitmap, Colour maskColour)
Adds a new image using a bitmap and mask colour.
Integer add(Icon icon)
Adds a new image using an icon.
Note that ”<<” is an alias for “add”.
The new zero-based image index.
The original bitmap or icon is not affected by the add operation, and can be deleted afterwards.
Boolean create(Integer width, Integer height,
Boolean mask = true,
Integer initialCount = 1)
Initializes the list. See ImageList.new for details.
Boolean draw(Integer index, DC dc, Integer x,
Integer y,
Integer flags = IMAGELIST_DRAW_NORMAL,
Boolean solidBackground = false)
Draws a specified image onto a device context.
| IMAGELIST_DRAW_NORMAL | Draw the image normally. |
| IMAGELIST_DRAW_TRANSPARENT | Draw the image with transparency. |
| IMAGELIST_DRAW_SELECTED | Draw the image in selected state. |
| IMAGELIST_DRAW_FOCUSED | Draw the image in a focused state. |
Bitmap get_bitmap(Integer index)
Returns the bitmap corresponding to the given index.
Icon get_icon(Integer index)
Returns the icon corresponding to the given index.
Integer get_image_count()
Returns the number of images in the list.
Boolean get_size(Integer index, Integer width,
Integer height)
Retrieves the size of the images in the list. Currently, the index parameter is ignored as all images in the list have the same size.
true if the function succeeded, false if it failed (for example, if the image list was not yet initialized).
Boolean remove(Integer index)
Removes the image at the given position.
Boolean remove_all()
Removes all the images in the list.
Boolean replace(Integer index, Bitmap bitmap,
Bitmap mask = NullBitmap)
Replaces the existing image with the new image.
Windows only.
Boolean replace(Integer index, Icon icon)
Replaces the existing image with the new image.
true if the replacement was successful, false otherwise.
The original bitmap or icon is not affected by the replace operation, and can be deleted afterwards.
[This page automatically generated from the Textile source at Thu May 01 00:50:40 +0100 2008]