// wxString <-> wxColour conversions
// ============================================================================
-bool wxColourBase::FromString(const wxChar *str)
+bool wxColourBase::FromString(const wxString& str)
{
- if ( str == NULL || str[0] == wxT('\0'))
+ if ( str.empty() )
return false; // invalid or empty string
if ( wxStrncmp(str, wxT("RGB"), 3) == 0 ||
// according to http://www.w3.org/TR/REC-CSS2/syndata.html#color-units
// values outside 0-255 range are allowed but should be clipped
int red, green, blue;
- if (wxSscanf(&str[3], wxT("(%d, %d, %d)"), &red, &green, &blue) != 3)
+ if (wxSscanf(str.wx_str() + 3, wxT("(%d, %d, %d)"), &red, &green, &blue) != 3)
return false;
Set((unsigned char)wxClip(red,0,255),
{
// hexadecimal prefixed with # (HTML syntax)
unsigned long tmp;
- if (wxSscanf(&str[1], wxT("%lx"), &tmp) != 1)
+ if (wxSscanf(str.wx_str() + 1, wxT("%lx"), &tmp) != 1)
return false;
Set((unsigned char)(tmp >> 16),