qscistyledtext.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This module defines interface to the QsciStyledText 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 QSCISTYLEDTEXT_H
  20. #define QSCISTYLEDTEXT_H
  21. #include <qstring.h>
  22. #include <Qsci/qsciglobal.h>
  23. class QsciScintillaBase;
  24. class QsciStyle;
  25. //! \brief The QsciStyledText class is a container for a piece of text and the
  26. //! style used to display the text.
  27. class QSCINTILLA_EXPORT QsciStyledText
  28. {
  29. public:
  30. //! Constructs a QsciStyledText instance for text \a text and style number
  31. //! \a style.
  32. QsciStyledText(const QString &text, int style);
  33. //! Constructs a QsciStyledText instance for text \a text and style \a
  34. //! style.
  35. QsciStyledText(const QString &text, const QsciStyle &style);
  36. //! \internal Apply the style to a particular editor.
  37. void apply(QsciScintillaBase *sci) const;
  38. //! Returns a reference to the text.
  39. const QString &text() const {return styled_text;}
  40. //! Returns the number of the style.
  41. int style() const;
  42. private:
  43. QString styled_text;
  44. int style_nr;
  45. const QsciStyle *explicit_style;
  46. };
  47. #endif