From: Václav Slavík Date: Sun, 5 Mar 2000 14:15:47 +0000 (+0000) Subject: added missing wxImageList::Add methods X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4d449473365454452754d36204adf699abf8c997?hp=47678105333557b1a5f225fe57e4ae27fa4b8706 added missing wxImageList::Add methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index 60f0c5d8e3..e65e1787c7 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -58,7 +58,9 @@ class wxImageList: public wxObject ~wxImageList(); bool Create(); int GetImageCount() const; - int Add( const wxBitmap &bitmap ); + int Add( const wxBitmap& bitmap ); + int Add( const wxBitmap& bitmap, const wxBitmap& mask ); + int Add( const wxBitmap& bitmap, const wxColour& maskColour ); const wxBitmap *GetBitmap(int index) const; bool Replace( int index, const wxBitmap &bitmap ); bool Remove( int index ); diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 403cd4f13c..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 );