/////////////////////////////////////////////////////////////////////////////
// Name: src/common/fontdata.cpp
// Author: Julian Smart
-// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
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