From: Vadim Zeitlin Date: Wed, 30 Jun 2004 15:44:11 +0000 (+0000) Subject: added WindowHDC similar to Screen/MemoryHDC X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2ff56383e629e79a3f4d1ce973e2345c7d4777ea added WindowHDC similar to Screen/MemoryHDC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 02c754a486..c7aebfc709 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -348,6 +348,22 @@ private: DECLARE_NO_COPY_CLASS(ScreenHDC) }; +// the same as ScreenHDC but for window DCs +class WindowHDC +{ +public: + WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } + ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HWND m_hwnd; + HDC m_hdc; + + DECLARE_NO_COPY_CLASS(WindowHDC) +}; + // the same as ScreenHDC but for memory DCs: creates the HDC compatible with // the given one (screen by default) in ctor and destroys it in dtor class MemoryHDC