Fix setting menu item bitmaps after appending them in wxMSW.

Update the bitmap used by Windows when using non-owner-drawn items with
bitmaps.

Closes #9388.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76191 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-23 15:18:37 +00:00
parent 67b128e186
commit a3da62503f
3 changed files with 77 additions and 8 deletions

View File

@@ -77,18 +77,13 @@ public:
void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap)
{
m_bmpChecked = bmpChecked;
m_bmpUnchecked = bmpUnchecked;
SetOwnerDrawn(true);
DoSetBitmap(bmpChecked, true);
DoSetBitmap(bmpUnchecked, false);
}
void SetBitmap(const wxBitmap& bmp, bool bChecked = true)
{
if ( bChecked )
m_bmpChecked = bmp;
else
m_bmpUnchecked = bmp;
SetOwnerDrawn(true);
DoSetBitmap(bmp, bChecked);
}
void SetDisabledBitmap(const wxBitmap& bmpDisabled)
@@ -124,6 +119,9 @@ private:
// helper function to get a handle of bitmap associated with item
WXHBITMAP GetHBitmapForMenu(bool checked = true);
// helper function to set/change the bitmap
void DoSetBitmap(const wxBitmap& bmp, bool bChecked);
#else // !wxUSE_OWNER_DRAWN
// Provide stubs for the public functions above to ensure that the code
// still compiles without wxUSE_OWNER_DRAWN -- it makes sense to just drop