X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d449473365454452754d36204adf699abf8c997..a8e65eeeae46b9df8577903469c65bb218489372:/src/generic/imaglist.cpp?ds=sidebyside diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 92d7369c70..64995176e2 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__ @@ -28,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() @@ -44,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 ); @@ -62,15 +68,16 @@ int wxImageList::Add( const wxBitmap &bitmap ) int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) { wxBitmap bmp(bitmap); - bmp.SetMask(new wxMask(mask)); + if (mask.Ok()) + bmp.SetMask(new wxMask(mask)); return Add(bmp); } int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour ) { - wxImage img(bitmap); + wxImage img = bitmap.ConvertToImage(); img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue()); - return Add(img.ConvertToBitmap()); + return Add(wxBitmap(img)); } const wxBitmap *wxImageList::GetBitmap( int index ) const