X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b931414d91c7240ae42a67b9fc75e18d93aff721..d45318b8b6857ab6159b37c2f3ddce6a5f68be28:/src/generic/imaglist.cpp diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 54e53a6200..51b6970d5f 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -107,7 +107,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour return Add(wxBitmap(img)); } -const wxBitmap *wxGenericImageList::GetBitmap( int index ) const +const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const { wxList::compatibility_iterator node = m_images.Item( index ); @@ -116,6 +116,30 @@ const wxBitmap *wxGenericImageList::GetBitmap( int index ) const return (wxBitmap*)node->GetData(); } +// Get the bitmap +wxBitmap wxGenericImageList::GetBitmap(int index) const +{ + const wxBitmap* bmp = GetBitmapPtr(index); + if (bmp) + return *bmp; + else + return wxNullBitmap; +} + +// Get the icon +wxIcon wxGenericImageList::GetIcon(int index) const +{ + const wxBitmap* bmp = GetBitmapPtr(index); + if (bmp) + { + wxIcon icon; + icon.CopyFromBitmap(*bmp); + return icon; + } + else + return wxNullIcon; +} + bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) { wxList::compatibility_iterator node = m_images.Item( index );