Trait winsafe::prelude::comctl_Himagelist

source ·
pub trait comctl_Himagelist: Handle {
Show 21 methods // Provided methods fn iter(&self) -> impl Iterator<Item = SysResult<DestroyIconGuard>> + '_ { ... } fn Add( &self, hbmp_image: &HBITMAP, hbmp_mask: Option<&HBITMAP> ) -> SysResult<u32> { ... } fn AddIcon(&self, hicon: &HICON) -> SysResult<u32> { ... } fn AddMasked( &self, hbmp_image: &HBITMAP, color_mask: COLORREF ) -> SysResult<u32> { ... } fn BeginDrag( &self, itrack: u32, hotspot: POINT ) -> SysResult<ImageListEndDragGuard<'_>> { ... } fn Create( image_sz: SIZE, flags: ILC, initial_size: i32, grow_size: i32 ) -> SysResult<ImageListDestroyGuard> { ... } fn DragMove(&self, x: i32, y: i32) -> SysResult<()> { ... } fn DragShowNolock(show: bool) -> SysResult<()> { ... } fn Draw( &self, index: u32, hdc_dest: &HDC, dest: POINT, style: ILD ) -> SysResult<()> { ... } fn DrawEx( &self, index: u32, hdc_dest: &HDC, dest: POINT, img_portion: Option<SIZE>, background_color: ClrDefNone, foreground_color: ClrDefNone, style: ILD ) -> SysResult<()> { ... } fn Duplicate(&self) -> SysResult<ImageListDestroyGuard> { ... } fn ExtractIcon(&self, index: u32) -> SysResult<DestroyIconGuard> { ... } fn GetBkColor(&self) -> COLORREF { ... } fn GetIcon(&self, index: u32, flags: ILD) -> SysResult<DestroyIconGuard> { ... } fn GetIconSize(&self) -> SysResult<SIZE> { ... } fn GetImageCount(&self) -> u32 { ... } fn Remove(&self, index: Option<u32>) -> SysResult<()> { ... } fn ReplaceIcon(&self, index: u32, hicon_new: &HICON) -> SysResult<u32> { ... } fn SetBkColor(&self, bk_color: Option<COLORREF>) -> Option<COLORREF> { ... } unsafe fn SetImageCount(&self, new_count: u32) -> SysResult<()> { ... } fn Write(&self, stream: &impl ole_IStream) -> SysResult<()> { ... }
}
Available on crate features kernel and comctl only.
Expand description

This trait is enabled with the comctl feature, and provides methods for HIMAGELIST.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn iter(&self) -> impl Iterator<Item = SysResult<DestroyIconGuard>> + '_

Returns an iterator over all icons in the image list, by calling HIMAGELIST::ExtractIcon for each one.

§Examples

Collecting the icons into a Vec:

use winsafe::{self as w, prelude::*};

let himgl: w::HIMAGELIST; // initialized somewhere

let icons = himgl.iter()
    .collect::<w::SysResult<Vec<_>>>()?;
source

fn Add( &self, hbmp_image: &HBITMAP, hbmp_mask: Option<&HBITMAP> ) -> SysResult<u32>

ImageList_Add function.

A copy of the bitmap is made and stored in the image list, so you’re free to release the original bitmap.

source

fn AddIcon(&self, hicon: &HICON) -> SysResult<u32>

ImageList_AddIcon macro.

A copy of the icon is made and stored in the image list, so you’re free to release the original icon.

source

fn AddMasked( &self, hbmp_image: &HBITMAP, color_mask: COLORREF ) -> SysResult<u32>

ImageList_AddMasked function.

A copy of the bitmap is made and stored in the image list, so you’re free to release the original bitmap.

source

fn BeginDrag( &self, itrack: u32, hotspot: POINT ) -> SysResult<ImageListEndDragGuard<'_>>

ImageList_BeginDrag function.

In the original C implementation, you must call ImageList_EndDrag as a cleanup operation.

Here, the cleanup is performed automatically, because BeginDrag returns an ImageListEndDragGuard, which automatically calls ImageList_EndDrag when the guard goes out of scope. You must, however, keep the guard alive, otherwise the cleanup will be performed right away.

§Examples
use winsafe::{self as w, prelude::*};

let himgl: w::HIMAGELIST; // initialized somewhere

let _drag = himgl.BeginDrag(0, w::POINT::new(0, 0))?; // keep guard alive
source

fn Create( image_sz: SIZE, flags: ILC, initial_size: i32, grow_size: i32 ) -> SysResult<ImageListDestroyGuard>

ImageList_Create function.

§Examples
use winsafe::{self as w, prelude::*, co};

let himgl = w::HIMAGELIST::Create(
    w::SIZE::new(16, 16),
    co::ILC::COLOR32,
    1,
    1,
)?;

// ImageList_Destroy() automatically called
source

fn DragMove(&self, x: i32, y: i32) -> SysResult<()>

source

fn DragShowNolock(show: bool) -> SysResult<()>

source

fn Draw( &self, index: u32, hdc_dest: &HDC, dest: POINT, style: ILD ) -> SysResult<()>

ImageList_Draw function.

source

fn DrawEx( &self, index: u32, hdc_dest: &HDC, dest: POINT, img_portion: Option<SIZE>, background_color: ClrDefNone, foreground_color: ClrDefNone, style: ILD ) -> SysResult<()>

ImageList_DrawEx function.

source

fn Duplicate(&self) -> SysResult<ImageListDestroyGuard>

source

fn ExtractIcon(&self, index: u32) -> SysResult<DestroyIconGuard>

ImageList_ExtractIcon macro.

A copy of the stored icon is returned.

source

fn GetBkColor(&self) -> COLORREF

source

fn GetIcon(&self, index: u32, flags: ILD) -> SysResult<DestroyIconGuard>

ImageList_GetIcon function.

A copy of the stored icon is returned.

source

fn GetIconSize(&self) -> SysResult<SIZE>

source

fn GetImageCount(&self) -> u32

source

fn Remove(&self, index: Option<u32>) -> SysResult<()>

ImageList_Remove function.

source

fn ReplaceIcon(&self, index: u32, hicon_new: &HICON) -> SysResult<u32>

ImageList_ReplaceIcon function.

A copy of the icon is made and stored in the image list, so you’re free to release the original icon.

source

fn SetBkColor(&self, bk_color: Option<COLORREF>) -> Option<COLORREF>

source

unsafe fn SetImageCount(&self, new_count: u32) -> SysResult<()>

ImageList_SetImageCount function.

§Safety

If the size is increased, you must call HIMAGELIST::ReplaceIcon to fill the new indexes, otherwise draw operations will be unpredictable.

source

fn Write(&self, stream: &impl ole_IStream) -> SysResult<()>

ImageList_Write function.

Object Safety§

This trait is not object safe.

Implementors§