00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef QT3SYNTAXHIGHLIGHTER_H_
00010 #define QT3SYNTAXHIGHLIGHTER_H_
00011
00012 #include <qsyntaxhighlighter.h>
00013 #include <qtextedit.h>
00014 #include <qfont.h>
00015 #include <qcolor.h>
00016
00017 #include "GNUSyntaxHighlighter.h"
00018 #include "ParagraphMap.h"
00019
00020 namespace srchiliteqt {
00021
00035 class Qt3SyntaxHighlighter: public QSyntaxHighlighter,
00036 public GNUSyntaxHighlighter {
00037 protected:
00039 ParagraphMap paragraphMap;
00040
00041 int highlightParagraph(const QString & text, int endStateOfLastPara);
00042
00043 public:
00044 Qt3SyntaxHighlighter(QTextEdit *parent = 0);
00045 virtual ~Qt3SyntaxHighlighter();
00046
00051 void init(const std::string &langFile);
00052
00068 void formatString(int start, int count, const QFont &font,
00069 const QColor &color) {
00070 setFormat(start, count, font, color);
00071 }
00072
00073 void formatString(int start, int count, const QFont &font) {
00074 setFormat(start, count, font);
00075 }
00076
00077 };
00078
00079 }
00080
00081 #endif