Add wxListCtrl::Set{Normal,Small}Images()

These new functions allow to use wxBitmapBundle for the images in this
control instead of wxImageList.

Update the sample to use the new API.
This commit is contained in:
Vadim Zeitlin
2021-11-11 00:50:20 +00:00
parent 9ea8feec37
commit aca0c74e60
11 changed files with 150 additions and 59 deletions

View File

@@ -315,11 +315,11 @@ bool wxListCtrl::Create(wxWindow *parent,
// If SetImageList() had been called before the control was created, take
// it into account now.
if ( wxImageList* const iml = GetImageList(wxIMAGE_LIST_NORMAL) )
if ( wxImageList* const iml = GetUpdatedImageList(wxIMAGE_LIST_NORMAL) )
ListView_SetImageList(GetHwnd(), GetHimagelistOf(iml), LVSIL_NORMAL);
if ( wxImageList* const iml = GetImageList(wxIMAGE_LIST_SMALL) )
if ( wxImageList* const iml = GetUpdatedImageList(wxIMAGE_LIST_SMALL) )
ListView_SetImageList(GetHwnd(), GetHimagelistOf(iml), LVSIL_SMALL);
if ( wxImageList* const iml = GetImageList(wxIMAGE_LIST_STATE) )
if ( wxImageList* const iml = GetUpdatedImageList(wxIMAGE_LIST_STATE) )
ListView_SetImageList(GetHwnd(), GetHimagelistOf(iml), LVSIL_STATE);
return true;
@@ -1509,7 +1509,7 @@ long wxListCtrl::GetNextItem(long item, int geom, int state) const
}
void wxListCtrl::DoSetImageList(wxImageList *imageList, int which)
void wxListCtrl::DoUpdateImages(int which)
{
// It's possible that this function is called before the control is
// created, don't do anything else in this case -- the image list will be
@@ -1537,6 +1537,8 @@ void wxListCtrl::DoSetImageList(wxImageList *imageList, int which)
return;
}
wxImageList* const imageList = GetUpdatedImageList(which);
(void) ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags);
// For ComCtl32 prior 6.0 we need to re-assign all existing