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_ */
Definition: ColorDialog.cpp:12
QColorPtr color
The QColor for the formatter.
Definition: Qt3TextFormatter.h:38
Qt3SyntaxHighlighter * qSyntaxHighlighter
The reference to QSyntaxHighlighter object.
Definition: Qt3TextFormatter.h:47
void format(const std::string &s, const srchilite::FormatterParams *params)
Formats the passed string.
Definition: Qt3TextFormatter.cpp:19
An implementation of QSyntaxHighlighter using GNU Source-highlight library (by relying on GNUSyntaxHi...
Definition: Qt3SyntaxHighlighter.h:32
A specialization of srchilite::Formatter in order to format parts of a document, instead of outputtin...
Definition: TextFormatter.h:30
QFontPtr font
The QFont for the formatter.
Definition: Qt3TextFormatter.h:32
The implementation of TextFormatter for Qt3, relying on QTextCharFormat.
Definition: Qt3TextFormatter.h:26