pub struct ImageList {
    pub handle: HIMAGELIST,
    pub owned: bool,
}
Expand description

An image list is a collection of images of the same size, each of which can be referred to by its index. Image lists are used in controls such as tabs container and tree view in order to add icon next to the items.

There are two kinds of image list in Winapi: masked. This is a wrapper over the masked type.

Image list and the method that use them in controls are behind the “image-list” feature.

Builder parameters:

  • size: The size size of the images in the image list. Default (32, 32)
  • initial: The initial size (in images) of the image list. Default 5
  • grow: The number of images by which the image list can grow when the system needs to make room for new images. Default 5
use native_windows_gui as nwg;
fn build_image_list(list: &mut nwg::ImageList) {
    nwg::ImageList::builder()
        .size((64, 64))
        .initial(10)
        .grow(1)
        .build(list);
}

Fields

handle: HIMAGELISTowned: bool

Implementations

Returns the size of the images in the image list

Sets the size of the image list. This clears all current image data.

Returns the number of images in the image list

Adds a new bitmap to the image list. Returns the index to the image. Panics if the bitmap was not initialized

Adds a bitmap directly from a filename. The image is resized to the image list size. Returns the index to the image or an error if the image could not be loaded

Adds a new icon to the image list. Returns the index to the image. Panics if the icon was not initialized

Adds a icon directly from a filename. The image is resized to the image list size. Returns the index to the image or an error if the image could not be loaded

Removes the image at the specified index

When an image is removed, the indexes of the remaining images are adjusted so that the image indexes always range from zero to one less than the number of images in the image list. For example, if you remove the image at index 0, then image 1 becomes image 0, image 2 becomes image 1, and so on.

Replaces an image in the image list. Panics if the bitmap was not initialized

Replaces an image in the image list by an icon. Panics if the icon was not initialized

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.