]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontdata.cpp
Disable wxUSE_ENH_METAFILE for wxGTK builds.
[wxWidgets.git] / src / common / fontdata.cpp
index 05bd16f524fd4579e33462cf4b2a4792158abc6c..5882e2ffb2636d15efd6329860a82481bdc39857 100644 (file)
@@ -67,3 +67,29 @@ wxFontData& wxFontData::operator=(const wxFontData& data)
     return *this;
 }
 #endif // wxUSE_FONTDLG || wxUSE_FONTPICKERCTRL
+
+#if wxUSE_FONTDLG
+
+#include "wx/fontdlg.h"
+
+wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit, const wxString& caption)
+{
+    wxFontData data;
+    if ( fontInit.IsOk() )
+    {
+        data.SetInitialFont(fontInit);
+    }
+
+    wxFont fontRet;
+    wxFontDialog dialog(parent, data);
+    if (!caption.empty())
+        dialog.SetTitle(caption);
+    if ( dialog.ShowModal() == wxID_OK )
+    {
+        fontRet = dialog.GetFontData().GetChosenFont();
+    }
+    //else: leave it invalid
+
+    return fontRet;
+}
+#endif // wxUSE_FONTDLG