+
+ return *this;
+}
+
+// ----------------------------------------------------------------------------
+// [de]serialization
+// ----------------------------------------------------------------------------
+
+// separator used between different fields
+static const char wxCOL_DATA_SEP = ',';
+
+wxString wxColourData::ToString() const
+{
+ wxString str(m_chooseFull ? '1' : '0');
+
+ for ( int i = 0; i < NUM_CUSTOM; i++ )
+ {
+ str += wxCOL_DATA_SEP;
+
+ const wxColour& clr = m_custColours[i];
+ if ( clr.IsOk() )
+ str += clr.GetAsString(wxC2S_HTML_SYNTAX);
+ }
+
+ return str;
+}
+
+bool wxColourData::FromString(const wxString& str)
+{
+ wxStringTokenizer tokenizer(str, wxCOL_DATA_SEP);
+ wxString token = tokenizer.GetNextToken();
+ m_chooseFull = token == '1';
+ bool success = m_chooseFull || token == '0';
+ for (int i = 0; success && i < NUM_CUSTOM; i++)
+ {
+ token = tokenizer.GetNextToken();
+ if (token.empty())
+ m_custColours[i] = wxNullColour;
+ else
+ success = m_custColours[i].Set(token);
+ }
+ return success;