X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b534968dc31dc9a25aff117ba220be1378e50722..8f4745feeb2850f3bebb3af45407e164550d541a:/src/common/colourcmn.cpp diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp index 4868f808f2..a03efa7942 100644 --- a/src/common/colourcmn.cpp +++ b/src/common/colourcmn.cpp @@ -110,7 +110,7 @@ wxString wxColourBase::GetAsString(long flags) const if ( (flags & wxC2S_NAME) && isOpaque ) { colName = wxTheColourDatabase->FindName( - wx_static_cast(const wxColour &, *this)).MakeLower(); + static_cast(*this)).MakeLower(); } if ( colName.empty() ) @@ -163,3 +163,25 @@ void wxColourBase::InitFromName(const wxString& col) } #endif // WXWIN_COMPATIBILITY_2_6 + +// wxColour <-> wxString utilities, used by wxConfig +wxString wxToString(const wxColourBase& col) +{ + return col.IsOk() ? col.GetAsString(wxC2S_CSS_SYNTAX) + : wxString(); +} + +bool wxFromString(const wxString& str, wxColourBase *col) +{ + wxCHECK_MSG( col, false, _T("NULL output parameter") ); + + if ( str.empty() ) + { + *col = wxNullColour; + return true; + } + + return col->Set(str); +} + +