Added wxDCFontChanger ctor not changing font.

This is similar to the existing wxDCTextColourChanger ctor not changing colour
and is useful in the same kind of situations: when the font may or not be
changed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-12 13:59:13 +00:00
parent 489cc69b39
commit ca4adfd062
2 changed files with 38 additions and 2 deletions

View File

@@ -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);
}