wxRuby Documentation Home

Wx::ImageList

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.

Derived from

Object

See also

TreeCtrl, ListCtrl

Methods

ImageList.new

ImageList.new(%(arg-type)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.

Parameters

See also

ImageList#create

ImageList#add

Integer add(%(arg-type)Bitmap% bitmap, Bitmap mask = NullBitmap)

Adds a new image using a bitmap and optional mask bitmap.

Integer add(%(arg-type)Bitmap% bitmap, Colour maskColour)

Adds a new image using a bitmap and mask colour.

Integer add(%(arg-type)Icon% icon)

Adds a new image using an icon.

Note that “<<” is an alias for “add”.

Parameters

Return value

The new zero-based image index.

Remarks

The original bitmap or icon is not affected by the add operation, and
can be deleted afterwards.

ImageList#create

Boolean create(%(arg-type)Integer% width, Integer height, Boolean mask = true, Integer initialCount = 1)

Initializes the list. See ImageList.new for details.

ImageList#draw

Boolean draw(%(arg-type)Integer% index, DC dc, Integer x, Integer y, Integer flags = IMAGELIST_DRAW_NORMAL, Boolean solidBackground = false)

Draws a specified image onto a device context.

Parameters

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.

ImageList#get_bitmap

Bitmap get_bitmap(%(arg-type)Integer% index)

Returns the bitmap corresponding to the given index.

ImageList#get_icon

Icon get_icon(%(arg-type)Integer% index)

Returns the icon corresponding to the given index.

ImageList#get_image_count

Integer get_image_count()

Returns the number of images in the list.

ImageList#get_size

Boolean get_size(%(arg-type)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.

Parameters

Return value

true if the function succeeded, false if it failed (for example, if the image
list was not yet initialized).

ImageList#remove

Boolean remove(%(arg-type)Integer% index)

Removes the image at the given position.

ImageList#remove_all

Boolean remove_all()

Removes all the images in the list.

ImageList#replace

Boolean replace(%(arg-type)Integer% index, Bitmap bitmap, Bitmap mask = NullBitmap)

Replaces the existing image with the new image.

Windows only.

Boolean replace(%(arg-type)Integer% index, Icon icon)

Replaces the existing image with the new image.

Parameters

Return value

true if the replacement was successful, false otherwise.

Remarks

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 2023-06-09 00:45:36 +0000]