// This is the SIP interface definition for QListView, QListViewItem,
// QCheckListItem and QListViewItemIterator.
//
// Copyright (c) 2007
// 	Riverbank Computing Limited <info@riverbankcomputing.co.uk>
// 
// This file is part of PyQt.
// 
// This copy of PyQt 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.
// 
// PyQt 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
// PyQt; 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>QListView</Title>
<Para>
<Literal>QListView</Literal> is fully implemented.
</Para>
<Para>
Note that to remove a child <Literal>QListViewItem</Literal> you must first
call <Literal>takeItem()</Literal> and then <Literal>del()</Literal>.
</Para>
</Sect2>

<Sect2><Title>QListViewItem</Title>
<Para>
<Literal>QListViewItem</Literal> is fully implemented.
</Para>
<Para>
Note that to remove a child <Literal>QListViewItem</Literal> you must first
call <Literal>takeItem()</Literal> and then <Literal>del()</Literal>.
</Para>
</Sect2>

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

<Sect2><Title>QListViewItemIterator (Qt v2+)</Title>
<Para>
<Literal>QListViewItemIterator</Literal> is fully implemented.
</Para>
</Sect2>
%End


%If (- Qt_2_00)

class QListViewItem
{
%TypeHeaderCode
#include <qlistview.h>
%End

public:
	QListViewItem(QListView * /TransferThis/);
	QListViewItem(QListViewItem * /TransferThis/);
	QListViewItem(QListView * /TransferThis/,QListViewItem *);
	QListViewItem(QListViewItem * /TransferThis/,QListViewItem *);

	QListViewItem(QListView * /TransferThis/,
		const char *,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0);

	QListViewItem(QListViewItem * /TransferThis/,
		const char *,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0);

	QListViewItem(QListView * /TransferThis/,QListViewItem *,
		const char *,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0);

	QListViewItem(QListViewItem * /TransferThis/,QListViewItem *,
		const char *,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0,
		const char * = 0,const char * = 0);

	virtual void insertItem(QListViewItem * /Transfer/);
	virtual void removeItem(QListViewItem * /TransferBack/);
	int height() const;
	virtual void invalidateHeight();
	int totalHeight() const;
	virtual int width(const QFontMetrics &,const QListView *,int) const;
	void widthChanged(int = -1) const;
	int depth() const;
	virtual void setText(int,const char *);
	virtual const char *text(int) const;
	virtual void setPixmap(int,const QPixmap &);
	virtual const QPixmap *pixmap(int) const;
	virtual const char *key(int,bool) const;
	virtual void sortChildItems(int,bool);
	int childCount() const;
	bool isOpen() const;
	virtual void setOpen(bool);
	virtual void setup();
	virtual void setSelected(bool);
	bool isSelected() const;
	virtual void paintCell(QPainter *,const QColorGroup &,int,int,int);
	virtual void paintBranches(QPainter *,const QColorGroup &,int,int,int,
				   GUIStyle);
	virtual void paintFocus(QPainter *,const QColorGroup &,const QRect &);
	QListViewItem *firstChild() const;
	QListViewItem *nextSibling() const;
	QListViewItem *parent() const;
	QListViewItem *itemAbove();
	QListViewItem *itemBelow();
	int itemPos() const;
	QListView *listView() const;
	virtual void setSelectable(bool);
	bool isSelectable() const;
	virtual void setExpandable(bool);
	bool isExpandable();
	void repaint() const;

protected:
	virtual void enforceSortOrder() const;
	virtual void setHeight(int);
	virtual void activate();
};

%End

%If (Qt_2_00 -)

class QListViewItem : Qt
{
%TypeHeaderCode
#include <qlistview.h>
%End

public:
	QListViewItem(QListView * /TransferThis/);
	QListViewItem(QListViewItem * /TransferThis/);
	QListViewItem(QListView * /TransferThis/,QListViewItem *);
	QListViewItem(QListViewItem * /TransferThis/,QListViewItem *);

	QListViewItem(QListView * /TransferThis/,
		QString,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null);

	QListViewItem(QListViewItem * /TransferThis/,
		QString,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null);

	QListViewItem(QListView * /TransferThis/,QListViewItem *,
		QString,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null);

