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<()> { ... }
}
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§
sourcefn iter(&self) -> impl Iterator<Item = SysResult<DestroyIconGuard>> + '_
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<_>>>()?;
sourcefn Add(
&self,
hbmp_image: &HBITMAP,
hbmp_mask: Option<&HBITMAP>
) -> SysResult<u32>
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.
sourcefn AddIcon(&self, hicon: &HICON) -> SysResult<u32>
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.
sourcefn AddMasked(
&self,
hbmp_image: &HBITMAP,
color_mask: COLORREF
) -> SysResult<u32>
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.
sourcefn BeginDrag(
&self,
itrack: u32,
hotspot: POINT
) -> SysResult<ImageListEndDragGuard<'_>>
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
sourcefn Create(
image_sz: SIZE,
flags: ILC,
initial_size: i32,
grow_size: i32
) -> SysResult<ImageListDestroyGuard>
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
sourcefn DragShowNolock(show: bool) -> SysResult<()>
fn DragShowNolock(show: bool) -> SysResult<()>
ImageList_DragShowNolock
function.
sourcefn Draw(
&self,
index: u32,
hdc_dest: &HDC,
dest: POINT,
style: ILD
) -> SysResult<()>
fn Draw( &self, index: u32, hdc_dest: &HDC, dest: POINT, style: ILD ) -> SysResult<()>
ImageList_Draw
function.
sourcefn DrawEx(
&self,
index: u32,
hdc_dest: &HDC,
dest: POINT,
img_portion: Option<SIZE>,
background_color: ClrDefNone,
foreground_color: ClrDefNone,
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<()>
ImageList_DrawEx
function.
sourcefn Duplicate(&self) -> SysResult<ImageListDestroyGuard>
fn Duplicate(&self) -> SysResult<ImageListDestroyGuard>
ImageList_Duplicate
function.
sourcefn ExtractIcon(&self, index: u32) -> SysResult<DestroyIconGuard>
fn ExtractIcon(&self, index: u32) -> SysResult<DestroyIconGuard>
ImageList_ExtractIcon
macro.
A copy of the stored icon is returned.
sourcefn GetBkColor(&self) -> COLORREF
fn GetBkColor(&self) -> COLORREF
ImageList_GetBkColor
function.
sourcefn GetIcon(&self, index: u32, flags: ILD) -> SysResult<DestroyIconGuard>
fn GetIcon(&self, index: u32, flags: ILD) -> SysResult<DestroyIconGuard>
ImageList_GetIcon
function.
A copy of the stored icon is returned.
sourcefn GetIconSize(&self) -> SysResult<SIZE>
fn GetIconSize(&self) -> SysResult<SIZE>
ImageList_GetIconSize
function.
sourcefn GetImageCount(&self) -> u32
fn GetImageCount(&self) -> u32
ImageList_GetImageCount
function.
sourcefn ReplaceIcon(&self, index: u32, hicon_new: &HICON) -> SysResult<u32>
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.
sourcefn SetBkColor(&self, bk_color: Option<COLORREF>) -> Option<COLORREF>
fn SetBkColor(&self, bk_color: Option<COLORREF>) -> Option<COLORREF>
ImageList_SetBkColor
function.
sourceunsafe fn SetImageCount(&self, new_count: u32) -> SysResult<()>
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.
sourcefn Write(&self, stream: &impl ole_IStream) -> SysResult<()>
fn Write(&self, stream: &impl ole_IStream) -> SysResult<()>
ImageList_Write
function.