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.texttable;
13 extern(C++):
14 
15 import qt.config;
16 import qt.gui.textcursor;
17 import qt.gui.textdocument;
18 import qt.gui.textformat;
19 import qt.gui.textobject;
20 import qt.helpers;
21 
22 extern(C++, class) struct QTextTablePrivate;
23 
24 /// Binding for C++ class [QTextTableCell](https://doc.qt.io/qt-6/qtexttablecell.html).
25 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QTextTableCell
26 {
27 public:
28     @disable this();
29     /+this()
30     {
31         this.table = null;
32     }+/
33     ~this() {}
34     @disable this(this);
35     this(ref const(QTextTableCell) o)
36     {
37         this.table = o.table;
38         this.fragment = o.fragment;
39     }
40     /+ref QTextTableCell operator =(ref const(QTextTableCell) o)
41     { table = o.table; fragment = o.fragment; return this; }+/
42 
43     void setFormat(ref const(QTextCharFormat) format);
44     QTextCharFormat format() const;
45 
46     int row() const;
47     int column() const;
48 
49     int rowSpan() const;
50     int columnSpan() const;
51 
52     pragma(inline, true) bool isValid() const { return table !is null; }
53 
54     QTextCursor firstCursorPosition() const;
55     QTextCursor lastCursorPosition() const;
56     int firstPosition() const;
57     int lastPosition() const;
58 
59     /+pragma(inline, true) bool operator ==(ref const(QTextTableCell) other) const
60     { return table == other.table && fragment == other.fragment; }+/
61     /+pragma(inline, true) bool operator !=(ref const(QTextTableCell) other) const
62     { return !operator==(other); }+/
63 
64     QTextFrame.iterator begin() const;
65     QTextFrame.iterator end() const;
66 
67     int tableCellFormatIndex() const;
68 
69 private:
70     /+ friend class QTextTable; +/
71     this(const(QTextTable) t, int f)
72     {
73         this.table = t;
74         this.fragment = f;
75     }
76 
77     const(QTextTable) table = null;
78     int fragment;
79     mixin(CREATE_CONVENIENCE_WRAPPERS);
80 }
81 
82 /// Binding for C++ class [QTextTable](https://doc.qt.io/qt-6/qtexttable.html).
83 class /+ Q_GUI_EXPORT +/ QTextTable : QTextFrame
84 {
85     mixin(Q_OBJECT);
86 public:
87     /+ explicit +/this(QTextDocument doc);
88     ~this();
89 
90     final void resize(int rows, int cols);
91     final void insertRows(int pos, int num);
92     final void insertColumns(int pos, int num);
93     final void appendRows(int count);
94     final void appendColumns(int count);
95     final void removeRows(int pos, int num);
96     final void removeColumns(int pos, int num);
97 
98     final void mergeCells(int row, int col, int numRows, int numCols);
99     final void mergeCells(ref const(QTextCursor) cursor);
100     final void splitCell(int row, int col, int numRows, int numCols);
101 
102     final int rows() const;
103     final int columns() const;
104 
105     final QTextTableCell cellAt(int row, int col) const;
106     final QTextTableCell cellAt(int position) const;
107     final QTextTableCell cellAt(ref const(QTextCursor) c) const;
108 
109     final QTextCursor rowStart(ref const(QTextCursor) c) const;
110     final QTextCursor rowEnd(ref const(QTextCursor) c) const;
111 
112     final void setFormat(ref const(QTextTableFormat) format);
113     final QTextTableFormat format() const { return QTextObject.format().toTableFormat(); }
114 
115 private:
116     /+ Q_DISABLE_COPY(QTextTable) +/
117     /+ Q_DECLARE_PRIVATE(QTextTable) +/
118     /+ friend class QTextTableCell; +/
119     mixin(CREATE_CONVENIENCE_WRAPPERS);
120 }
121