	QListViewItem(QListViewItem * /TransferThis/,QListViewItem *,
		QString,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null,
		QString = QString::null,QString = QString::null);

	virtual void insertItem(QListViewItem * /Transfer/);
	virtual void takeItem(QListViewItem * /TransferBack/);

	int height() const;
	virtual void invalidateHeight();
	int totalHeight() const;
	virtual int width(const QFontMetrics &,const QListView *,int) const;
	void widthChanged(int = -1) const;
	int depth() const;

	virtual void setText(int,const QString &);
	virtual QString text(int) const;

	virtual void setPixmap(int,const QPixmap &);
	virtual const QPixmap *pixmap(int) const;

	virtual QString key(int,bool) const;
%If (Qt_3_0_0 -)
	virtual int compare(QListViewItem *,int,bool) const;
%End
	virtual void sortChildItems(int,bool);

	int childCount() const;

	bool isOpen() const;
	virtual void setOpen(bool);
	virtual void setup();

	virtual void setSelected(bool);
	bool isSelected() const;

	virtual void paintCell(QPainter *,const QColorGroup &,int,int,int);
%If (- Qt_3_0_0)
	virtual void paintBranches(QPainter *,const QColorGroup &,int,int,int,
				   GUIStyle);
%End
%If (Qt_3_0_0 -)
	virtual void paintBranches(QPainter *,const QColorGroup &,int,int,int);
%End
	virtual void paintFocus(QPainter *,const QColorGroup &,const QRect &);

	QListViewItem *firstChild() const;
	QListViewItem *nextSibling() const;
	QListViewItem *parent() const;

	QListViewItem *itemAbove();
	QListViewItem *itemBelow();

	int itemPos() const;

	QListView *listView() const;

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

	virtual void setExpandable(bool);
	bool isExpandable();

	void repaint() const;

%If (Qt_2_1_0 - Qt_3_0_0)
	void sort();
%End
%If (Qt_3_0_0 -)
	virtual void sort();
%End
%If (Qt_2_2_0 -)
	void moveItem(QListViewItem *);
%End

%If (Qt_3_0_0 -)
	virtual void setDragEnabled(bool);
	virtual void setDropEnabled(bool);
	bool dragEnabled() const;
	bool dropEnabled() const;
	virtual bool acceptDrop(const QMimeSource *) const;
 
	void setVisible(bool);
	bool isVisible() const;
 
	virtual void setRenameEnabled(int,bool);
	bool renameEnabled(int) const;
	virtual void startRename(int);
 
	virtual void setEnabled(bool);
	bool isEnabled() const;
 
	virtual int rtti() const;
 
	virtual void setMultiLinesEnabled(bool);
	bool multiLinesEnabled() const;
%End

protected:
	virtual void enforceSortOrder() const;
	virtual void setHeight(int);
	virtual void activate();

%If (Qt_2_1_0 -)
	bool activatedPos(QPoint &);
%End
%If (Qt_3_0_0 -)
	virtual void dropped(QDropEvent *);
	virtual void dragEntered();
	virtual void dragLeft();
	virtual void okRename(int);
	virtual void cancelRename(int);

	void ignoreDoubleClick();
%End
};

%End


class QListView : QScrollView
{
%TypeHeaderCode
#include <qlistview.h>
%End

public:
%If (Qt_2_2_0 - Qt_3_0_0)
	QListView(QWidget * /TransferThis/,const char *,WFlags);
%End
%If (- Qt_3_0_0)
	QListView(QWidget * /TransferThis/ = 0,const char * = 0);
%End
%If (Qt_3_0_0 -)
	QListView(QWidget * /TransferThis/ = 0,const char * = 0,WFlags = 0);
%End

	int treeStepSize() const;
	virtual void setTreeStepSize(int);

