Blindly added wxImageList::replace( int, bitmap, mask )

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2006-04-30 10:38:32 +00:00
parent 3f8fba02a2
commit f644bc116b
2 changed files with 37 additions and 0 deletions

View File

@ -68,6 +68,7 @@ public:
wxBitmap GetBitmap(int index) const;
wxIcon GetIcon(int index) const;
bool Replace( int index, const wxBitmap &bitmap );
bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask );
bool Remove( int index );
bool RemoveAll();

View File

@ -169,6 +169,42 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap )
return true;
}
bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask )
{
wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap* newBitmap = (bitmap.IsKindOf(CLASSINFO(wxIcon))) ?
#if defined(__VISAGECPP__)
//just can't do this in VisualAge now, with all this new Bitmap-Icon stuff
//so construct it from a bitmap object until I can figure this nonsense out. (DW)
new wxBitmap(bitmap)
#else
new wxBitmap( (const wxIcon&) bitmap )
#endif
: new wxBitmap(bitmap) ;
if (index == (int) m_images.GetCount() - 1)
{
delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
wxList::compatibility_iterator next = node->GetNext();
delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
if (mask.Ok())
newBitmap->SetMask(new wxMask(mask));
return true;
}
bool wxGenericImageList::Remove( int index )
{
wxList::compatibility_iterator node = m_images.Item( index );