0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the Qt3Support module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#ifndef Q3LISTVIEW_H
|
|
43 |
#define Q3LISTVIEW_H
|
|
44 |
|
|
45 |
#include <Qt3Support/q3scrollview.h>
|
|
46 |
|
|
47 |
QT_BEGIN_HEADER
|
|
48 |
|
|
49 |
QT_BEGIN_NAMESPACE
|
|
50 |
|
|
51 |
QT_MODULE(Qt3SupportLight)
|
|
52 |
|
|
53 |
#ifndef QT_NO_LISTVIEW
|
|
54 |
|
|
55 |
class QPixmap;
|
|
56 |
class QFont;
|
|
57 |
class Q3Header;
|
|
58 |
class QIcon;
|
|
59 |
|
|
60 |
class Q3ListView;
|
|
61 |
struct Q3ListViewPrivate;
|
|
62 |
struct Q3CheckListItemPrivate;
|
|
63 |
class Q3ListViewItemIterator;
|
|
64 |
struct Q3ListViewItemIteratorPrivate;
|
|
65 |
class Q3DragObject;
|
|
66 |
class QMimeSource;
|
|
67 |
class QLineEdit;
|
|
68 |
class Q3ListViewToolTip;
|
|
69 |
|
|
70 |
class Q_COMPAT_EXPORT Q3ListViewItem
|
|
71 |
{
|
|
72 |
friend class Q3ListViewItemIterator;
|
|
73 |
friend class Q3ListViewToolTip;
|
|
74 |
|
|
75 |
public:
|
|
76 |
Q3ListViewItem(Q3ListView * parent);
|
|
77 |
Q3ListViewItem(Q3ListViewItem * parent);
|
|
78 |
Q3ListViewItem(Q3ListView * parent, Q3ListViewItem * after);
|
|
79 |
Q3ListViewItem(Q3ListViewItem * parent, Q3ListViewItem * after);
|
|
80 |
|
|
81 |
Q3ListViewItem(Q3ListView * parent,
|
|
82 |
const QString&, const QString& = QString(),
|
|
83 |
const QString& = QString(), const QString& = QString(),
|
|
84 |
const QString& = QString(), const QString& = QString(),
|
|
85 |
const QString& = QString(), const QString& = QString());
|
|
86 |
Q3ListViewItem(Q3ListViewItem * parent,
|
|
87 |
const QString&, const QString& = QString(),
|
|
88 |
const QString& = QString(), const QString& = QString(),
|
|
89 |
const QString& = QString(), const QString& = QString(),
|
|
90 |
const QString& = QString(), const QString& = QString());
|
|
91 |
|
|
92 |
Q3ListViewItem(Q3ListView * parent, Q3ListViewItem * after,
|
|
93 |
const QString&, const QString& = QString(),
|
|
94 |
const QString& = QString(), const QString& = QString(),
|
|
95 |
const QString& = QString(), const QString& = QString(),
|
|
96 |
const QString& = QString(), const QString& = QString());
|
|
97 |
Q3ListViewItem(Q3ListViewItem * parent, Q3ListViewItem * after,
|
|
98 |
const QString&, const QString& = QString(),
|
|
99 |
const QString& = QString(), const QString& = QString(),
|
|
100 |
const QString& = QString(), const QString& = QString(),
|
|
101 |
const QString& = QString(), const QString& = QString());
|
|
102 |
virtual ~Q3ListViewItem();
|
|
103 |
|
|
104 |
virtual void insertItem(Q3ListViewItem *);
|
|
105 |
virtual void takeItem(Q3ListViewItem *);
|
|
106 |
virtual void removeItem(Q3ListViewItem *item) { takeItem(item); }
|
|
107 |
|
|
108 |
int height() const;
|
|
109 |
virtual void invalidateHeight();
|
|
110 |
int totalHeight() const;
|
|
111 |
virtual int width(const QFontMetrics&,
|
|
112 |
const Q3ListView*, int column) const;
|
|
113 |
void widthChanged(int column=-1) const;
|
|
114 |
int depth() const;
|
|
115 |
|
|
116 |
virtual void setText(int, const QString &);
|
|
117 |
virtual QString text(int) const;
|
|
118 |
|
|
119 |
virtual void setPixmap(int, const QPixmap &);
|
|
120 |
virtual const QPixmap * pixmap(int) const;
|
|
121 |
|
|
122 |
virtual QString key(int, bool) const;
|
|
123 |
virtual int compare(Q3ListViewItem *i, int col, bool) const;
|
|
124 |
virtual void sortChildItems(int, bool);
|
|
125 |
|
|
126 |
int childCount() const { return nChildren; }
|
|
127 |
|
|
128 |
bool isOpen() const { return open; }
|
|
129 |
virtual void setOpen(bool);
|
|
130 |
virtual void setup();
|
|
131 |
|
|
132 |
virtual void setSelected(bool);
|
|
133 |
bool isSelected() const { return selected; }
|
|
134 |
|
|
135 |
virtual void paintCell(QPainter *, const QColorGroup & cg,
|
|
136 |
int column, int width, int alignment);
|
|
137 |
virtual void paintBranches(QPainter * p, const QColorGroup & cg, int w, int y, int h);
|
|
138 |
virtual void paintFocus(QPainter *, const QColorGroup & cg, const QRect & r);
|
|
139 |
|
|
140 |
Q3ListViewItem * firstChild() const;
|
|
141 |
Q3ListViewItem * nextSibling() const { return siblingItem; }
|
|
142 |
Q3ListViewItem * parent() const;
|
|
143 |
|
|
144 |
Q3ListViewItem * itemAbove() const;
|
|
145 |
Q3ListViewItem * itemBelow() const;
|
|
146 |
|
|
147 |
int itemPos() const;
|
|
148 |
|
|
149 |
Q3ListView *listView() const;
|
|
150 |
|
|
151 |
virtual void setSelectable(bool enable);
|
|
152 |
bool isSelectable() const { return selectable && enabled; }
|
|
153 |
|
|
154 |
virtual void setExpandable(bool);
|
|
155 |
bool isExpandable() const { return expandable; }
|
|
156 |
|
|
157 |
void repaint() const;
|
|
158 |
|
|
159 |
virtual void sort();
|
|
160 |
void moveItem(Q3ListViewItem *after);
|
|
161 |
|
|
162 |
virtual void setDragEnabled(bool allow);
|
|
163 |
virtual void setDropEnabled(bool allow);
|
|
164 |
bool dragEnabled() const;
|
|
165 |
bool dropEnabled() const;
|
|
166 |
virtual bool acceptDrop(const QMimeSource *mime) const;
|
|
167 |
|
|
168 |
void setVisible(bool b);
|
|
169 |
bool isVisible() const;
|
|
170 |
|
|
171 |
virtual void setRenameEnabled(int col, bool b);
|
|
172 |
bool renameEnabled(int col) const;
|
|
173 |
virtual void startRename(int col);
|
|
174 |
|
|
175 |
virtual void setEnabled(bool b);
|
|
176 |
bool isEnabled() const;
|
|
177 |
|
|
178 |
virtual int rtti() const;
|
|
179 |
enum { RTTI = 0 };
|
|
180 |
|
|
181 |
virtual void setMultiLinesEnabled(bool b);
|
|
182 |
bool multiLinesEnabled() const;
|
|
183 |
|
|
184 |
protected:
|
|
185 |
virtual void enforceSortOrder() const;
|
|
186 |
virtual void setHeight(int);
|
|
187 |
virtual void activate();
|
|
188 |
|
|
189 |
bool activatedPos(QPoint &);
|
|
190 |
#ifndef QT_NO_DRAGANDDROP
|
|
191 |
virtual void dropped(QDropEvent *e);
|
|
192 |
#endif
|
|
193 |
virtual void dragEntered();
|
|
194 |
virtual void dragLeft();
|
|
195 |
virtual void okRename(int col);
|
|
196 |
virtual void cancelRename(int col);
|
|
197 |
|
|
198 |
void ignoreDoubleClick();
|
|
199 |
|
|
200 |
private:
|
|
201 |
void init();
|
|
202 |
void moveToJustAfter(Q3ListViewItem *);
|
|
203 |
void enforceSortOrderBackToRoot();
|
|
204 |
void removeRenameBox();
|
|
205 |
|
|
206 |
int ownHeight;
|
|
207 |
int maybeTotalHeight;
|
|
208 |
int nChildren;
|
|
209 |
|
|
210 |
uint lsc: 14;
|
|
211 |
uint lso: 1;
|
|
212 |
uint open : 1;
|
|
213 |
uint selected : 1;
|
|
214 |
uint selectable: 1;
|
|
215 |
uint configured: 1;
|
|
216 |
uint expandable: 1;
|
|
217 |
uint is_root: 1;
|
|
218 |
uint allow_drag : 1;
|
|
219 |
uint allow_drop : 1;
|
|
220 |
uint visible : 1;
|
|
221 |
uint enabled : 1;
|
|
222 |
uint mlenabled : 1;
|
|
223 |
|
|
224 |
Q3ListViewItem * parentItem;
|
|
225 |
Q3ListViewItem * siblingItem;
|
|
226 |
Q3ListViewItem * childItem;
|
|
227 |
QLineEdit *renameBox;
|
|
228 |
int renameCol;
|
|
229 |
|
|
230 |
void * columns;
|
|
231 |
|
|
232 |
friend class Q3ListView;
|
|
233 |
};
|
|
234 |
|
|
235 |
class Q3CheckListItem;
|
|
236 |
|
|
237 |
class Q_COMPAT_EXPORT Q3ListView : public Q3ScrollView
|
|
238 |
{
|
|
239 |
friend class Q3ListViewItemIterator;
|
|
240 |
friend class Q3ListViewItem;
|
|
241 |
friend class Q3CheckListItem;
|
|
242 |
friend class Q3ListViewToolTip;
|
|
243 |
|
|
244 |
Q_OBJECT
|
|
245 |
Q_ENUMS(SelectionMode ResizeMode RenameAction)
|
|
246 |
Q_PROPERTY(int columns READ columns)
|
|
247 |
Q_PROPERTY(bool multiSelection READ isMultiSelection WRITE setMultiSelection DESIGNABLE false)
|
|
248 |
Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
|
|
249 |
Q_PROPERTY(int childCount READ childCount)
|
|
250 |
Q_PROPERTY(bool allColumnsShowFocus READ allColumnsShowFocus WRITE setAllColumnsShowFocus)
|
|
251 |
Q_PROPERTY(bool showSortIndicator READ showSortIndicator WRITE setShowSortIndicator)
|
|
252 |
Q_PROPERTY(int itemMargin READ itemMargin WRITE setItemMargin)
|
|
253 |
Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated)
|
|
254 |
Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips)
|
|
255 |
Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
|
|
256 |
Q_PROPERTY(int treeStepSize READ treeStepSize WRITE setTreeStepSize)
|
|
257 |
Q_PROPERTY(RenameAction defaultRenameAction READ defaultRenameAction WRITE setDefaultRenameAction)
|
|
258 |
|
|
259 |
public:
|
|
260 |
Q3ListView(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = 0);
|
|
261 |
~Q3ListView();
|
|
262 |
|
|
263 |
int treeStepSize() const;
|
|
264 |
virtual void setTreeStepSize(int);
|
|
265 |
|
|
266 |
virtual void insertItem(Q3ListViewItem *);
|
|
267 |
virtual void takeItem(Q3ListViewItem *);
|
|
268 |
virtual void removeItem(Q3ListViewItem *item) { takeItem(item); }
|
|
269 |
|
|
270 |
Q3Header * header() const;
|
|
271 |
|
|
272 |
virtual int addColumn(const QString &label, int size = -1);
|
|
273 |
virtual int addColumn(const QIcon& icon, const QString &label, int size = -1);
|
|
274 |
virtual void removeColumn(int index);
|
|
275 |
virtual void setColumnText(int column, const QString &label);
|
|
276 |
virtual void setColumnText(int column, const QIcon& icon, const QString &label);
|
|
277 |
QString columnText(int column) const;
|
|
278 |
virtual void setColumnWidth(int column, int width);
|
|
279 |
int columnWidth(int column) const;
|
|
280 |
enum WidthMode { Manual, Maximum };
|
|
281 |
virtual void setColumnWidthMode(int column, WidthMode);
|
|
282 |
WidthMode columnWidthMode(int column) const;
|
|
283 |
int columns() const;
|
|
284 |
|
|
285 |
virtual void setColumnAlignment(int, int);
|
|
286 |
int columnAlignment(int) const;
|
|
287 |
|
|
288 |
void show();
|
|
289 |
|
|
290 |
QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
|
|
291 |
Q3ListViewItem * itemAt(const QPoint & screenPos) const;
|
|
292 |
QRect itemRect(const Q3ListViewItem *) const;
|
|
293 |
int itemPos(const Q3ListViewItem *);
|
|
294 |
|
|
295 |
void ensureItemVisible(const Q3ListViewItem *);
|
|
296 |
|
|
297 |
void repaintItem(const Q3ListViewItem *) const;
|
|
298 |
|
|
299 |
virtual void setMultiSelection(bool enable);
|
|
300 |
bool isMultiSelection() const;
|
|
301 |
|
|
302 |
enum SelectionMode { Single, Multi, Extended, NoSelection };
|
|
303 |
void setSelectionMode(SelectionMode mode);
|
|
304 |
SelectionMode selectionMode() const;
|
|
305 |
|
|
306 |
virtual void clearSelection();
|
|
307 |
virtual void setSelected(Q3ListViewItem *, bool);
|
|
308 |
void setSelectionAnchor(Q3ListViewItem *);
|
|
309 |
bool isSelected(const Q3ListViewItem *) const;
|
|
310 |
Q3ListViewItem * selectedItem() const;
|
|
311 |
virtual void setOpen(Q3ListViewItem *, bool);
|
|
312 |
bool isOpen(const Q3ListViewItem *) const;
|
|
313 |
|
|
314 |
virtual void setCurrentItem(Q3ListViewItem *);
|
|
315 |
Q3ListViewItem * currentItem() const;
|
|
316 |
|
|
317 |
Q3ListViewItem * firstChild() const;
|
|
318 |
Q3ListViewItem * lastItem() const;
|
|
319 |
|
|
320 |
int childCount() const;
|
|
321 |
|
|
322 |
virtual void setAllColumnsShowFocus(bool);
|
|
323 |
bool allColumnsShowFocus() const;
|
|
324 |
|
|
325 |
virtual void setItemMargin(int);
|
|
326 |
int itemMargin() const;
|
|
327 |
|
|
328 |
virtual void setRootIsDecorated(bool);
|
|
329 |
bool rootIsDecorated() const;
|
|
330 |
|
|
331 |
virtual void setSorting(int column, bool ascending = true);
|
|
332 |
int sortColumn() const;
|
|
333 |
void setSortColumn(int column);
|
|
334 |
Qt::SortOrder sortOrder() const;
|
|
335 |
void setSortOrder(Qt::SortOrder order);
|
|
336 |
virtual void sort();
|
|
337 |
|
|
338 |
bool eventFilter(QObject * o, QEvent *);
|
|
339 |
|
|
340 |
QSize sizeHint() const;
|
|
341 |
QSize minimumSizeHint() const;
|
|
342 |
|
|
343 |
virtual void setShowSortIndicator(bool show);
|
|
344 |
bool showSortIndicator() const;
|
|
345 |
virtual void setShowToolTips(bool b);
|
|
346 |
bool showToolTips() const;
|
|
347 |
|
|
348 |
enum ResizeMode { NoColumn, AllColumns, LastColumn };
|
|
349 |
virtual void setResizeMode(ResizeMode m);
|
|
350 |
ResizeMode resizeMode() const;
|
|
351 |
|
|
352 |
enum StringComparisonMode {
|
|
353 |
CaseSensitive = 0x00001, // 0 0001
|
|
354 |
BeginsWith = 0x00002, // 0 0010
|
|
355 |
EndsWith = 0x00004, // 0 0100
|
|
356 |
Contains = 0x00008, // 0 1000
|
|
357 |
ExactMatch = 0x00010 // 1 0000
|
|
358 |
};
|
|
359 |
typedef uint ComparisonFlags;
|
|
360 |
Q3ListViewItem * findItem(const QString& text, int column,
|
|
361 |
ComparisonFlags = ExactMatch | Qt::CaseSensitive ) const;
|
|
362 |
|
|
363 |
enum RenameAction { Accept, Reject };
|
|
364 |
virtual void setDefaultRenameAction(RenameAction a);
|
|
365 |
RenameAction defaultRenameAction() const;
|
|
366 |
bool isRenaming() const;
|
|
367 |
|
|
368 |
void hideColumn(int column);
|
|
369 |
|
|
370 |
public Q_SLOTS:
|
|
371 |
virtual void clear();
|
|
372 |
virtual void invertSelection();
|
|
373 |
virtual void selectAll(bool select);
|
|
374 |
void triggerUpdate();
|
|
375 |
void setContentsPos(int x, int y);
|
|
376 |
void adjustColumn(int col);
|
|
377 |
|
|
378 |
Q_SIGNALS:
|
|
379 |
void selectionChanged();
|
|
380 |
void selectionChanged(Q3ListViewItem *);
|
|
381 |
void currentChanged(Q3ListViewItem *);
|
|
382 |
void clicked(Q3ListViewItem *);
|
|
383 |
void clicked(Q3ListViewItem *, const QPoint &, int);
|
|
384 |
void pressed(Q3ListViewItem *);
|
|
385 |
void pressed(Q3ListViewItem *, const QPoint &, int);
|
|
386 |
|
|
387 |
void doubleClicked(Q3ListViewItem *);
|
|
388 |
void doubleClicked(Q3ListViewItem *, const QPoint&, int);
|
|
389 |
void returnPressed(Q3ListViewItem *);
|
|
390 |
void spacePressed(Q3ListViewItem *);
|
|
391 |
void rightButtonClicked(Q3ListViewItem *, const QPoint&, int);
|
|
392 |
void rightButtonPressed(Q3ListViewItem *, const QPoint&, int);
|
|
393 |
void mouseButtonPressed(int, Q3ListViewItem *, const QPoint& , int);
|
|
394 |
void mouseButtonClicked(int, Q3ListViewItem *, const QPoint&, int);
|
|
395 |
|
|
396 |
void contextMenuRequested(Q3ListViewItem *, const QPoint &, int);
|
|
397 |
|
|
398 |
void onItem(Q3ListViewItem *item);
|
|
399 |
void onViewport();
|
|
400 |
|
|
401 |
void expanded(Q3ListViewItem *item);
|
|
402 |
void collapsed(Q3ListViewItem *item);
|
|
403 |
#ifndef QT_NO_DRAGANDDROP
|
|
404 |
void dropped(QDropEvent *e);
|
|
405 |
#endif
|
|
406 |
void itemRenamed(Q3ListViewItem *item, int col, const QString &);
|
|
407 |
void itemRenamed(Q3ListViewItem *item, int col );
|
|
408 |
|
|
409 |
protected:
|
|
410 |
void contentsMousePressEvent(QMouseEvent * e);
|
|
411 |
void contentsMouseReleaseEvent(QMouseEvent * e);
|
|
412 |
void contentsMouseMoveEvent(QMouseEvent * e);
|
|
413 |
void contentsMouseDoubleClickEvent(QMouseEvent * e);
|
|
414 |
void contentsContextMenuEvent(QContextMenuEvent * e);
|
|
415 |
#ifndef QT_NO_DRAGANDDROP
|
|
416 |
void contentsDragEnterEvent(QDragEnterEvent *e);
|
|
417 |
void contentsDragMoveEvent(QDragMoveEvent *e);
|
|
418 |
void contentsDragLeaveEvent(QDragLeaveEvent *e);
|
|
419 |
void contentsDropEvent(QDropEvent *e);
|
|
420 |
virtual Q3DragObject *dragObject();
|
|
421 |
virtual void startDrag();
|
|
422 |
#endif
|
|
423 |
|
|
424 |
void focusInEvent(QFocusEvent * e);
|
|
425 |
void focusOutEvent(QFocusEvent * e);
|
|
426 |
|
|
427 |
void keyPressEvent(QKeyEvent *e);
|
|
428 |
|
|
429 |
void resizeEvent(QResizeEvent *e);
|
|
430 |
void viewportResizeEvent(QResizeEvent *e);
|
|
431 |
|
|
432 |
void showEvent(QShowEvent *);
|
|
433 |
|
|
434 |
void drawContentsOffset(QPainter *, int ox, int oy,
|
|
435 |
int cx, int cy, int cw, int ch);
|
|
436 |
|
|
437 |
virtual void paintEmptyArea(QPainter *, const QRect &);
|
|
438 |
void changeEvent(QEvent *);
|
|
439 |
|
|
440 |
protected Q_SLOTS:
|
|
441 |
void updateContents();
|
|
442 |
void doAutoScroll();
|
|
443 |
|
|
444 |
private Q_SLOTS:
|
|
445 |
void changeSortColumn(int);
|
|
446 |
void handleIndexChange();
|
|
447 |
void updateDirtyItems();
|
|
448 |
void makeVisible();
|
|
449 |
void handleSizeChange(int, int, int);
|
|
450 |
void startRename();
|
|
451 |
void openFocusItem();
|
|
452 |
|
|
453 |
private:
|
|
454 |
Q_DISABLE_COPY(Q3ListView)
|
|
455 |
|
|
456 |
void contentsMousePressEventEx(QMouseEvent * e);
|
|
457 |
void contentsMouseReleaseEventEx(QMouseEvent * e);
|
|
458 |
void init();
|
|
459 |
void updateGeometries();
|
|
460 |
void buildDrawableList() const;
|
|
461 |
void reconfigureItems();
|
|
462 |
void widthChanged(const Q3ListViewItem*, int c);
|
|
463 |
void handleItemChange(Q3ListViewItem *old, bool shift, bool control);
|
|
464 |
void selectRange(Q3ListViewItem *from, Q3ListViewItem *to, bool invert, bool includeFirst, bool clearSel = false);
|
|
465 |
bool selectRange(Q3ListViewItem *newItem, Q3ListViewItem *oldItem, Q3ListViewItem *anchorItem);
|
|
466 |
bool clearRange(Q3ListViewItem *from, Q3ListViewItem *to, bool includeFirst = true);
|
|
467 |
void doAutoScroll(const QPoint &cursorPos);
|
|
468 |
|
|
469 |
Q3ListViewPrivate *d;
|
|
470 |
};
|
|
471 |
|
|
472 |
|
|
473 |
class Q_COMPAT_EXPORT Q3CheckListItem : public Q3ListViewItem
|
|
474 |
{
|
|
475 |
public:
|
|
476 |
enum Type { RadioButton,
|
|
477 |
CheckBox,
|
|
478 |
Controller,
|
|
479 |
RadioButtonController=Controller,
|
|
480 |
CheckBoxController };
|
|
481 |
|
|
482 |
enum ToggleState { Off, NoChange, On };
|
|
483 |
|
|
484 |
Q3CheckListItem(Q3CheckListItem *parent, const QString &text,
|
|
485 |
Type = RadioButtonController);
|
|
486 |
Q3CheckListItem(Q3CheckListItem *parent, Q3ListViewItem *after,
|
|
487 |
const QString &text, Type = RadioButtonController);
|
|
488 |
Q3CheckListItem(Q3ListViewItem *parent, const QString &text,
|
|
489 |
Type = RadioButtonController);
|
|
490 |
Q3CheckListItem(Q3ListViewItem *parent, Q3ListViewItem *after,
|
|
491 |
const QString &text, Type = RadioButtonController);
|
|
492 |
Q3CheckListItem(Q3ListView *parent, const QString &text,
|
|
493 |
Type = RadioButtonController);
|
|
494 |
Q3CheckListItem(Q3ListView *parent, Q3ListViewItem *after,
|
|
495 |
const QString &text, Type = RadioButtonController);
|
|
496 |
Q3CheckListItem(Q3ListViewItem *parent, const QString &text,
|
|
497 |
const QPixmap &);
|
|
498 |
Q3CheckListItem(Q3ListView *parent, const QString &text,
|
|
499 |
const QPixmap &);
|
|
500 |
~Q3CheckListItem();
|
|
501 |
|
|
502 |
void paintCell(QPainter *, const QColorGroup & cg,
|
|
503 |
int column, int width, int alignment);
|
|
504 |
virtual void paintFocus(QPainter *, const QColorGroup &cg,
|
|
505 |
const QRect & r);
|
|
506 |
int width(const QFontMetrics&, const Q3ListView*, int column) const;
|
|
507 |
void setup();
|
|
508 |
|
|
509 |
virtual void setOn(bool);
|
|
510 |
bool isOn() const { return on; }
|
|
511 |
Type type() const { return myType; }
|
|
512 |
QString text() const { return Q3ListViewItem::text(0); }
|
|
513 |
QString text(int n) const { return Q3ListViewItem::text(n); }
|
|
514 |
|
|
515 |
void setTristate(bool);
|
|
516 |
bool isTristate() const;
|
|
517 |
ToggleState state() const;
|
|
518 |
void setState(ToggleState s);
|
|
519 |
|
|
520 |
int rtti() const;
|
|
521 |
enum { RTTI = 1 };
|
|
522 |
|
|
523 |
protected:
|
|
524 |
void activate();
|
|
525 |
void turnOffChild();
|
|
526 |
virtual void stateChange(bool);
|
|
527 |
|
|
528 |
private:
|
|
529 |
void init();
|
|
530 |
ToggleState internalState() const;
|
|
531 |
void setStoredState(ToggleState newState, Q3CheckListItem *key);
|
|
532 |
ToggleState storedState(Q3CheckListItem *key) const;
|
|
533 |
void stateChange(ToggleState s);
|
|
534 |
void restoreState(Q3CheckListItem *key, int depth = 0);
|
|
535 |
void updateController(bool update = true , bool store = false);
|
|
536 |
void updateStoredState(Q3CheckListItem *key);
|
|
537 |
void setState(ToggleState s, bool update, bool store);
|
|
538 |
void setCurrentState(ToggleState s);
|
|
539 |
|
|
540 |
Type myType;
|
|
541 |
bool on;
|
|
542 |
Q3CheckListItemPrivate *d;
|
|
543 |
};
|
|
544 |
|
|
545 |
class Q_COMPAT_EXPORT Q3ListViewItemIterator
|
|
546 |
{
|
|
547 |
friend struct Q3ListViewPrivate;
|
|
548 |
friend class Q3ListView;
|
|
549 |
friend class Q3ListViewItem;
|
|
550 |
|
|
551 |
public:
|
|
552 |
enum IteratorFlag {
|
|
553 |
Visible = 0x00000001,
|
|
554 |
Invisible = 0x00000002,
|
|
555 |
Selected = 0x00000004,
|
|
556 |
Unselected = 0x00000008,
|
|
557 |
Selectable = 0x00000010,
|
|
558 |
NotSelectable = 0x00000020,
|
|
559 |
DragEnabled = 0x00000040,
|
|
560 |
DragDisabled = 0x00000080,
|
|
561 |
DropEnabled = 0x00000100,
|
|
562 |
DropDisabled = 0x00000200,
|
|
563 |
Expandable = 0x00000400,
|
|
564 |
NotExpandable = 0x00000800,
|
|
565 |
Checked = 0x00001000,
|
|
566 |
NotChecked = 0x00002000
|
|
567 |
};
|
|
568 |
|
|
569 |
Q3ListViewItemIterator();
|
|
570 |
Q3ListViewItemIterator(Q3ListViewItem *item);
|
|
571 |
Q3ListViewItemIterator(Q3ListViewItem *item, int iteratorFlags);
|
|
572 |
|
|
573 |
Q3ListViewItemIterator(const Q3ListViewItemIterator &it);
|
|
574 |
Q3ListViewItemIterator(Q3ListView *lv);
|
|
575 |
Q3ListViewItemIterator(Q3ListView *lv, int iteratorFlags);
|
|
576 |
|
|
577 |
Q3ListViewItemIterator &operator=(const Q3ListViewItemIterator &it);
|
|
578 |
|
|
579 |
~Q3ListViewItemIterator();
|
|
580 |
|
|
581 |
Q3ListViewItemIterator &operator++();
|
|
582 |
const Q3ListViewItemIterator operator++(int);
|
|
583 |
Q3ListViewItemIterator &operator+=(int j);
|
|
584 |
|
|
585 |
Q3ListViewItemIterator &operator--();
|
|
586 |
const Q3ListViewItemIterator operator--(int);
|
|
587 |
Q3ListViewItemIterator &operator-=(int j);
|
|
588 |
|
|
589 |
Q3ListViewItem* operator*();
|
|
590 |
Q3ListViewItem *current() const;
|
|
591 |
|
|
592 |
private:
|
|
593 |
Q3ListViewItem *curr;
|
|
594 |
Q3ListView *listView;
|
|
595 |
int flags;
|
|
596 |
|
|
597 |
void currentRemoved();
|
|
598 |
bool matchesFlags(const Q3ListViewItem*) const;
|
|
599 |
bool testPair(Q3ListViewItemIterator::IteratorFlag, Q3ListViewItemIterator::IteratorFlag, bool) const;
|
|
600 |
bool isChecked(const Q3ListViewItem*) const;
|
|
601 |
};
|
|
602 |
|
|
603 |
#endif // QT_NO_LISTVIEW
|
|
604 |
|
|
605 |
QT_END_NAMESPACE
|
|
606 |
|
|
607 |
QT_END_HEADER
|
|
608 |
|
|
609 |
#endif // Q3LISTVIEW_H
|