Mercurial > octave-nkf
comparison gui/octave-gui/src/TerminalHighlighter.h @ 14240:a9992bc3c3f7 gui
GUI: Added qtermwidget snapshot as a subproject to build as a library that links with Octave GUI.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sat, 21 Jan 2012 11:26:36 +0100 |
parents | gui/src/TerminalHighlighter.h@c0e66d6e3dc8 |
children |
comparison
equal
deleted
inserted
replaced
14239:7ecaa8a66d5a | 14240:a9992bc3c3f7 |
---|---|
1 /* OctaveGUI - A graphical user interface for Octave | |
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) | |
3 * | |
4 * This program is free software: you can redistribute it and/or modify | |
5 * it under the terms of the GNU Affero General Public License as | |
6 * published by the Free Software Foundation, either version 3 of the | |
7 * License, or (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU Affero General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Affero General Public License | |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 #ifndef TERMINALHIGHLIGHTER_H | |
19 #define TERMINALHIGHLIGHTER_H | |
20 | |
21 #include <QSyntaxHighlighter> | |
22 | |
23 #include <QHash> | |
24 #include <QTextCharFormat> | |
25 | |
26 class QTextDocument; | |
27 | |
28 class TerminalHighlighter : public QSyntaxHighlighter | |
29 { | |
30 Q_OBJECT | |
31 | |
32 public: | |
33 TerminalHighlighter(QTextDocument *parent = 0); | |
34 | |
35 protected: | |
36 void highlightBlock(const QString &text); | |
37 | |
38 private: | |
39 struct HighlightingRule | |
40 { | |
41 QRegExp pattern; | |
42 QTextCharFormat format; | |
43 }; | |
44 | |
45 QVector<HighlightingRule> highlightingRules; | |
46 QTextCharFormat keywordFormat; | |
47 QTextCharFormat doubleQouteFormat; | |
48 QTextCharFormat functionFormat; | |
49 QTextCharFormat urlFormat; | |
50 QTextCharFormat captionFormat; | |
51 QTextCharFormat subCaptionFormat; | |
52 QTextCharFormat numberFormat; | |
53 }; | |
54 | |
55 | |
56 #endif // TERMINALHIGHLIGHTER_H |