// This is the SIP interface definition for QBoxLayout, QGLayoutIterator,
// QGridLayout, QHBoxLayout, QLayout, QLayoutItem, QLayoutIterator,
// QSpacerItem, QVBoxLayout and QWidgetItem.
//
// 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>QLayout</Title>
<Para>
<Literal>QLayout</Literal> is fully implemented.
</Para>
</Sect2>

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

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

<Sect2><Title>QGridLayout</Title>
<FuncSynopsis>
	<FuncDef>bool <Function>findWidget</Function></FuncDef>
	<ParamDef>QWidget *<Parameter>w</Parameter></ParamDef>
	<ParamDef>int *<Parameter>row</Parameter></ParamDef>
	<ParamDef>int *<Parameter>col</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes the <Literal>w</Literal> parameter and returns a tuple containing
the <Literal>bool</Literal> result, <Literal>row</Literal> and
<Literal>col</Literal>. (Qt v2+)
</Para>
</Sect2>

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

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

<Sect2><Title>QLayoutIterator (Qt v2+)</Title>
<FuncSynopsis>
	<FuncDef>QLayoutItem *<Function>next</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This is a wrapper around the <Literal>QLayoutIterator</Literal>
<Literal>++</Literal> operator.
</Para>
</Sect2>

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

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

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


%If (- Qt_2_00)

class QLayout : QObject
{
%TypeHeaderCode
#include <qlayout.h>
%End

public:
	enum
	{
		unlimited = QCOORD_MAX
	};

	int defaultBorder() const;
	virtual bool activate();
	void freeze(int,int);
	void freeze();
	void setMenuBar(QMenuBar *);
	QWidget *mainWidget();

protected:
	QLayout(QWidget * /TransferThis/,int,int,const char *);
	QLayout(int = -1,const char * = 0);

	QGManager *basicManager();
	virtual QChain *mainVerticalChain() = 0;
	virtual QChain *mainHorizontalChain() = 0;
	virtual void initGM() = 0;
	void addChildLayout(QLayout *);

private:
	QLayout(const QLayout &);
};

%End


%If (Qt_2_00 -)

class QGLayoutIterator
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	virtual QLayoutItem *next() = 0;
	virtual QLayoutItem *current() = 0;
	virtual QLayoutItem *takeCurrent() = 0 /TransferBack/;
};


class QLayoutIterator
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	QLayoutIterator(QGLayoutIterator *) /Default/;
	QLayoutIterator(const QLayoutIterator &);

	QLayoutItem *next();
%MethodCode
		Py_BEGIN_ALLOW_THREADS
		sipRes = ++(*sipCpp);
		Py_END_ALLOW_THREADS
%End

	QLayoutItem *current();
	QLayoutItem *takeCurrent() /TransferBack/;
	void deleteCurrent();
};


class QLayoutItem
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	QLayoutItem(int = 0 );

%ConvertToSubClassCode
    // Note that we let the QObject sub-class code handle QLayout and it's
    // sub-classes.
	if (sipCpp->widget())
		sipClass = sipClass_QWidgetItem;
	else if (sipCpp->spacerItem())
		sipClass = sipClass_QSpacerItem;
	else
		sipClass = NULL;
%End

	virtual QSize sizeHint() const = 0;
	virtual QSize minimumSize() const = 0;
	virtual QSize maximumSize() const = 0;
	virtual QSizePolicy::ExpandData expanding() const = 0;
	virtual void setGeometry(const QRect &) = 0;
	virtual QRect geometry() const = 0;
	virtual bool isEmpty() const = 0;
	virtual bool hasHeightForWidth() const;
	virtual int heightForWidth(int) const;
	virtual void invalidate();

	virtual QWidget *widget();
	virtual QLayoutIterator iterator();
	virtual QLayout *layout();
	virtual QSpacerItem *spacerItem();

	int alignment() const;
	virtual void setAlignment(int);
};


class QSpacerItem : QLayoutItem
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	QSpacerItem(int,int,QSizePolicy::SizeType = QSizePolicy::Minimum,
		    QSizePolicy::SizeType = QSizePolicy::Minimum);

	void changeSize(int,int,QSizePolicy::SizeType = QSizePolicy::Minimum,
			QSizePolicy::SizeType = QSizePolicy::Minimum);
	QSize sizeHint() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
	QSizePolicy::ExpandData expanding() const;
	bool isEmpty() const;
	void setGeometry(const QRect &);
	QRect geometry() const;
	QSpacerItem *spacerItem();
};
 
 
class QWidgetItem : QLayoutItem
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	QWidgetItem(QWidget *);

	QSize sizeHint() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
	QSizePolicy::ExpandData expanding() const;
	bool isEmpty() const;
	void setGeometry(const QRect &) ;
	QRect geometry() const;
	virtual QWidget *widget();

	bool hasHeightForWidth() const;
	int heightForWidth(int) const;
};


