qscilexerxml.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // This defines the interface to the QsciLexerXML class.
  2. //
  3. // Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
  4. //
  5. // This file is part of QScintilla.
  6. //
  7. // This file may be used under the terms of the GNU General Public License
  8. // version 3.0 as published by the Free Software Foundation and appearing in
  9. // the file LICENSE included in the packaging of this file. Please review the
  10. // following information to ensure the GNU General Public License version 3.0
  11. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  12. //
  13. // If you do not wish to use this file under the terms of the GPL version 3.0
  14. // then you may purchase a commercial license. For more information contact
  15. // info@riverbankcomputing.com.
  16. //
  17. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  18. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #ifndef QSCILEXERXML_H
  20. #define QSCILEXERXML_H
  21. #include <QObject>
  22. #include <Qsci/qsciglobal.h>
  23. #include <Qsci/qscilexerhtml.h>
  24. //! \brief The QsciLexerXML class encapsulates the Scintilla XML lexer.
  25. class QSCINTILLA_EXPORT QsciLexerXML : public QsciLexerHTML
  26. {
  27. Q_OBJECT
  28. public:
  29. //! Construct a QsciLexerXML with parent \a parent. \a parent is typically
  30. //! the QsciScintilla instance.
  31. QsciLexerXML(QObject *parent = 0);
  32. //! Destroys the QsciLexerXML instance.
  33. virtual ~QsciLexerXML();
  34. //! Returns the name of the language.
  35. const char *language() const;
  36. //! Returns the name of the lexer. Some lexers support a number of
  37. //! languages.
  38. const char *lexer() const;
  39. //! Returns the foreground colour of the text for style number \a style.
  40. //!
  41. //! \sa defaultPaper()
  42. QColor defaultColor(int style) const;
  43. //! Returns the end-of-line fill for style number \a style.
  44. bool defaultEolFill(int style) const;
  45. //! Returns the font for style number \a style.
  46. QFont defaultFont(int style) const;
  47. //! Returns the background colour of the text for style number \a style.
  48. //!
  49. //! \sa defaultColor()
  50. QColor defaultPaper(int style) const;
  51. //! Returns the set of keywords for the keyword set \a set recognised
  52. //! by the lexer as a space separated string.
  53. const char *keywords(int set) const;
  54. //! Causes all properties to be refreshed by emitting the
  55. //! propertyChanged() signal as required.
  56. void refreshProperties();
  57. //! If \a allowed is true then scripts are styled. The default is true.
  58. //!
  59. //! \sa scriptsStyled()
  60. void setScriptsStyled(bool styled);
  61. //! Returns true if scripts are styled.
  62. //!
  63. //! \sa setScriptsStyled()
  64. bool scriptsStyled() const;
  65. protected:
  66. //! The lexer's properties are read from the settings \a qs. \a prefix
  67. //! (which has a trailing '/') should be used as a prefix to the key of
  68. //! each setting. true is returned if there is no error.
  69. //!
  70. bool readProperties(QSettings &qs, const QString &prefix);
  71. //! The lexer's properties are written to the settings \a qs.
  72. //! \a prefix (which has a trailing '/') should be used as a prefix to
  73. //! the key of each setting. true is returned if there is no error.
  74. //!
  75. bool writeProperties(QSettings &qs, const QString &prefix) const;
  76. private:
  77. void setScriptsProp();
  78. bool scripts;
  79. QsciLexerXML(const QsciLexerXML &);
  80. QsciLexerXML &operator=(const QsciLexerXML &);
  81. };
  82. #endif