X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/081d8d96db3bfe4dc490a6244b17184366846738..931d6a47c32a5b4c283243cb553ce71ee2b535d5:/src/common/fontdata.cpp?ds=sidebyside diff --git a/src/common/fontdata.cpp b/src/common/fontdata.cpp index 05bd16f524..deef52ce2a 100644 --- a/src/common/fontdata.cpp +++ b/src/common/fontdata.cpp @@ -1,7 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/common/fontdata.cpp // Author: Julian Smart -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -67,3 +66,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