diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index e145da2886..5d8a4e82b6 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -3264,7 +3264,10 @@ and current pointer position in screen coordinates. \membersection{wxFromString}\label{wxfromstring} \func{bool}{wxFromString}{\param{const wxString\& }{str}, - \param{wxColourBase* }{col}} + \param{wxColour* }{col}} + +\func{bool}{wxFromString}{\param{const wxString\& }{str}, + \param{wxFont* }{col}} Converts string to the type of the second argument. Returns \true on success. See also: \helpref{wxToString}{wxtostring}. @@ -3587,7 +3590,9 @@ Notice that there should be no semicolon after this macro. \membersection{wxToString}\label{wxtostring} -\func{wxString}{wxToString}{\param{const wxColourBase\& }{col}} +\func{wxString}{wxToString}{\param{const wxColour\& }{col}} + +\func{wxString}{wxToString}{\param{const wxFont\& }{col}} Converts its argument to string. See also: \helpref{wxFromString}{wxfromstring}. diff --git a/include/wx/font.h b/include/wx/font.h index c20d2125a9..9b87cafd11 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -222,6 +222,12 @@ private: static wxFontEncoding ms_encodingDefault; }; +// wxFontBase <-> wxString utilities, used by wxConfig +WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font); +WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); + + + // include the real class declaration #if defined(__WXPALMOS__) #include "wx/palmos/font.h" diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 20b8c303d0..8a9063f5b3 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -799,3 +799,26 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) } #endif // generic or wxMSW or wxOS2 + + +// wxFont <-> wxString utilities, used by wxConfig +wxString wxToString(const wxFontBase& font) +{ + return font.IsOk() ? font.GetNativeFontInfoDesc() + : wxString(); +} + +bool wxFromString(const wxString& str, wxFontBase *font) +{ + wxCHECK_MSG( font, false, _T("NULL output parameter") ); + + if ( str.empty() ) + { + *font = wxNullFont; + return true; + } + + return font->SetNativeFontInfo(str); +} + +