Skip to main content

ImageList

Struct ImageList 

Source
pub struct ImageList { /* private fields */ }
Expand description

Represents a wxImageList.

This struct is a wrapper around the wxWidgets ImageList object. It provides owned and unowned variants - owned instances are destroyed on Drop, while unowned instances (obtained from controls) are managed by wxWidgets.

Implementations§

Source§

impl ImageList

Source

pub fn new(width: i32, height: i32, mask: bool, initial_count: i32) -> Self

Creates a new, empty image list.

§Arguments
  • width - The width of images in the list.
  • height - The height of images in the list.
  • mask - true to use a mask, false otherwise.
  • initial_count - The initial number of images the list can store (can be resized).

Returns ImageList on success. Panics if creation failed.

Source

pub fn as_ptr(&self) -> *mut wxd_ImageList_t

Returns the raw pointer to the underlying wxImageList object.

This pointer can be used for FFI calls. The caller must ensure the ImageList object (and thus the pointer) remains valid.

Source

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

Adds a bitmap to the image list. The wxImageList makes an internal copy of the bitmap.

§Arguments
  • bitmap - The bitmap to add.

Returns the index of the added image, or -1 if an error occurred.

Source

pub fn add_bitmap_with_mask(&self, bitmap: &Bitmap, mask: &Bitmap) -> i32

Adds a bitmap and its mask to the image list. The wxImageList makes internal copies of both the bitmap and the mask.

§Arguments
  • bitmap - The bitmap to add.
  • mask - The mask for the bitmap.

Returns the index of the added image, or -1 if an error occurred.

Source

pub fn get_image_count(&self) -> i32

Returns the number of images in the list.

Source

pub fn remove_all(&self) -> bool

Removes all images from the list.

Returns true if successful, false otherwise (e.g., if the list pointer is null).

Trait Implementations§

Source§

impl Debug for ImageList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ImageList

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.