	virtual void insertItem(QListViewItem * /Transfer/);
%If (Qt_2_00 -)
	virtual void takeItem(QListViewItem * /TransferBack/);
%End

%If (- Qt_3_0_0)
	virtual void clear();
%End
	QHeader *header() const;

%If (- Qt_2_00)
	virtual int addColumn(const char *,int = -1);
	virtual void setColumnText(int,const char *);
	const char *columnText(int) const;
%End
%If (Qt_2_00 -)
	virtual int addColumn(const QString &,int = -1);
	virtual int addColumn(const QIconSet &,const QString &,int = -1);
%If (Qt_2_1_0 -)
	void removeColumn(int);
%End
	virtual void setColumnText(int,const QString &);
	virtual void setColumnText(int,const QIconSet &,const QString &);
	QString columnText(int) const;
%End
	virtual void setColumnWidth(int,int);
	int columnWidth(int) const;

	enum WidthMode
	{
		Manual,
		Maximum
	};

	virtual void setColumnWidthMode(int,WidthMode);
	WidthMode columnWidthMode(int) const;
%If (Qt_2_1_0 -)
	int columns() const;
%End

	virtual void setColumnAlignment(int,int);
	int columnAlignment(int) const;

	void show();

	QListViewItem *itemAt(const QPoint &) const;
	QRect itemRect(const QListViewItem *) const;
	int itemPos(const QListViewItem *);

	void ensureItemVisible(const QListViewItem *);

	void repaintItem(const QListViewItem *) const;

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

%If (Qt_2_1_0 -)
	enum SelectionMode {
		Single,
		Multi,
		Extended,
		NoSelection
	};

	void setSelectionMode(SelectionMode);
	SelectionMode selectionMode() const;
%End

%If (Qt_2_1_0 -)
	virtual void clearSelection();
%End
	virtual void setSelected(QListViewItem *,bool);
%If (Qt_3_2_0 -)
	void setSelectionAnchor(QListViewItem *);
%End
	bool isSelected(QListViewItem *) const;
%If (Qt_2_1_0 -)
	QListViewItem *selectedItem() const;
%End
	virtual void setOpen(QListViewItem *,bool);
	bool isOpen(QListViewItem *) const;

	virtual void setCurrentItem(QListViewItem *);
	QListViewItem *currentItem() const;

	QListViewItem *firstChild() const;
%If (Qt_3_0_0 -)
	QListViewItem *lastItem() const;
%End

	int childCount() const;

	virtual void setAllColumnsShowFocus(bool);
	bool allColumnsShowFocus() const;

	virtual void setItemMargin(int);
	int itemMargin() const;

	virtual void setRootIsDecorated(bool);
	bool rootIsDecorated() const;

	virtual void setSorting(int,bool = 1);
%If (Qt_3_1_0 -)
	int sortColumn() const;
%End
%If (Qt_3_2_0 -)
	void setSortColumn(int);
	SortOrder sortOrder() const;
	void setSortOrder(SortOrder);
%End
%If (Qt_3_0_0 -)
	virtual void sort();
%End
%If (Qt_2_1_0 - Qt_3_0_0)
	void sort();
%End

%If (- Qt_2_00)
	void setStyle(GUIStyle);
	void setFont(const QFont &);
	void setPalette(const QPalette &);
%End
%If (Qt_2_00 -)
	virtual void setFont(const QFont &);
	virtual void setPalette(const QPalette &);
%End

	bool eventFilter(QObject *,QEvent *);

	QSize sizeHint() const;
%If (Qt_2_00 -)
	QSize minimumSizeHint() const;
%End

%If (Qt_2_1_0 -)
	void setShowSortIndicator(bool);
	bool showSortIndicator() const;
%End
%If (Qt_3_0_0 -)
	virtual void setShowToolTips(bool);
	bool showToolTips() const;
 
	enum ResizeMode {
		NoColumn,
		AllColumns,
		LastColumn
	};

	virtual void setResizeMode(ResizeMode);
	ResizeMode resizeMode() const;
 
	QListViewItem *findItem(const QString &,int,
				ComparisonFlags = ExactMatch | CaseSensitive) const;
 
	enum RenameAction {
		Accept,
		Reject
	};

