Source-highlight Qt Library
|
00001 /* 00002 * Copyright (C) 2008-2010 Lorenzo Bettini, http://www.lorenzobettini.it 00003 * License: See COPYING file that comes with this distribution 00004 */ 00005 00006 #ifndef QT3TEXTFORMATTER_H_ 00007 #define QT3TEXTFORMATTER_H_ 00008 00009 #include <qfont.h> 00010 #include <qcolor.h> 00011 #include <qsyntaxhighlighter.h> 00012 00013 #include <boost/shared_ptr.hpp> 00014 00015 #include "TextFormatter.h" 00016 #include "Qt3SyntaxHighlighter.h" 00017 00018 namespace srchiliteqt { 00019 00020 typedef boost::shared_ptr<QFont> QFontPtr; 00021 typedef boost::shared_ptr<QColor> QColorPtr; 00022 00026 class Qt3TextFormatter: public TextFormatter { 00027 protected: 00032 QFontPtr font; 00033 00038 QColorPtr color; 00039 00047 Qt3SyntaxHighlighter *qSyntaxHighlighter; 00048 00049 public: 00050 Qt3TextFormatter(const std::string &elem_ = "normal"); 00051 virtual ~Qt3TextFormatter(); 00052 00053 QFont &getQFont() const { 00054 return *font; 00055 } 00056 00057 QColor &getQColor() const { 00058 return *color; 00059 } 00060 00061 virtual void setQSyntaxHighlighter(QSyntaxHighlighter *qSyntaxHighlighter_) { 00062 qSyntaxHighlighter = dynamic_cast<Qt3SyntaxHighlighter *>(qSyntaxHighlighter_); 00063 } 00064 00071 void format(const std::string &s, const srchilite::FormatterParams *params); 00072 00073 }; 00074 00075 } 00076 00077 #endif /* QT3TEXTFORMATTER_H_ */