-
-
-// 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
-//
-
-void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
-
- wxStringTokenizer tkz(spec, ",");
- while (tkz.HasMoreTokens()) {
- wxString token = tkz.GetNextToken();
-
- wxString option = token.BeforeFirst(':');
- wxString val = token.AfterFirst(':');
-
- if (option == "bold")
- StyleSetBold(styleNum, true);
-
- else if (option == "italic")
- StyleSetItalic(styleNum, true);
-
- else if (option == "eol")
- StyleSetEOLFilled(styleNum, true);
-
- else if (option == "size") {
- long points;
- if (val.ToLong(&points))
- StyleSetSize(styleNum, points);
- }
-
- else if (option == "face")
- StyleSetFaceName(styleNum, val);
-
- else if (option == "fore")
- StyleSetForeground(styleNum, wxColourFromSpec(val));
-
- else if (option == "back")
- StyleSetBackground(styleNum, wxColourFromSpec(val));
- }