+ // also deal with disabled bitmap if we want to use them
+ if ( m_disabledImgList )
+ {
+ wxBitmap bmpDisabled = tool->GetDisabledBitmap();
+#if wxUSE_IMAGE
+ if ( !bmpDisabled.Ok() )
+ {
+ // no disabled bitmap specified but we still need to
+ // fill the space in the image list with something, so
+ // we grey out the normal bitmap
+ wxImage imgGreyed;
+ wxCreateGreyedImage(bmp.ConvertToImage(), imgGreyed);
+
+ // we need to have light grey background colour for
+ // MapBitmap() to work correctly
+ for ( int y = 0; y < h; y++ )
+ {
+ for ( int x = 0; x < w; x++ )
+ {
+ if ( imgGreyed.IsTransparent(x, y) )
+ imgGreyed.SetRGB(x, y,
+ wxLIGHT_GREY->Red(),
+ wxLIGHT_GREY->Green(),
+ wxLIGHT_GREY->Blue());
+ }
+ }
+
+ bmpDisabled = wxBitmap(imgGreyed);
+ }
+#endif // wxUSE_IMAGE
+
+ MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
+
+ m_disabledImgList->Add(bmpDisabled);
+ }
+