Fix showing of 32bpp bitmaps without alpha in wxMSW wxStaticBitmap.

The native control doesn't make a secret copy of the image in this case (0RGB
bitmap, i.e. 32bpp ARGB bitmap with all alpha values set to 0) and just shows
the bitmap we assigned to it directly, so we must not delete it in this case,
otherwise nothing is shown at all.

Closes #16084.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-14 19:22:31 +00:00
parent 6b296279ba
commit f9b4d6b18c
2 changed files with 36 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ protected:
virtual wxSize DoGetBestClientSize() const;
// ctor/dtor helpers
void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; }
void Init();
void Free();
// true if icon/bitmap is valid
@@ -85,10 +85,17 @@ protected:
WXHANDLE m_currentHandle;
private:
// Flag indicating whether we own m_currentHandle, i.e. should delete it.
bool m_ownsCurrentHandle;
// Replace the image at the native control level with the given HBITMAP or
// HICON (which can be 0) and destroy the previous image if necessary.
void MSWReplaceImageHandle(WXLPARAM handle);
// Delete the current handle only if we own it.
void DeleteCurrentHandleIfNeeded();
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxStaticBitmap);