// This is the SIP interface definition for TQListBox, TQListBoxItem,
// TQListBoxPixmap and TQListBoxText.
//
// 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>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


%If (- TQt_2_00)

%ModuleHeaderCode
#include <tqlistbox.h>
%End

// List box item types.
const int LBI_Undefined;
const int LBI_Text;
const int LBI_Pixmap;
const int LBI_UserDefined;


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

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

	void setFont(const TQFont &);
	uint count() const;
	void insertStrList(const TQStrList *,int = -1);
//	void insertStrList(const char **,int = -1,int = -1);
	void insertItem(const TQListBoxItem * /Transfer/,int = -1);
	void insertItem(const char *,int = -1);
	void insertItem(const TQPixmap &,int = -1);
	void inSort(const TQListBoxItem *);
	void inSort(const char *);
	void removeItem(int);
	void clear();
	const char *text(int) const;
	const TQPixmap *pixmap(int) const;
	void changeItem(const TQListBoxItem * /Transfer/,int);
	void changeItem(const char *,int);
	void changeItem(const TQPixmap &,int);
	bool autoUpdate() const;
	void setAutoUpdate(bool);
	int numItemsVisible() const;
	void setFixedVisibleLines(int);
	int currentItem() const;
	void setCurrentItem(int);
	void centerCurrentItem();
	int topItem() const;
	void setTopItem(int);
	void setBottomItem(int);
	bool dragSelect() const;
	void setDragSelect(bool);
	bool autoScroll() const;
	void setAutoScroll(bool);
	bool autoScrollBar() const;
	void setAutoScrollBar(bool);
	bool scrollBar() const;
	void setScrollBar(bool);
	bool autoBottomScrollBar() const;
	void setAutoBottomScrollBar(bool);
	bool bottomScrollBar() const;
	void setBottomScrollBar(bool);
	bool smoothScrolling() const;
	void setSmoothScrolling(bool);
	int itemHeight() const;
	int itemHeight(int) const;
	long maxItemWidth() const;
	bool isMultiSelection() const;
	void setMultiSelection(bool);
	void setSelected(int,bool);
	bool isSelected(int) const;
	TQSize sizeHint() const;

public slots:
	void clearSelection();

signals:
	void highlighted(int);
	void selected(int);
	void highlighted(const char *);
	void selected(const char *);
	void selectionChanged();

protected:
	TQListBoxItem *item(int) const;
	bool itemVisible(int);
	int cellHeight(int = 0);
	void paintCell(TQPainter *,int,int);
	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 timerEvent(TQTimerEvent *);
	int findItem(int) const;
	bool itemYPos(int,int *) const;
	void updateItem(int,bool = 1);
	void clearList();
	void updateCellWidth();
	void toggleCurrentItem();

private:
	TQListBox(const TQListBox &);
};

%End

%If (TQt_2_00 -)

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);
%If (TQt_2_1_0 -)
	void insertItem(const TQListBoxItem * /Transfer/,const TQListBoxItem *);
%End
	void insertItem(const TQString &,int = -1);
	void insertItem(const TQPixmap &,int = -1);
%If (TQt_2_1_0 -)
	void insertItem(const TQPixmap &,const TQString &,int = -1);
%End

	void removeItem(int);

%If (- TQt_3_0_0)
	void clear();
%End

	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);
%If (TQt_2_1_0 -)
	void changeItem(const TQPixmap &,const TQString &,int);
%End

	void takeItem(const TQListBoxItem * /TransferBack/);

	int numItemsVisible() const;

	int currentItem() const;
%If (TQt_2_1_0 -)
	TQString currentText() const;
%End
	virtual void setCurrentItem(int);
	virtual void setCurrentItem(TQListBoxItem *);
	void centerCurrentItem();
	int topItem() const;
	virtual void setTopItem(int);
	virtual void setBottomItem(int);

	long maxItemWidth() const;

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

	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;
%If (TQt_3_1_0 -)
	TQListBoxItem *selectedItem() const;
%End

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

	TQListBoxItem *item(int) const;
	int index(const TQListBoxItem *) const;
%If (TQt_2_1_0 - TQt_3_0_0)
	TQListBoxItem *findItem(const TQString &) const;
%End
%If (TQt_3_0_0 -)
	TQListBoxItem *findItem(const TQString &,
			       ComparisonFlags = BeginsWith) const;
%End

	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;

%If (TQt_2_1_0 -)
	TQListBoxItem *firstItem() const;

	void sort(bool = 1);
%End

public slots:
%If (TQt_3_0_0 -)
	void clear();
%End
	virtual void ensureCurrentVisible();
	virtual void clearSelection();
%If (TQt_2_1_0 - TQt_3_0_0)
	void selectAll(bool);
	void invertSelection();
