summaryrefslogtreecommitdiffstats
path: root/sip/tqt/tqlistbox.sip
blob: 9efb272624af2d1a0ab7903777bc55f7be7239cd (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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// This is the SIP interface definition for TQListBox, TQListBoxItem,
// TQListBoxPixmap and TQListBoxText.
//
// Copyright (c) 2007
// 	Riverbank Computing Limited <[email protected]>
// 
// 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>TQListBox</Title>
<FuncSynopsis>
        <FuncDef>bool <Function>itemYPos</Function></FuncDef>
        <ParamDef>int <Parameter>index</Parameter></ParamDef>
        <ParamDef>int *<Parameter>yPos</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes the <Literal>index</Literal> parameter and returns a tuple
containing the <Literal>bool</Literal> result and <Literal>yPos</Literal>.
(TQt v1.x)
</Para>
</Sect2>

<Sect2><Title>TQListBoxItem</Title>
<Para>
<Literal>TQListBoxItem</Literal> is fully implemented.
</Para>
</Sect2>

<Sect2><Title>TQListBoxPixmap</Title>
<Para>
<Literal>TQListBoxPixmap</Literal> is fully implemented.
</Para>
</Sect2>

<Sect2><Title>TQListBoxText</Title>
<Para>
<Literal>TQListBoxText</Literal> is fully implemented.
</Para>
</Sect2>
%End


class TQListBox : TQScrollView
{
%TypeHeaderCode
#include <tqlistbox.h>
%End

public:
	TQListBox(TQWidget * /TransferThis/ = 0,const char * = 0,WFlags = 0);

	virtual void setFont(const TQFont &);

	uint count() const;

	void insertStringList(const TQStringList &,int = -1);
	void insertStrList(const TQStrList *,int = -1);
//	void insertStrList(const TQStrList &,int = -1);
//	void insertStrList(const char **,int = -1,int = -1);

	void insertItem(const TQListBoxItem * /Transfer/,int = -1);
	void insertItem(const TQListBoxItem * /Transfer/,const TQListBoxItem *);
	void insertItem(const TQString &,int = -1);
	void insertItem(const TQPixmap &,int = -1);
	void insertItem(const TQPixmap &,const TQString &,int = -1);

	void removeItem(int);

	TQString text(int) const;
	const TQPixmap *pixmap(int) const;

	void changeItem(const TQListBoxItem * /Transfer/,int);
	void changeItem(const TQString &,int);
	void changeItem(const TQPixmap &,int);
	void changeItem(const TQPixmap &,const TQString &,int);

	void takeItem(const TQListBoxItem * /TransferBack/);

	int numItemsVisible() const;

	int currentItem() const;
	TQString currentText() const;
	virtual void setCurrentItem(int);
	virtual void setCurrentItem(TQListBoxItem *);
	void centerCurrentItem();
	int topItem() const;
	virtual void setTopItem(int);
	virtual void setBottomItem(int);

	long maxItemWidth() const;

	enum SelectionMode {
		Single,
		Multi,
		Extended,
		NoSelection
	};

	virtual void setSelectionMode(SelectionMode);
	SelectionMode selectionMode() const;

	void setMultiSelection(bool);
	bool isMultiSelection() const;

	virtual void setSelected(TQListBoxItem *,bool);
	void setSelected(int,bool);
	bool isSelected(int) const;
	bool isSelected(TQListBoxItem *) const;
	TQListBoxItem *selectedItem() const;

	TQSize sizeHint() const;
	TQSize minimumSizeHint() const;

	TQListBoxItem *item(int) const;
	int index(const TQListBoxItem *) const;
	TQListBoxItem *findItem(const TQString &,
			       ComparisonFlags = BeginsWith) const;

	void triggerUpdate(bool);

	bool itemVisible(int);
	bool itemVisible(const TQListBoxItem *);

	enum LayoutMode {
		FixedNumber,
		FitToWidth,
		FitToHeight = FitToWidth,
		Variable
	};

	virtual void setColumnMode(LayoutMode /Constrained/);
	virtual void setColumnMode(int);
	virtual void setRowMode(LayoutMode /Constrained/);
	virtual void setRowMode(int);

	LayoutMode columnMode() const;
	LayoutMode rowMode() const;

	int numColumns() const;
	int numRows() const;

	bool variableWidth() const;
	virtual void setVariableWidth(bool);

	bool variableHeight() const;
	virtual void setVariableHeight(bool);

	void viewportPaintEvent(TQPaintEvent *);

	int itemHeight(int = 0) const;
	TQListBoxItem *itemAt(TQPoint) const;

	TQRect itemRect(TQListBoxItem *) const;

	TQListBoxItem *firstItem() const;

	void sort(bool = 1);

public slots:
	void clear();
	virtual void ensureCurrentVisible();
	virtual void clearSelection();
	virtual void selectAll(bool);
	virtual void invertSelection();

signals:
	void highlighted(int);
	void selected(int);
	void highlighted(const TQString &);
	void selected(const TQString &);
	void highlighted(TQListBoxItem *);
	void selected(TQListBoxItem *);

	void selectionChanged();
	void selectionChanged(TQListBoxItem *);
	void currentChanged(TQListBoxItem *);
	void clicked(TQListBoxItem *);
	void clicked(TQListBoxItem *,const TQPoint &);
	void pressed(TQListBoxItem *);
	void pressed(TQListBoxItem *,const TQPoint &);

	void doubleClicked(TQListBoxItem *);
	void returnPressed(TQListBoxItem *);
	void rightButtonClicked(TQListBoxItem *,const TQPoint &);
	void rightButtonPressed(TQListBoxItem *,const TQPoint &);
	void mouseButtonPressed(int,TQListBoxItem *,const TQPoint &);
	void mouseButtonClicked(int,TQListBoxItem *,const TQPoint &);

	void contextMenuRequested(TQListBoxItem *,const TQPoint &);

	void onItem(TQListBoxItem *);
	void onViewport();

protected:
	void mousePressEvent(TQMouseEvent *);
	void mouseReleaseEvent(TQMouseEvent *);
	void mouseDoubleClickEvent(TQMouseEvent *);
	void mouseMoveEvent(TQMouseEvent *);

	void keyPressEvent(TQKeyEvent *);
	void focusInEvent(TQFocusEvent *);
	void focusOutEvent(TQFocusEvent *);
	void resizeEvent(TQResizeEvent *);
	void showEvent(TQShowEvent *);

	bool eventFilter(TQObject *,TQEvent *);

	void updateItem(int);
	void updateItem(TQListBoxItem *);

	virtual void paintCell(TQPainter *,int,int);

	void toggleCurrentItem();
	bool isRubberSelecting() const;

	void doLayout() const;

	void windowActivationChange(bool);

protected slots:
	void clearInputString();

private:
	TQListBox(const TQListBox &);
};


class TQListBoxItem
{
%TypeHeaderCode
#include <tqlistbox.h>
%End

public:
	TQListBoxItem(TQListBox * /TransferThis/ = 0);
	TQListBoxItem(TQListBox * /TransferThis/,TQListBoxItem *);

	virtual TQString text() const;
	virtual const TQPixmap *pixmap() const;

	virtual int height(const TQListBox *) const;
	virtual int width(const TQListBox *) const;

	bool isSelected() const;
	bool isCurrent() const;

	TQListBox *listBox() const;

	void setSelectable(bool);
	bool isSelectable() const;

	TQListBoxItem *next() const;
	TQListBoxItem *prev() const;

	virtual int rtti() const;

protected:
	virtual void paint(TQPainter *) = 0;
	virtual void setText(const TQString &);
	void setCustomHighlighting(bool);

private:
	TQListBoxItem(const TQListBoxItem &);
};

class TQListBoxText : TQListBoxItem
{
%TypeHeaderCode
#include <tqlistbox.h>
%End

public:
	TQListBoxText(TQListBox * /TransferThis/,
		     const TQString & = TQString::null);
	TQListBoxText(const TQString & = TQString::null);
	TQListBoxText(TQListBox * /TransferThis/,const TQString &,TQListBoxItem *);

	int height(const TQListBox *) const;
	int width(const TQListBox *) const;

	int rtti() const;

protected:
	void paint(TQPainter *);

private:
	TQListBoxText(const TQListBoxText &);
};

class TQListBoxPixmap : TQListBoxItem
{
%TypeHeaderCode
#include <tqlistbox.h>
%End

public:
	TQListBoxPixmap(TQListBox * /TransferThis/,const TQPixmap &);
	TQListBoxPixmap(const TQPixmap &);
	TQListBoxPixmap(TQListBox * /TransferThis/,const TQPixmap &,
		       TQListBoxItem *);
	TQListBoxPixmap(TQListBox * /TransferThis/,const TQPixmap &,
		       const TQString &);
	TQListBoxPixmap(const TQPixmap &,const TQString &);
	TQListBoxPixmap(TQListBox * /TransferThis/,const TQPixmap &,
		       const TQString &,TQListBoxItem *);

	const TQPixmap *pixmap() const;
	int height(const TQListBox *) const;
	int width(const TQListBox *) const;

	int rtti() const;

protected:
	void paint(TQPainter *);

private:
	TQListBoxPixmap(const TQListBoxPixmap &);
};