documented the wxDCBrushChanger, wxDCPenChanger, wxDCTextColourChanger; introduced a wxDCFontChanger

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-11-26 15:54:08 +00:00
parent 369042f03c
commit c48d6cdf1f
2 changed files with 162 additions and 0 deletions

View File

@@ -1252,4 +1252,32 @@ private:
DECLARE_NO_COPY_CLASS(wxDCClipper)
};
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC font and
// restore it automatically when the object goes out of scope
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCFontChanger
{
public:
wxDCFontChanger(wxDC& dc, const wxFont& font) : m_dc(dc), m_fontOld(dc.GetFont())
{
m_dc.SetFont(font);
}
~wxDCFontChanger()
{
if ( m_fontOld.Ok() )
m_dc.SetFont(m_fontOld);
}
private:
wxDC& m_dc;
wxFont m_fontOld;
DECLARE_NO_COPY_CLASS(wxDCFontChanger)
};
#endif // _WX_DC_H_BASE_