X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b931414d91c7240ae42a67b9fc75e18d93aff721..daebb84bff054d3833baca58a5dc506de56c64a1:/src/generic/imaglist.cpp?ds=sidebyside diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 54e53a6200..9ec73fa68e 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: generic/imaglist.cpp +// Name: src/generic/imaglist.cpp // Purpose: // Author: Robert Roebling // Id: $id$ @@ -7,18 +7,14 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "imaglist.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/defs.h" +#if wxUSE_IMAGLIST #ifndef __WXPALMOS__ @@ -88,7 +84,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) m_width = bitmap.GetWidth(); m_height = bitmap.GetHeight(); } - + return m_images.GetCount()-1; } @@ -107,7 +103,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 +112,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 ); @@ -202,4 +222,5 @@ bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y, return true; } +#endif // wxUSE_IMAGLIST #endif // __WXPALMOS__