X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43543d985b04d065178df50dbbc998786ff97282..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/generic/imaglist.cpp?ds=sidebyside diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 87eb78dcd3..92d7369c70 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -20,6 +20,7 @@ #include "wx/generic/imaglist.h" #include "wx/icon.h" +#include "wx/image.h" //----------------------------------------------------------------------------- // wxImageList @@ -58,6 +59,20 @@ int wxImageList::Add( const wxBitmap &bitmap ) return m_images.Number()-1; } +int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) +{ + wxBitmap bmp(bitmap); + bmp.SetMask(new wxMask(mask)); + return Add(bmp); +} + +int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour ) +{ + wxImage img(bitmap); + img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue()); + return Add(img.ConvertToBitmap()); +} + const wxBitmap *wxImageList::GetBitmap( int index ) const { wxNode *node = m_images.Nth( index ); @@ -80,7 +95,7 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap ) //so construct it from a bitmap object until I can figure this nonsense out. (DW) newBitmap = new wxBitmap(bitmap) ; #else - newBitmap = new wxIcon( (const wxIcon&) bitmap ); + newBitmap = new wxBitmap( (const wxIcon&) bitmap ); #endif else newBitmap = new wxBitmap(bitmap) ;