summaryrefslogtreecommitdiffstats
path: root/sip/qtsql/qdatatable.sip
blob: 87b8a0bec1bb53f22eb3be95c64bfc95570048ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
// This is the SIP interface definition for TQDataTable.
//
// Copyright (c) 2007
// 	Riverbank Computing Limited <info@riverbankcomputing.co.uk>
// 
// This file is part of PyTQt.
// 
// This copy of PyTQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
// 
// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
// details.
// 
// You should have received a copy of the GNU General Public License along with
// PyTQt; see the file LICENSE.  If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


%ExportedDoc
<Sect2><Title>TQDataTable (TQt v3+)</Title>
<Para>
<Literal>TQDataTable</Literal> is fully implemented.
</Para>
</Sect2>
%End


%If (TQt_3_0_0 -)

class TQDataTable : TQTable
{
%TypeHeaderCode
#include <qdatatable.h>
%End

public:
	TQDataTable(TQWidget* /TransferThis/ = 0,const char * = 0);
	TQDataTable(TQSqlCursor *,bool = 0,TQWidget * /TransferThis/ = 0,
		   const char * = 0);

	virtual void addColumn(const TQString &,const TQString & = TQString::null,
			       int = -1,const TQIconSet & = TQIconSet());
	virtual void removeColumn(uint);
	virtual void setColumn(uint,const TQString &,
			       const TQString & = TQString::null,int = -1,
			       const TQIconSet & = TQIconSet());

	TQString nullText() const;
	TQString trueText() const;
	TQString falseText() const;
	DateFormat dateFormat() const;
	bool confirmEdits() const;
	bool confirmInsert() const;
	bool confirmUpdate() const;
	bool confirmDelete() const;
	bool confirmCancels() const;
	bool autoDelete() const;
	bool autoEdit() const;
	TQString filter() const;
	TQStringList sort() const;

	virtual void setSqlCursor(TQSqlCursor * /GetWrapper/ = 0,bool = 0,bool = 0);
%MethodCode
		Py_BEGIN_ALLOW_THREADS
		sipSelfWasArg ? sipCpp->TQDataTable::setSqlCursor(a0, a1, a2) : sipCpp->setSqlCursor(a0, a1, a2);
		Py_END_ALLOW_THREADS

		// Transfer ownership of the cursor if the autoDelete flag is
		// set.
		if (a0 && a2)
			sipTransferTo(a0Wrapper,sipSelf);
%End

	TQSqlCursor *sqlCursor() const;

	virtual void setNullText(const TQString &);
	virtual void setTrueText(const TQString &);
	virtual void setFalseText(const TQString &);
	virtual void setDateFormat(const DateFormat);
	virtual void setConfirmEdits(bool);
	virtual void setConfirmInsert(bool);
	virtual void setConfirmUpdate(bool);
	virtual void setConfirmDelete(bool);
	virtual void setConfirmCancels(bool);
	virtual void setAutoDelete(bool);
	virtual void setAutoEdit(bool);
	virtual void setFilter(const TQString &);
	virtual void setSort(const TQStringList &);
	virtual void setSort(const TQSqlIndex &);

	enum Refresh {
		RefreshData,
		RefreshColumns,
		RefreshAll
	};

	void refresh(Refresh);
	void sortColumn(int,bool = 1,bool = 0);
	TQString text(int,int) const;
	TQVariant value(int,int) const;
	TQSqlRecord *currentRecord() const;

	void installEditorFactory(TQSqlEditorFactory * /Transfer/);
	void installPropertyMap(TQSqlPropertyMap * /Transfer/);

	int numCols() const;
	int numRows() const;
	void setNumCols(int);
	void setNumRows(int);
	bool findBuffer(const TQSqlIndex &,int = 0);

%If (TQt_3_2_0 -)
	void hideColumn(int);
	void showColumn(int);
%End

signals:
	void currentChanged(TQSqlRecord *);
	void primeInsert(TQSqlRecord *);
	void primeUpdate(TQSqlRecord *);
	void primeDelete(TQSqlRecord *);
	void beforeInsert(TQSqlRecord *);
	void beforeUpdate(TQSqlRecord *);
	void beforeDelete(TQSqlRecord *);
	void cursorChanged(TQSql::Op);

public slots:
	virtual void find(const TQString &,bool,bool);
	virtual void sortAscending(int);
	virtual void sortDescending(int);
	virtual void refresh();
	void setColumnWidth(int,int);
%If (TQt_3_0_5 -)
	void adjustColumn(int);
	void setColumnStretchable(int,bool);
%End
%If (TQt_3_1_0 -)
	void swapColumns(int,int,bool = 0);
%End

protected:
	virtual bool insertCurrent();
	virtual bool updateCurrent();
	virtual bool deleteCurrent();

	virtual TQSql::Confirm confirmEdit(TQSql::Op);
	virtual TQSql::Confirm confirmCancel(TQSql::Op);

	virtual void handleError(const TQSqlError &);

	virtual bool beginInsert();
	virtual TQWidget *beginUpdate(int,int,bool);

	bool eventFilter(TQObject *,TQEvent *);
%If (TQt_3_2_0 -)
	void keyPressEvent(TQKeyEvent *);
%End
	void resizeEvent(TQResizeEvent *);
	void contentsMousePressEvent(TQMouseEvent *);
	void contentsContextMenuEvent(TQContextMenuEvent *);
	void endEdit(int,int,bool,bool);

	// We don't specify /Factory/ for this because the returned TQWidget
	// will always have a parent which will own it.
	TQWidget *createEditor(int,int,bool) const;

	void activateNextCell();
	int indexOf(uint) const;
	void reset();
	void setSize(TQSqlCursor *);
	void repaintCell(int,int);
	void paintCell(TQPainter *,int,int,const TQRect &,bool,
		       const TQColorGroup &);
	virtual void paintField(TQPainter *,const TQSqlField *,const TQRect &,
				bool);
%If (TQt_3_1_0 -)
	void drawContents(TQPainter *,int,int,int,int);
%End
	virtual int fieldAlignment(const TQSqlField *);
	void columnClicked(int);
	void resizeData(int);

	TQTableItem *item(int,int) const;
	void setItem(int,int,TQTableItem *);
	void clearCell(int,int);
	void setPixmap(int,int,const TQPixmap &);
	void takeItem(TQTableItem *);

private:
	TQWidget *beginEdit(int,int,bool);

%If (TQt_3_1_0 -)
	TQDataTable(const TQDataTable &);
%End
};

%End