X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57e075e99a616993d6610ac40eda2434ee00aa9b..e0f6b731a80035dab1c2d1224f8a2dea0c9de947:/include/wx/msw/private.h diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 31d97c60f2..98aee97db4 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -405,6 +405,27 @@ private: DECLARE_NO_COPY_CLASS(SelectInHDC) }; +// a class for temporary bitmaps +class CompatibleBitmap +{ +public: + CompatibleBitmap(HDC hdc, int w, int h) + { + m_hbmp = ::CreateCompatibleBitmap(hdc, w, h); + } + + ~CompatibleBitmap() + { + if ( m_hbmp ) + ::DeleteObject(m_hbmp); + } + + operator HBITMAP() const { return m_hbmp; } + +private: + HBITMAP m_hbmp; +}; + // when working with global pointers (which is unfortunately still necessary // sometimes, e.g. for clipboard) it is important to unlock them exactly as // many times as we lock them which just asks for using a "smart lock" class