X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f177c8e7309c8cf3ece1563870d135cc8f0e6a1..a15eb0a5c87f265c0cd49f7dca31ad4068123a27:/src/generic/imaglist.cpp diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 403cd4f13c..12f621afce 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.cpp +// Name: generic/imaglist.cpp // Purpose: // Author: Robert Roebling // Id: $id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -20,6 +20,7 @@ #include "wx/generic/imaglist.h" #include "wx/icon.h" +#include "wx/image.h" //----------------------------------------------------------------------------- // wxImageList @@ -27,11 +28,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) -wxImageList::wxImageList( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) +wxImageList::wxImageList( int width, int height, bool mask, int initialCount ) { - m_width = width; - m_height = height; - Create(); + (void)Create(width, height, mask, initialCount); } wxImageList::~wxImageList() @@ -43,6 +42,14 @@ int wxImageList::GetImageCount() const return m_images.Number(); } +bool wxImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) +{ + m_width = width; + m_height = height; + + return Create(); +} + bool wxImageList::Create() { m_images.DeleteContents( TRUE ); @@ -58,6 +65,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 );