	virtual void setDefaultRenameAction(RenameAction);
	RenameAction defaultRenameAction() const;
	bool isRenaming() const;
%End

%If (Qt_3_2_0 -)
	void hideColumn(int);
%End

public slots:
%If (Qt_3_0_0 -)
	virtual void clear();
%End
%If (Qt_2_1_0 -)
	void invertSelection();
	void selectAll(bool);
	void setContentsPos(int,int);
%End
	void triggerUpdate();
%If (Qt_3_2_0 -)
	void adjustColumn(int);
%End

signals:
	void selectionChanged();
	void selectionChanged(QListViewItem *);
	void currentChanged(QListViewItem *);
%If (Qt_2_1_0 -)
	void clicked(QListViewItem *);
	void clicked(QListViewItem *,const QPoint &,int);
	void pressed(QListViewItem *);
	void pressed(QListViewItem *,const QPoint &,int);
%End

	void doubleClicked(QListViewItem *);
%If (Qt_3_2_0 -)
	void doubleClicked(QListViewItem *,const QPoint &,int);
%End
	void returnPressed(QListViewItem *);
%If (Qt_3_0_0 -)
	void spacePressed(QListViewItem *);
%End
	void rightButtonClicked(QListViewItem *,const QPoint &,int);
	void rightButtonPressed(QListViewItem *,const QPoint &,int);
%If (Qt_2_1_0 -)
	void mouseButtonPressed(int,QListViewItem *,const QPoint &,int);
	void mouseButtonClicked(int,QListViewItem *,const QPoint &,int);
%End

%If (Qt_3_0_0 -)
	void contextMenuRequested(QListViewItem *,const QPoint &,int);
%End

%If (Qt_2_1_0 -)
	void onItem(QListViewItem *);
	void onViewport();

	void expanded(QListViewItem *);
	void collapsed(QListViewItem *);
%End
%If (Qt_3_0_0 -)
	void dropped(QDropEvent *);
	void itemRenamed(QListViewItem *,int,const QString &);
	void itemRenamed(QListViewItem *,int);
%End

protected:
%If (- Qt_2_00)
	void mousePressEvent(QMouseEvent *);
	void mouseReleaseEvent(QMouseEvent *);
	void mouseMoveEvent(QMouseEvent *);
	void mouseDoubleClickEvent(QMouseEvent *);
%End
%If (Qt_2_00 -)
	void contentsMousePressEvent(QMouseEvent *);
	void contentsMouseReleaseEvent(QMouseEvent *);
	void contentsMouseMoveEvent(QMouseEvent *);
	void contentsMouseDoubleClickEvent(QMouseEvent *);
%End
%If (Qt_3_0_0 -)
	void contentsContextMenuEvent(QContextMenuEvent *);
	void contentsDragEnterEvent(QDragEnterEvent *);
	void contentsDragMoveEvent(QDragMoveEvent *);
	void contentsDragLeaveEvent(QDragLeaveEvent *);
	void contentsDropEvent(QDropEvent *);
	virtual QDragObject *dragObject();
	virtual void startDrag();
%End

	void focusInEvent(QFocusEvent *);
	void focusOutEvent(QFocusEvent *);

	void keyPressEvent(QKeyEvent *);

	void resizeEvent(QResizeEvent *);
%If (Qt_3_0_0 -)
	void viewportResizeEvent(QResizeEvent *);
%End

%If (Qt_2_00 -)
	void showEvent(QShowEvent *);
%End

	void drawContentsOffset(QPainter *,int,int,int,int,int,int);

	virtual void paintEmptyArea(QPainter *,const QRect &);
%If (Qt_2_00 -)
	void styleChange(QStyle &);
%End
%If (- Qt_3_0_0)
	void enabledChange(bool);
%End
%If (Qt_3_0_0 -)
	void windowActivationChange(bool);
%End

protected slots:
	void updateContents();
%If (Qt_2_00 -)
	void doAutoScroll();
%End

private:
%If (Qt_2_1_0 -)
	QListView(const QWidget &);
%End
};


