]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dc.h
deprecate wxStringEq
[wxWidgets.git] / include / wx / dc.h
index f780315d50b85e69ce7e0f46ab508dfcb2234e1d..ab19b30997693a161011a70679a0cbcca8febefb 100644 (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_