+
+// Extract style settings from a spec-string which is composed of one or
+// more of the following comma separated elements:
+//
+// bold turns on bold
+// italic turns on italics
+// fore:#RRGGBB sets the foreground colour
+// back:#RRGGBB sets the background colour
+// face:[facename] sets the font face name to use
+// size:[num] sets the font size in points
+// eol turns on eol filling
+// underline turns on underlining
+//
+void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
+
+ wxStringTokenizer tkz(spec, wxT(","));
+ while (tkz.HasMoreTokens()) {
+ wxString token = tkz.GetNextToken();
+
+ wxString option = token.BeforeFirst(':');
+ wxString val = token.AfterFirst(':');
+
+ if (option == wxT("bold"))
+ StyleSetBold(styleNum, true);
+
+ else if (option == wxT("italic"))
+ StyleSetItalic(styleNum, true);
+
+ else if (option == wxT("underline"))
+ StyleSetUnderline(styleNum, true);
+
+ else if (option == wxT("eol"))
+ StyleSetEOLFilled(styleNum, true);
+
+ else if (option == wxT("size")) {
+ long points;
+ if (val.ToLong(&points))
+ StyleSetSize(styleNum, points);
+ }
+
+ else if (option == wxT("face"))
+ StyleSetFaceName(styleNum, val);
+
+ else if (option == wxT("fore"))
+ StyleSetForeground(styleNum, wxColourFromSpec(val));
+
+ else if (option == wxT("back"))
+ StyleSetBackground(styleNum, wxColourFromSpec(val));
+ }