class QCheckListItem : QListViewItem
{
%TypeHeaderCode
#include <qlistview.h>
%End

public:
	enum Type {
		RadioButton,
		CheckBox,
		Controller,
%If (Qt_3_2_0 -)
		RadioButtonController,
		CheckBoxController,
%End
	};

%If (Qt_3_2_0 -)
	enum ToggleState {
		Off,
		NoChange,
		On
	};
%End

%If (Qt_3_2_0 -)
	QCheckListItem(QCheckListItem * /TransferThis/,const QString &,
		       Type = RadioButtonController);
	QCheckListItem(QCheckListItem * /TransferThis/,QListViewItem *,
		       const QString &,Type = RadioButtonController);
	QCheckListItem(QListViewItem * /TransferThis/,const QString &,
		       Type = RadioButtonController);
	QCheckListItem(QListViewItem * /TransferThis/,QListViewItem *,
		       const QString &,Type = RadioButtonController);
	QCheckListItem(QListView * /TransferThis/,const QString &,
		       Type = RadioButtonController);
	QCheckListItem(QListView * /TransferThis/,QListViewItem *,
		       const QString &,Type = RadioButtonController);
%End
%If (Qt_2_00 - Qt_3_2_0)
	QCheckListItem(QCheckListItem * /TransferThis/,const QString &,
		       Type = Controller);
%If (Qt_3_1_0 -)
	QCheckListItem(QCheckListItem * /TransferThis/,QListViewItem *,
		       const QString &,Type = Controller);
%End
	QCheckListItem(QListViewItem * /TransferThis/,const QString &,
		       Type = Controller);
%If (Qt_3_1_0 -)
	QCheckListItem(QListViewItem * /TransferThis/,QListViewItem *,
		       const QString &,Type = Controller);
%End
	QCheckListItem(QListView * /TransferThis/,const QString &,
		       Type = Controller);
%If (Qt_3_1_0 -)
	QCheckListItem(QListView * /TransferThis/,QListViewItem *,
		       const QString &,Type = Controller);
%End
%End
%If (Qt_2_00 -)
	QCheckListItem(QListViewItem * /TransferThis/,const QString &,
		       const QPixmap &);
	QCheckListItem(QListView * /TransferThis/,const QString &,
		       const QPixmap &);
%End
%If (- Qt_2_00)
	QCheckListItem(QCheckListItem * /TransferThis/,const char *,
		       Type = Controller);
	QCheckListItem(QListView * /TransferThis/,const char *,
		       Type = Controller);
	QCheckListItem(QListViewItem * /TransferThis/,const char *,
		       const QPixmap &);
	QCheckListItem(QListView * /TransferThis/,const char *,
		       const QPixmap &);
%End

	void paintCell(QPainter *,const QColorGroup &,int,int,int);
%If (Qt_2_00 -)
	virtual void paintFocus(QPainter *,const QColorGroup &,const QRect &);
%End
	int width(const QFontMetrics &,const QListView *,int) const;
	void setup();

%If (- Qt_2_00)
	void setOn(bool);
%End
%If (Qt_2_00 -)
	virtual void setOn(bool);
%End
	bool isOn() const;
	Type type() const;
%If (- Qt_2_00)
	const char *text() const;
	const char *text(int) const;
%End
%If (Qt_2_00 -)
	QString text() const;
	QString text(int) const;
%End

%If (Qt_3_2_0 -)
	void setTristate(bool);
	bool isTristate() const;
	ToggleState state() const;
	void setState(ToggleState);
%End

%If (Qt_3_0_0 -)
	int rtti() const;
%End

protected:
%If (- Qt_3_0_0)
	void paintBranches(QPainter *,const QColorGroup &,int,int,int,GUIStyle);
%End
	void activate();
	void turnOffChild();
	virtual void stateChange(bool);
};


%If (Qt_2_00 -)

class QListViewItemIterator
{
%TypeHeaderCode
#include <qlistview.h>
%End

public:
%If (Qt_3_2_0 -)
	enum IteratorFlag {
		Visible,
		Invisible,
		Selected,
		Unselected,
		Selectable,
		NotSelectable,
		DragEnabled,
		DragDisabled,
		DropEnabled,
		DropDisabled,
		Expandable,
		NotExpandable,
		Checked,
		NotChecked
	};
%End

	QListViewItemIterator();
	QListViewItemIterator(QListViewItem *);
%If (Qt_3_2_0 -)
	QListViewItemIterator(QListViewItem *,int);
%End

	QListViewItemIterator(const QListViewItemIterator &);
	QListViewItemIterator(QListView *);
%If (Qt_3_2_0 -)
	QListViewItemIterator(QListView *,int);
%End

	QListViewItemIterator &operator+=(int);
	QListViewItemIterator &operator-=(int);

	QListViewItem *current() const;
};

%End
