1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.widgets.textbrowser; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.coreevent; 19 import qt.core.string; 20 import qt.core.stringlist; 21 import qt.core.url; 22 import qt.core.variant; 23 import qt.gui.event; 24 import qt.gui.textdocument; 25 import qt.helpers; 26 import qt.widgets.textedit; 27 import qt.widgets.widget; 28 29 /+ QT_REQUIRE_CONFIG(textbrowser); +/ 30 31 32 extern(C++, class) struct QTextBrowserPrivate; 33 34 class /+ Q_WIDGETS_EXPORT +/ QTextBrowser : QTextEdit 35 { 36 mixin(Q_OBJECT); 37 38 /+ Q_PROPERTY(QUrl source READ source WRITE setSource) 39 Q_PROPERTY(QTextDocument::ResourceType sourceType READ sourceType) 40 Q_OVERRIDE(bool modified SCRIPTABLE false) 41 Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false) 42 Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false) 43 Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths) 44 Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) 45 Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks) +/ 46 47 public: 48 /+ explicit +/this(QWidget parent = null); 49 /+ virtual +/~this(); 50 51 final QUrl source() const; 52 final QTextDocument.ResourceType sourceType() const; 53 54 final QStringList searchPaths() const; 55 final void setSearchPaths(ref const(QStringList) paths); 56 57 /+ virtual +/ override QVariant loadResource(int type, ref const(QUrl) name); 58 59 final bool isBackwardAvailable() const; 60 final bool isForwardAvailable() const; 61 final void clearHistory(); 62 final QString historyTitle(int) const; 63 final QUrl historyUrl(int) const; 64 final int backwardHistoryCount() const; 65 final int forwardHistoryCount() const; 66 67 final bool openExternalLinks() const; 68 final void setOpenExternalLinks(bool open); 69 70 final bool openLinks() const; 71 final void setOpenLinks(bool open); 72 73 public /+ Q_SLOTS +/: 74 /+ #if QT_VERSION < QT_VERSION_CHECK(6,0,0) +/ 75 /+ virtual +/ @QSlot void setSource(ref const(QUrl) name); 76 @QSlot final void setSource(ref const(QUrl) name, QTextDocument.ResourceType type); 77 /+ #else 78 void setSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource); 79 #endif +/ 80 /+ virtual +/ @QSlot void backward(); 81 /+ virtual +/ @QSlot void forward(); 82 /+ virtual +/ @QSlot void home(); 83 /+ virtual +/ @QSlot void reload(); 84 85 /+ Q_SIGNALS +/public: 86 @QSignal final void backwardAvailable(bool); 87 @QSignal final void forwardAvailable(bool); 88 @QSignal final void historyChanged(); 89 @QSignal final void sourceChanged(ref const(QUrl) ); 90 @QSignal final void highlighted(ref const(QUrl) ); 91 /+ #if QT_DEPRECATED_SINCE(5, 15) +/ 92 /+ QT_DEPRECATED_VERSION_X_5_15("Use QTextBrowser::highlighted(QUrl) instead") +/ 93 @QSignal final void highlighted(ref const(QString) ); 94 /+ #endif +/ 95 @QSignal final void anchorClicked(ref const(QUrl) ); 96 97 protected: 98 override bool event(QEvent e); 99 /+ virtual +/ override void keyPressEvent(QKeyEvent ev); 100 /+ virtual +/ override void mouseMoveEvent(QMouseEvent ev); 101 /+ virtual +/ override void mousePressEvent(QMouseEvent ev); 102 /+ virtual +/ override void mouseReleaseEvent(QMouseEvent ev); 103 /+ virtual +/ override void focusOutEvent(QFocusEvent ev); 104 /+ virtual +/ override bool focusNextPrevChild(bool next); 105 /+ virtual +/ override void paintEvent(QPaintEvent e); 106 /+ #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) 107 virtual 108 #endif +/ 109 final void doSetSource(ref const(QUrl) name, QTextDocument.ResourceType type = QTextDocument.ResourceType.UnknownResource); 110 111 private: 112 /+ Q_DISABLE_COPY(QTextBrowser) +/ 113 /+ Q_DECLARE_PRIVATE(QTextBrowser) +/ 114 /+ Q_PRIVATE_SLOT(d_func(), void _q_documentModified()) 115 Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &)) 116 Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) +/ 117 } 118