X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7d174bf49e4081bd974d263384efb6852ae42ac..9905656a35761f368f6775f6f8d50ca393c63088:/include/wx/msw/private.h diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 46d14af631..c7aebfc709 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -325,7 +325,8 @@ struct WinStruct : public T WinStruct() { ::ZeroMemory(this, sizeof(T)); - // NB: gcc-3.4 would give syntax error without "this->" + + // explicit qualification is required here for this to be valid C++ this->cbSize = sizeof(T); } }; @@ -347,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 @@ -492,7 +509,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp -WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font); +WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset);