// Author: Julian Smart
// Modified by:
// Created: 04/01/98
-// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#endif // wxUSE_WXDIB && wxUSE_IMAGE
hbmp = GetHbitmapOf(bitmap);
- HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
+ AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask));
int index = ImageList_Add(GetHImageList(), hbmp, hbmpMask);
if ( index == -1 )
wxLogError(_("Couldn't add an image to the image list."));
}
- ::DeleteObject(hbmpMask);
-
return index;
}
#endif // wxUSE_WXDIB && wxUSE_IMAGE
hbmp = GetHbitmapOf(bitmap);
- HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
+ AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask));
- bool ok = ImageList_Replace(GetHImageList(), index, hbmp, hbmpMask) != 0;
- if ( !ok )
+ if ( !ImageList_Replace(GetHImageList(), index, hbmp, hbmpMask) )
{
wxLogLastError(wxT("ImageList_Replace()"));
+ return false;
}
- ::DeleteObject(hbmpMask);
-
- return ok;
+ return true;
}
// Replaces a bitmap and mask from an icon.
if ( solidBackground )
{
const wxBrush& brush = dc.GetBackground();
- if ( brush.Ok() )
+ if ( brush.IsOk() )
{
clr = wxColourToRGB(brush.GetColour());
}
wxMask *pMask;
bool deleteMask = false;
- if ( mask.Ok() )
+ if ( mask.IsOk() )
{
hbmpMask = GetHbitmapOf(mask);
pMask = NULL;