[][src]Struct native_windows_gui::ImageList

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

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

impl ImageList[src]

pub fn builder() -> ImageListBuilder[src]

pub fn size(&self) -> (i32, i32)[src]

Returns the size of the images in the image list

pub fn set_size(&self, size: (i32, i32))[src]

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

pub fn len(&self) -> u32[src]

Returns the number of images in the image list

pub fn add_bitmap(&self, bitmap: &Bitmap) -> i32[src]

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

pub fn add_bitmap_from_filename(&self, filename: &str) -> Result<i32, NwgError>[src]

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

pub fn add_icon(&self, icon: &Icon) -> i32[src]

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

pub fn add_icon_from_filename(&self, filename: &str) -> Result<i32, NwgError>[src]

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

pub fn remove(&self, index: i32)[src]

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.

pub fn replace_bitmap(&self, index: i32, bitmap: &Bitmap)[src]

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

pub fn replace_icon(&self, index: i32, icon: &Icon)[src]

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

Trait Implementations

impl Default for ImageList[src]

impl Drop for ImageList[src]

impl PartialEq<ImageList> for ImageList[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.