class QLayout : QObject, QLayoutItem
{
%TypeHeaderCode
#include <qabstractlayout.h>
%End

public:
	enum ResizeMode {
		FreeResize,
		Minimum,
		Fixed,
%If (Qt_3_1_0 -)
		Auto
%End
	};

	QLayout(QWidget * /TransferThis/,int = 0,int = -1,const char * = 0);
	QLayout(QLayout * /TransferThis/,int = -1,const char * = 0);
	QLayout(int = -1,const char * = 0);

	int margin() const;
	int spacing() const;

	virtual void setMargin(int);
	virtual void setSpacing(int);

%If (- Qt_3_1_0)
	enum {
		unlimited
	};
%End

%If (Qt_3_0_0 -)
	int defaultBorder() const;
	void freeze(int,int);
	void freeze();
%End

	void setResizeMode(ResizeMode);
	ResizeMode resizeMode() const;

	virtual void setMenuBar(QMenuBar *);
	QMenuBar *menuBar() const;

	QWidget *mainWidget();
	bool isTopLevel() const;

	virtual void setAutoAdd(bool);
	bool autoAdd() const;

%If (Qt_2_1_0 -)
	void invalidate();
%End
	QRect geometry() const;
	bool activate();

	void add(QWidget *);
	virtual void addItem(QLayoutItem * /Transfer/) = 0;

%If (Qt_3_1_0 -)
	void remove(QWidget *);
	void removeItem(QLayoutItem * /TransferBack/);
%End

	QSizePolicy::ExpandData expanding() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
	void setGeometry(const QRect &) = 0;
	QLayoutIterator iterator() = 0;
	bool isEmpty() const;

	int totalHeightForWidth(int) const;
	QSize totalMinimumSize() const;
	QSize totalMaximumSize() const;
	QSize totalSizeHint() const;
	QLayout *layout();

%If (Qt_2_1_0 -)
	bool supportsMargin() const;
%End

%If (Qt_2_2_0 -)
	void setEnabled(bool);
	bool isEnabled() const;
%End

protected:
	bool eventFilter(QObject *,QEvent *);
%If (Qt_3_0_0 -)
	void childEvent(QChildEvent *);
%End
	void addChildLayout(QLayout *);
	void deleteAllItems();

%If (Qt_2_1_0 -)
	void setSupportsMargin(bool);
	QRect alignmentRect(const QRect &) const;
%End

private:
	QLayout(const QLayout &);
};

%End


class QGridLayout : QLayout
{
%TypeHeaderCode
#include <qlayout.h>
%End

public:
%If (- Qt_2_1_0)
	QGridLayout(QWidget * /TransferThis/,int,int,int = 0,int = -1,const char * = 0);
	QGridLayout(int,int,int = -1,const char * = 0);
%End
%If (Qt_2_00 - Qt_2_1_0)
	QGridLayout(QLayout * /TransferThis/,int,int,int = -1,const char * = 0);
%End
%If (Qt_2_1_0 -)
	QGridLayout(QWidget * /TransferThis/,int = 1,int = 1,int = 0,int = -1,const char * = 0);
	QGridLayout(int = 1,int = 1,int = -1,const char * = 0);
	QGridLayout(QLayout * /TransferThis/,int = 1,int = 1,int = -1,const char * = 0);
%End

%If (Qt_2_00 -)
	QSize sizeHint() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
%End

%If (- Qt_2_00)
	void setRowStretch(int,int);
	void setColStretch(int,int);
%End
%If (Qt_2_00 -)
	virtual void setRowStretch(int,int);
	virtual void setColStretch(int,int);
%End
%If (Qt_2_1_0 -)
	int rowStretch(int) const;
	int colStretch(int) const;
%End

%If (Qt_3_2_0 -)
	void setRowSpacing(int,int);
	void setColSpacing(int,int);
	int rowSpacing(int) const;
	int colSpacing(int) const;
%End

	int numRows() const;
	int numCols() const;
%If (Qt_2_1_0 -)
	QRect cellGeometry(int,int) const;
%End

%If (Qt_2_00 -)
	bool hasHeightForWidth() const;
	int heightForWidth(int) const;
%If (Qt_3_1_0 -)
	int minimumHeightForWidth(int) const;
%End

	QSizePolicy::ExpandData expanding() const;
	void invalidate();

