X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/081d8d96db3bfe4dc490a6244b17184366846738..ad653fa23069c5d9378247084f03c9a718c3ad62:/src/common/fontdata.cpp diff --git a/src/common/fontdata.cpp b/src/common/fontdata.cpp index 05bd16f524..5882e2ffb2 100644 --- a/src/common/fontdata.cpp +++ b/src/common/fontdata.cpp @@ -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