From: Włodzimierz Skiba Date: Tue, 25 Apr 2006 15:16:13 +0000 (+0000) Subject: [ 1473731 ] 'wxColourBase and wxString <-> wxColour implementation' X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/68b4e4cff00ea79be15867ecf640d451584f3dd3?ds=sidebyside [ 1473731 ] 'wxColourBase and wxString <-> wxColour implementation' git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 1579782186..3b4ddb5fb6 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -1045,16 +1045,14 @@ static wxColour GetSystemColour(const wxString& name) wxColour wxXmlResourceHandler::GetColour(const wxString& param) { wxString v = GetParamValue(param); + wxColour clr; - // find colour using HTML syntax (#RRGGBB) - unsigned long tmp = 0; - - if (v.length() != 7 || v[0u] != wxT('#') || - wxSscanf(v.c_str(), wxT("#%lX"), &tmp) != 1) + // wxString -> wxColour conversion + if (!clr.Set(v)) { // the colour doesn't use #RRGGBB format, check if it is symbolic // colour name: - wxColour clr = GetSystemColour(v); + clr = GetSystemColour(v); if (clr.Ok()) return clr; @@ -1063,9 +1061,7 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param) return wxNullColour; } - return wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) , - (unsigned char) ((tmp & 0x00FF00) >> 8), - (unsigned char) ((tmp & 0x0000FF))); + return clr; }