Trait winsafe::prelude::comctl_Himagelist
source · pub trait comctl_Himagelist: Handle {
// Provided methods
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 GetIconSize(&self) -> SysResult<SIZE> { ... }
fn GetImageCount(&self) -> u32 { ... }
fn Remove(&self, index: Option<u32>) -> SysResult<()> { ... }
fn ReplaceIcon(
&self,
index: Option<u32>,
hicon_new: &HICON
) -> SysResult<u32> { ... }
fn SetImageCount(&self, new_count: u32) -> 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 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
function.
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 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: Option<u32>, hicon_new: &HICON) -> SysResult<u32>
fn ReplaceIcon(&self, index: Option<u32>, hicon_new: &HICON) -> SysResult<u32>
ImageList_ReplaceIcon
function.
Note that a copy of the bitmap is made, and this copy is then stored. You’re still responsible for freeing the original bitmap.
sourcefn SetImageCount(&self, new_count: u32) -> SysResult<()>
fn SetImageCount(&self, new_count: u32) -> SysResult<()>
ImageList_SetImageCount
function.