added wxTo/FromString() overloads for wxFont (1st part of patch 1760073)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-07-27 23:49:08 +00:00
parent ef37a43194
commit fc9361e3ec
3 changed files with 36 additions and 2 deletions

View File

@ -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}.

View File

@ -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"

View File

@ -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);
}