From 4d449473365454452754d36204adf699abf8c997 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 5 Mar 2000 14:15:47 +0000 Subject: [PATCH 1/1] added missing wxImageList::Add methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/imaglist.h | 4 +++- src/generic/imaglist.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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 ); -- 2.45.2