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.widgets.textbrowser;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.coreevent;
17 import qt.core.string;
18 import qt.core.stringlist;
19 import qt.core.url;
20 import qt.core.variant;
21 import qt.gui.event;
22 import qt.gui.textdocument;
23 import qt.helpers;
24 import qt.widgets.textedit;
25 import qt.widgets.widget;
26 
27 /+ QT_REQUIRE_CONFIG(textbrowser); +/
28 
29 
30 extern(C++, class) struct QTextBrowserPrivate;
31 
32 /// Binding for C++ class [QTextBrowser](https://doc.qt.io/qt-6/qtextbrowser.html).
33 class /+ Q_WIDGETS_EXPORT +/ QTextBrowser : QTextEdit
34 {
35     mixin(Q_OBJECT);
36 
37     /+ Q_PROPERTY(QUrl source READ source WRITE setSource)
38     Q_PROPERTY(QTextDocument::ResourceType sourceType READ sourceType)
39     Q_OVERRIDE(bool modified SCRIPTABLE false)
40     Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false)
41     Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false)
42     Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths)
43     Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
44     Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks) +/
45 
46 public:
47     /+ explicit +/this(QWidget parent = null);
48     /+ virtual +/~this();
49 
50     final QUrl source() const;
51     final QTextDocument.ResourceType sourceType() const;
52 
53     final QStringList searchPaths() const;
54     final void setSearchPaths(ref const(QStringList) paths);
55 
56     /+ virtual +/ override QVariant loadResource(int type, ref const(QUrl) name);
57 
58     final bool isBackwardAvailable() const;
59     final bool isForwardAvailable() const;
60     final void clearHistory();
61     final QString historyTitle(int) const;
62     final QUrl historyUrl(int) const;
63     final int backwardHistoryCount() const;
64     final int forwardHistoryCount() const;
65 
66     final bool openExternalLinks() const;
67     final void setOpenExternalLinks(bool open);
68 
69     final bool openLinks() const;
70     final void setOpenLinks(bool open);
71 
72 public /+ Q_SLOTS +/:
73     @QSlot final void setSource(ref const(QUrl) name, QTextDocument.ResourceType type = QTextDocument.ResourceType.UnknownResource);
74     /+ virtual +/ @QSlot void backward();
75     /+ virtual +/ @QSlot void forward();
76     /+ virtual +/ @QSlot void home();
77     /+ virtual +/ @QSlot void reload();
78 
79 /+ Q_SIGNALS +/public:
80     @QSignal final void backwardAvailable(bool);
81     @QSignal final void forwardAvailable(bool);
82     @QSignal final void historyChanged();
83     @QSignal final void sourceChanged(ref const(QUrl) );
84     @QSignal final void highlighted(ref const(QUrl) );
85     @QSignal final void anchorClicked(ref const(QUrl) );
86 
87 protected:
88     override bool event(QEvent e);
89     /+ virtual +/ override void keyPressEvent(QKeyEvent ev);
90     /+ virtual +/ override void mouseMoveEvent(QMouseEvent ev);
91     /+ virtual +/ override void mousePressEvent(QMouseEvent ev);
92     /+ virtual +/ override void mouseReleaseEvent(QMouseEvent ev);
93     /+ virtual +/ override void focusOutEvent(QFocusEvent ev);
94     /+ virtual +/ override bool focusNextPrevChild(bool next);
95     /+ virtual +/ override void paintEvent(QPaintEvent e);
96     /+ virtual +/ void doSetSource(ref const(QUrl) name, QTextDocument.ResourceType type = QTextDocument.ResourceType.UnknownResource);
97 
98 private:
99     /+ Q_DISABLE_COPY(QTextBrowser) +/
100     /+ Q_DECLARE_PRIVATE(QTextBrowser) +/
101     /+ Q_PRIVATE_SLOT(d_func(), void _q_documentModified())
102     Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &))
103     Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) +/
104     mixin(CREATE_CONVENIENCE_WRAPPERS);
105 }
106