Source-highlight Qt Library
Qt3SyntaxHighlighter.h
1 /*
2  * Copyright (C) 2008-2010 Lorenzo Bettini, http://www.lorenzobettini.it
3  * License: See COPYING file that comes with this distribution
4  */
5 
6 #ifndef QT3SYNTAXHIGHLIGHTER_H_
7 #define QT3SYNTAXHIGHLIGHTER_H_
8 
9 #include <qsyntaxhighlighter.h>
10 #include <qtextedit.h>
11 #include <qfont.h>
12 #include <qcolor.h>
13 
14 #include "GNUSyntaxHighlighter.h"
15 #include "ParagraphMap.h"
16 
17 namespace srchiliteqt {
18 
32 class Qt3SyntaxHighlighter: public QSyntaxHighlighter,
33  public GNUSyntaxHighlighter {
34 protected:
37 
38  int highlightParagraph(const QString & text, int endStateOfLastPara);
39 
40 public:
41  Qt3SyntaxHighlighter(QTextEdit *parent = 0);
42  virtual ~Qt3SyntaxHighlighter();
43 
48  void init(const std::string &langFile);
49 
65  void formatString(int start, int count, const QFont &font,
66  const QColor &color) {
67  setFormat(start, count, font, color);
68  }
69 
70  void formatString(int start, int count, const QFont &font) {
71  setFormat(start, count, font);
72  }
73 
74 };
75 
76 }
77 
78 #endif /* QT3SYNTAXHIGHLIGHTER_H_ */