	void addItem(QLayoutItem * /Transfer/);
%End
%If (Qt_2_1_0 -)
	void addItem(QLayoutItem * /Transfer/,int,int);
%End
%If (Qt_2_00 -)
	void addMultiCell(QLayoutItem * /Transfer/,int,int,int,int,int = 0);
%End

	void addWidget(QWidget *,int,int,int = 0);
	void addMultiCellWidget(QWidget *,int,int,int,int,int = 0);
	void addLayout(QLayout * /Transfer/,int,int);
%If (Qt_2_2_0 -)
	void addMultiCellLayout(QLayout * /Transfer/,int,int,int,int,int = 0);
%End
	void addRowSpacing(int,int);
	void addColSpacing(int,int);
	void expand(int,int);

%If (Qt_2_00 -)
	enum Corner {
		TopLeft,
		TopRight,
		BottomLeft,
		BottomRight
	};

	void setOrigin(Corner);
%End
%If (Qt_3_0_0 -)
	Corner origin() const;
%End
%If (Qt_2_00 -)
	QLayoutIterator iterator();
	void setGeometry(const QRect &);
%End

protected:
%If (- Qt_2_00)
	QChain *mainVerticalChain();
	QChain *mainHorizontalChain();
	void initGM();
%End

%If (Qt_2_00 -)
	bool findWidget(QWidget *,int *,int *);
	void add(QLayoutItem * /Transfer/,int,int);
%End

private:
	QGridLayout(const QGridLayout &);
};


class QBoxLayout : QLayout
{
%TypeHeaderCode
#include <qlayout.h>
%End

public:
	enum Direction {
		LeftToRight,
		RightToLeft,
		TopToBottom,
		BottomToTop,
		Down = TopToBottom,
		Up = BottomToTop
	};

	QBoxLayout(QWidget * /TransferThis/,Direction,int = 0,int = -1,const char * = 0);
%If (Qt_2_00 -)
	QBoxLayout(QLayout * /TransferThis/,Direction,int = -1,const char * = 0);
%End
	QBoxLayout(Direction,int = -1,const char * = 0);

	Direction direction() const;
%If (Qt_2_1_0 -)
	void setDirection(Direction);
%End
	void addSpacing(int);
	void addStretch(int = 0);
%If (- Qt_2_00)
	void addWidget(QWidget *,int = 0,int = AlignCenter);
%End
	void addLayout(QLayout * /Transfer/,int = 0);
	void addStrut(int);
%If (Qt_2_00 -)
	void addItem(QLayoutItem * /Transfer/);
	void addWidget(QWidget *,int = 0,int = 0);
%If (Qt_2_1_0 -)
	void insertSpacing(int,int);
	void insertStretch(int,int = 0);
	void insertWidget(int,QWidget *,int = 0,int = 0);
	void insertLayout(int,QLayout * /Transfer/,int = 0);
	int findWidget(QWidget *);
%End
	bool setStretchFactor(QWidget *,int);
	QSize sizeHint() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
	bool hasHeightForWidth() const;
	int heightForWidth(int) const;
%If (Qt_3_1_0 -)
	int minimumHeightForWidth(int) const;
%End

	QSizePolicy::ExpandData expanding() const;
	void invalidate();
	QLayoutIterator iterator();
	void setGeometry(const QRect &);
%End

protected:
%If (- Qt_2_00)
	QChain *mainVerticalChain();
	QChain *mainHorizontalChain();
	void initGM();
%End
%If (Qt_2_1_0 -)
	void insertItem(int,QLayoutItem * /Transfer/);
%End

private:
	QBoxLayout(const QBoxLayout &);
};


class QHBoxLayout : QBoxLayout
{
%TypeHeaderCode
#include <qlayout.h>
%End

public:
	QHBoxLayout(QWidget * /TransferThis/,int = 0,int = -1,const char * = 0);
%If (Qt_2_00 -)
	QHBoxLayout(QLayout * /TransferThis/,int = -1,const char * = 0);
%End
	QHBoxLayout(int = -1,const char * = 0);

private:
%If (Qt_3_1_0 -)
	QHBoxLayout(const QHBoxLayout &);
%End
};


class QVBoxLayout : QBoxLayout
{
%TypeHeaderCode
#include <qlayout.h>
%End

public:
	QVBoxLayout(QWidget * /TransferThis/,int = 0,int = -1,const char * = 0);
%If (Qt_2_00 -)
	QVBoxLayout(QLayout * /TransferThis/,int = -1,const char * = 0);
%End
	QVBoxLayout(int = -1,const char * = 0);

private:
%If (Qt_3_1_0 -)
	QVBoxLayout(const QVBoxLayout &);
%End
};
