No changes, just factor our wxDirection parsing code in wxXRC.

Move it from wxButtonXmlHandler into a reusable wxXmlResourceHandler::
GetDirection() that can used by the other handlers too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68839 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-08-22 12:18:49 +00:00
parent ea11bf3abc
commit 50c202914e
4 changed files with 51 additions and 27 deletions

View File

@@ -2150,6 +2150,40 @@ wxCoord wxXmlResourceHandler::GetDimension(const wxString& param,
return sx;
}
wxDirection
wxXmlResourceHandler::GetDirection(const wxString& param, wxDirection dirDefault)
{
wxDirection dir;
const wxString dirstr = GetParamValue(param);
if ( dirstr.empty() )
dir = dirDefault;
else if ( dirstr == "wxLEFT" )
dir = wxLEFT;
else if ( dirstr == "wxRIGHT" )
dir = wxRIGHT;
else if ( dirstr == "wxTOP" )
dir = wxTOP;
else if ( dirstr == "wxBOTTOM" )
dir = wxBOTTOM;
else
{
ReportError
(
GetParamNode(param),
wxString::Format
(
"Invalid direction \"%s\": must be one of "
"wxLEFT|wxRIGHT|wxTOP|wxBOTTOM.",
dirstr
)
);
dir = dirDefault;
}
return dir;
}
// Get system font index using indexname
static wxFont GetSystemFont(const wxString& name)