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