Source-highlight Qt Library
Qt3TextFormatter.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 QT3TEXTFORMATTER_H_
7 #define QT3TEXTFORMATTER_H_
8 
9 #include <qfont.h>
10 #include <qcolor.h>
11 #include <qsyntaxhighlighter.h>
12 
13 #include <boost/shared_ptr.hpp>
14 
15 #include "TextFormatter.h"
16 #include "Qt3SyntaxHighlighter.h"
17 
18 namespace srchiliteqt {
19 
20 typedef boost::shared_ptr<QFont> QFontPtr;
21 typedef boost::shared_ptr<QColor> QColorPtr;
22 
27 protected:
32  QFontPtr font;
33 
38  QColorPtr color;
39 
48 
49 public:
50  Qt3TextFormatter(const std::string &elem_ = "normal");
51  virtual ~Qt3TextFormatter();
52 
53  QFont &getQFont() const {
54  return *font;
55  }
56 
57  QColor &getQColor() const {
58  return *color;
59  }
60 
61  virtual void setQSyntaxHighlighter(QSyntaxHighlighter *qSyntaxHighlighter_) {
62  qSyntaxHighlighter = dynamic_cast<Qt3SyntaxHighlighter *>(qSyntaxHighlighter_);
63  }
64 
71  void format(const std::string &s, const srchilite::FormatterParams *params);
72 
73 };
74 
75 }
76 
77 #endif /* QT3TEXTFORMATTER_H_ */