X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9cd7a3f70056f134b61ac2b70216d578356896c6..15cac64f7564d48c274c6490774a77bd8c09f808:/src/generic/imaglist.cpp diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 72eb445d73..61fb228a2e 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -2,7 +2,7 @@ // Name: src/generic/imaglist.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,6 +68,8 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) _T("invalid bitmap size in wxImageList: this might work ") _T("on this platform but definitely won't under Windows.") ); + const int index = int(m_images.GetCount()); + if (bitmap.IsKindOf(CLASSINFO(wxIcon))) { m_images.Append( new wxIcon( (const wxIcon&) bitmap ) ); @@ -98,7 +100,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) m_height = bitmap.GetHeight(); } - return m_images.GetCount()-1; + return index; } int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) @@ -120,7 +122,7 @@ const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const { wxList::compatibility_iterator node = m_images.Item( index ); - wxCHECK_MSG( node, (wxBitmap *) NULL, wxT("wrong index in image list") ); + wxCHECK_MSG( node, NULL, wxT("wrong index in image list") ); return (wxBitmap*)node->GetData(); }