[ 1473731 ] 'wxColourBase and wxString <-> wxColour implementation'

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-04-25 15:16:13 +00:00
parent 88a7a4e10e
commit 68b4e4cff0

View File

@@ -1045,16 +1045,14 @@ static wxColour GetSystemColour(const wxString& name)
wxColour wxXmlResourceHandler::GetColour(const wxString& param) wxColour wxXmlResourceHandler::GetColour(const wxString& param)
{ {
wxString v = GetParamValue(param); wxString v = GetParamValue(param);
wxColour clr;
// find colour using HTML syntax (#RRGGBB) // wxString -> wxColour conversion
unsigned long tmp = 0; if (!clr.Set(v))
if (v.length() != 7 || v[0u] != wxT('#') ||
wxSscanf(v.c_str(), wxT("#%lX"), &tmp) != 1)
{ {
// the colour doesn't use #RRGGBB format, check if it is symbolic // the colour doesn't use #RRGGBB format, check if it is symbolic
// colour name: // colour name:
wxColour clr = GetSystemColour(v); clr = GetSystemColour(v);
if (clr.Ok()) if (clr.Ok())
return clr; return clr;
@@ -1063,9 +1061,7 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
return wxNullColour; return wxNullColour;
} }
return wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) , return clr;
(unsigned char) ((tmp & 0x00FF00) >> 8),
(unsigned char) ((tmp & 0x0000FF)));
} }