1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.gui.syntaxhighlighter; 13 extern(C++): 14 15 import qt.config; 16 import qt.helpers; 17 static if(!defined!"QT_NO_SYNTAXHIGHLIGHTER") 18 { 19 import qt.core.object; 20 import qt.core.string; 21 import qt.gui.color; 22 import qt.gui.font; 23 import qt.gui.textdocument; 24 import qt.gui.textformat; 25 import qt.gui.textobject; 26 } 27 28 static if(!defined!"QT_NO_SYNTAXHIGHLIGHTER") 29 { 30 31 32 33 extern(C++, class) struct QSyntaxHighlighterPrivate; 34 35 /// Binding for C++ class [QSyntaxHighlighter](https://doc.qt.io/qt-6/qsyntaxhighlighter.html). 36 abstract class /+ Q_GUI_EXPORT +/ QSyntaxHighlighter : QObject 37 { 38 mixin(Q_OBJECT); 39 /+ Q_DECLARE_PRIVATE(QSyntaxHighlighter) +/ 40 public: 41 mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{ 42 /+ explicit +/this(QObject parent); 43 })); 44 mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{ 45 /+ explicit +/this(QTextDocument parent); 46 })); 47 ~this(); 48 49 final void setDocument(QTextDocument doc); 50 final QTextDocument document() const; 51 52 public /+ Q_SLOTS +/: 53 @QSlot final void rehighlight(); 54 @QSlot final void rehighlightBlock(ref const(QTextBlock) block); 55 56 protected: 57 /+ virtual +/ abstract void highlightBlock(ref const(QString) text); 58 59 final void setFormat(int start, int count, ref const(QTextCharFormat) format); 60 final void setFormat(int start, int count, ref const(QColor) color); 61 final void setFormat(int start, int count, ref const(QFont) font); 62 final QTextCharFormat format(int pos) const; 63 64 final int previousBlockState() const; 65 final int currentBlockState() const; 66 final void setCurrentBlockState(int newState); 67 68 final void setCurrentBlockUserData(QTextBlockUserData data); 69 final QTextBlockUserData currentBlockUserData() const; 70 71 final QTextBlock currentBlock() const; 72 73 private: 74 /+ Q_DISABLE_COPY(QSyntaxHighlighter) +/ 75 /+ Q_PRIVATE_SLOT(d_func(), void _q_reformatBlocks(int from, int charsRemoved, int charsAdded)) 76 Q_PRIVATE_SLOT(d_func(), void _q_delayedRehighlight()) +/ 77 mixin(CREATE_CONVENIENCE_WRAPPERS); 78 } 79 80 81 } 82