// This is the SIP interface definition for QTab and QTabBar.
//
// Copyright (c) 2003
// 	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>QTab</Title>
<Para>
<Literal>QTab</Literal> is fully implemented.
</Para>
</Sect2>

<Sect2><Title>QTabBar</Title>
<FuncSynopsis>
        <FuncDef>QList&lt;QTab&gt; <Function>tabList</Function></FuncDef>
        <ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This returns a list of <Literal>QTab</Literal> instances.
</Para>
</Sect2>
%End


%If (Qt_3_0_0 -)

class QTab : Qt
{
%HeaderCode
#include <qtabbar.h>
%End

public:
	QTab();
	QTab(const QString &);
	QTab(const QIconSet &,const QString & = QString::null);

	void setText(const QString &);
	QString text() const;
	void setIconSet(const QIconSet &);
	QIconSet *iconSet() const;
	void setRect(const QRect &);
	QRect rect() const;
	void setEnabled(bool);
	bool isEnabled() const;
	void setIdentifier(int);
	int identifier() const;
};

%End

%If (- Qt_3_0_0)

class QTab
{
%HeaderCode
#include <qtabbar.h>
%End

public:
	QTab();
%If (Qt_2_1_0 -)
	QTab(const QString &);
	QTab(const QIconSet &,const QString & = QString::null);
%End

	QString label;
	QRect r;
	bool enabled;
	int id;
	QIconSet *iconset;
};

%End


class QTabBar : QWidget
{
%HeaderCode
#include <qtabbar.h>
%End

public:
	QTabBar(QWidget * /TransferThis/ = 0,const char * = 0);

	enum Shape {
		RoundedAbove,
		RoundedBelow,
		TriangularAbove,
		TriangularBelow
	};

	Shape shape() const;
%If (- Qt_2_00)
	void setShape(Shape);
%End
%If (Qt_2_00 -)
	virtual void setShape(Shape);
%End

	void show();

	virtual int addTab(QTab * /Transfer/);
%If (Qt_2_00 -)
	virtual int insertTab(QTab * /Transfer/,int = -1);
	virtual void removeTab(QTab *);
%End

%If (- Qt_2_00)
	void setTabEnabled(int,bool);
%End
%If (Qt_2_00 -)
	virtual void setTabEnabled(int,bool);
%End
	bool isTabEnabled(int) const;

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

	int currentTab() const;
	int keyboardFocusTab() const;

%If (- Qt_3_0_0)
	QTab *tab(int);
%End
%If (Qt_3_0_0 -)
	QTab *tab(int) const;
	QTab *tabAt(int) const;
	int indexOf(int) const;
%End
%If (Qt_2_2_0 -)
	int count() const;
%End

%If (Qt_2_00 -)
	virtual void layoutTabs();
%End
%If (Qt_3_0_0 -)
	virtual QTab *selectTab(const QPoint &) const;
 
	void removeToolTip(int);
	void setToolTip(int,const QString &);
	QString toolTip(int) const;
%End

public slots:
%If (- Qt_2_00)
	void setCurrentTab(int);
	void setCurrentTab(QTab *);
%End
%If (Qt_2_00 -)
	virtual void setCurrentTab(int);
	virtual void setCurrentTab(QTab *);
%End

signals:
	void selected(int);

protected:
	virtual void paint(QPainter *,QTab *,bool) const;
%If (Qt_2_00 -)
	virtual void paintLabel(QPainter *,const QRect &,QTab *,bool) const;
%End

%If (- Qt_3_0_0)
	virtual QTab *selectTab(const QPoint &) const;
%End
%If (Qt_2_00 - Qt_3_0_0)
	void updateMask();
%End

%If (Qt_2_1_0 -)
	void focusInEvent(QFocusEvent *);
	void focusOutEvent(QFocusEvent *);

	void resizeEvent(QResizeEvent *);
%End
	void paintEvent(QPaintEvent *);
	void mousePressEvent(QMouseEvent *);
%If (Qt_3_0_0 -)
	void mouseMoveEvent(QMouseEvent *);
%End
	void mouseReleaseEvent(QMouseEvent *);
	void keyPressEvent(QKeyEvent *);
%If (Qt_2_1_0 -)
	void styleChange(QStyle &);
%End
%If (Qt_3_0_0 -)
	void fontChange(const QFont &);
%End

%If (Qt_3_1_0 -)
	bool event(QEvent *);
%End

	QList<QTab> *tabList();
%MemberCode
		sip$C *ptr;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"p",sipThisObj,sipClass_$C,&ptr))
		{
			PyObject *pl;
			QTab *tab;
			QList<QTab> *tl;

			if ((pl = PyList_New(0)) == NULL)
				return NULL;

			// Convert the list.

			Py_BEGIN_ALLOW_THREADS
			tl = ptr -> sipProtect_tabList();
			Py_END_ALLOW_THREADS

			for (QListIterator<QTab> it(*tl); (tab = it.current()) != NULL; ++it)
			{
				PyObject *inst;

				if ((inst = sipMapCppToSelf(tab,sipClass_QTab)) == NULL || PyList_Append(pl,inst) < 0)
				{
					Py_XDECREF(inst);
					Py_DECREF(pl);

					return NULL;
				}

				Py_DECREF(inst);
			}

			return pl;
		}
%End

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