X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/942d5e2d7223bde6ae7aceab3ddb3d417b55d48c..3a61f5db2c1292d1f6cbfc5bff1edfbdf7b1fc99:/include/wx/dc.h diff --git a/include/wx/dc.h b/include/wx/dc.h index 4981bda64a..82f4848adf 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -1377,8 +1377,21 @@ private: class WXDLLIMPEXP_CORE wxDCFontChanger { public: - wxDCFontChanger(wxDC& dc, const wxFont& font) : m_dc(dc), m_fontOld(dc.GetFont()) + wxDCFontChanger(wxDC& dc) + : m_dc(dc), m_fontOld() { + } + + wxDCFontChanger(wxDC& dc, const wxFont& font) + : m_dc(dc), m_fontOld(dc.GetFont()) + { + m_dc.SetFont(font); + } + + void Set(const wxFont& font) + { + if ( !m_fontOld.Ok() ) + m_fontOld = m_dc.GetFont(); m_dc.SetFont(font); }