%End
%If (TQt_3_0_0 -)
	virtual void selectAll(bool);
	virtual void invertSelection();
%End

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

	void selectionChanged();
%If (TQt_2_1_0 -)
	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 &);
%End

%If (TQt_3_0_0 -)
	void contextMenuRequested(TQListBoxItem *,const TQPoint &);
%End

%If (TQt_2_1_0 -)
	void onItem(TQListBoxItem *);
	void onViewport();
%End

protected:
%If (- TQt_3_0_0)
	void viewportMousePressEvent(TQMouseEvent *);
	void viewportMouseReleaseEvent(TQMouseEvent *);
	void viewportMouseDoubleClickEvent(TQMouseEvent *);
	void viewportMouseMoveEvent(TQMouseEvent *);
%End
	void mousePressEvent(TQMouseEvent *);
	void mouseReleaseEvent(TQMouseEvent *);
	void mouseDoubleClickEvent(TQMouseEvent *);
	void mouseMoveEvent(TQMouseEvent *);
%If (TQt_3_0_0 -)
	void contentsContextMenuEvent(TQContextMenuEvent *);
%End

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

%If (TQt_3_0_0 -)
	bool eventFilter(TQObject *,TQEvent *);
%End

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

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

	void toggleCurrentItem();
%If (TQt_2_2_0 -)
	bool isRubberSelecting() const;
%End

	void doLayout() const;

%If (TQt_3_0_0 -)
	void windowActivationChange(bool);
%End

protected slots:
%If (TQt_2_1_0 -)
	void clearInputString();
%End

private:
	TQListBox(const TQListBox &);
};

%End


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

public:
%If (- TQt_2_00)
	TQListBoxItem();
%End
%If (TQt_2_00 -)
	TQListBoxItem(TQListBox * /TransferThis/ = 0);
%End
%If (TQt_2_1_0 -)
	TQListBoxItem(TQListBox * /TransferThis/,TQListBoxItem *);
%End

%If (- TQt_2_00)
	virtual const char *text() const;
%End
%If (TQt_2_00 -)
	virtual TQString text() const;
%End
	virtual const TQPixmap *pixmap() const;

%If (- TQt_2_00)
	virtual int height(const TQListBox *) const = 0;
	virtual int width(const TQListBox *) const = 0;
%End
%If (TQt_2_00 -)
	virtual int height(const TQListBox *) const;
	virtual int width(const TQListBox *) const;
%End

%If (TQt_2_00 - TQt_3_0_0)
        bool selected() const;
%End
%If (TQt_2_1_0 - TQt_3_0_0)
	bool current() const;
%End
%If (TQt_3_0_0 -)
        bool isSelected() const;
	bool isCurrent() const;
%End

%If (TQt_2_00 -)
	TQListBox *listBox() const;
%End

%If (TQt_2_1_0 -)
	void setSelectable(bool);
	bool isSelectable() const;

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

%If (TQt_3_0_0 -)
	virtual int rtti() const;
%End

protected:
	virtual void paint(TQPainter *) = 0;
%If (- TQt_2_00)
	void setText(const char *);
%End
%If (TQt_2_00 -)
	virtual void setText(const TQString &);
%End
%If (TQt_2_1_0 -)
	void setCustomHighlighting(bool);
%End

private:
	TQListBoxItem(const TQListBoxItem &);
};

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

public:
%If (- TQt_2_00)
	TQListBoxText(const char * = 0);
%End
%If (TQt_2_00 -)
	TQListBoxText(TQListBox * /TransferThis/,
		     const TQString & = TQString::null);
	TQListBoxText(const TQString & = TQString::null);
%End
%If (TQt_2_1_0 -)
	TQListBoxText(TQListBox * /TransferThis/,const TQString &,TQListBoxItem *);
%End

%If (- TQt_2_00)
	void paint(TQPainter *);
%End
	int height(const TQListBox *) const;
	int width(const TQListBox *) const;

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

protected:
%If (TQt_2_00 -)
	void paint(TQPainter *);
%End

private:
	TQListBoxText(const TQListBoxText &);
};

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

public:
%If (TQt_2_00 -)
	TQListBoxPixmap(TQListBox * /TransferThis/,const TQPixmap &);
%End
	TQListBoxPixmap(const TQPixmap &);
%If (TQt_2_1_0 -)
	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 *);
%End

	const TQPixmap *pixmap() const;
%If (TQt_2_00 -)
	int height(const TQListBox *) const;
	int width(const TQListBox *) const;
%End

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

protected:
	void paint(TQPainter *);
%If (- TQt_2_00)
	int height(const TQListBox *) const;
	int width(const TQListBox *) const;
%End

private:
	TQListBoxPixmap(const TQListBoxPixmap &);
};
