• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

GNUSyntaxHighlighter.h

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 GNUSYNTAXHIGHLIGHTER_H_
00007 #define GNUSYNTAXHIGHLIGHTER_H_
00008 
00009 #include <srchilite/highlightstate.h>
00010 #include <srchilite/formattermanager.h>
00011 #include <srchilite/sourcehighlighter.h>
00012 #include <srchilite/formatterparams.h>
00013 #include <srchilite/langdefmanager.h>
00014 #include <srchilite/langmap.h>
00015 
00016 #include "TextFormatterFactory.h"
00017 #include "HighlightStateData.h"
00018 
00019 namespace srchiliteqt {
00020 
00026 class GNUSyntaxHighlighter {
00028     QString langFile;
00029 
00031     srchilite::SourceHighlighter *sourceHighlighter;
00032 
00037     srchilite::FormatterParams formatterParams;
00038 
00040     QString foregroundColor;
00041 
00043     QString backgroundColor;
00044 
00046     bool readOnly;
00047 
00049     bool defaultToMonospace;
00050 
00051 protected:
00055     srchilite::FormatterManager *formatterManager;
00056 
00057 public:
00058     GNUSyntaxHighlighter();
00059     virtual ~GNUSyntaxHighlighter();
00060 
00061     const QString &getLangFile() const { return langFile; }
00062 
00070     srchilite::HighlightStatePtr getHighlightState(const QString &file);
00071 
00078     void initHighlighter(const QString &file);
00079 
00088     const QString getLangDefFileFromFileName(const QString &filename);
00089 
00093     srchilite::SourceHighlighter *getHighlighter() const {
00094         return sourceHighlighter;
00095     }
00096 
00110     const TextFormatterMap &getTextFormatterMap(
00111             TextFormatterFactory &formatterFactory,
00112             const QString &styleFile = "default.style");
00113 
00117     srchilite::FormatterManager *getFormatterManager() const {
00118         return formatterManager;
00119     }
00120 
00139     void highlightLine(const QString &line, HighlightStateData *&stateData);
00140 
00144     srchilite::LangDefManager *getLangDefManager() const;
00145 
00149     srchilite::LangMap *getLangMap() const;
00150 
00154     srchilite::LangMap *getOutLangMap() const;
00155 
00159     const QString &getForegroundColor() const {
00160         return foregroundColor;
00161     }
00162 
00166     const QString &getBackgroundColor() const {
00167         return backgroundColor;
00168     }
00169 
00170     void setForegroundColor(const QString &f) {
00171         foregroundColor = f;
00172     }
00173 
00174     void setBackgroundColor(const QString &b) {
00175         backgroundColor = b;
00176     }
00177 
00181     bool isReadOnly() const {
00182         return readOnly;
00183     }
00184 
00192     void setReadOnly(bool r) {
00193         readOnly = r;
00194     }
00195 
00196     bool isDefaultToMonospace() const {
00197         return defaultToMonospace;
00198     }
00199 
00206     void setDefaultToMonospace(bool d) {
00207         defaultToMonospace = d;
00208     }
00209 };
00210 
00211 }
00212 
00213 #endif /* GNUSYNTAXHIGHLIGHTER_H_ */

Generated on Mon Jul 26 2010 10:44:31 for Source-highlight Qt Library by  doxygen 1.7.1