// This is the SIP interface definition for QWidget.
//
// 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>QWidget</Title>
<FuncSynopsis>
	<FuncDef>QWExtra *<Function>extraData</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
Not implemented.
</Para>

<FuncSynopsis>
	<FuncDef>QFocusData *<Function>focusData</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
Not implemented.
</Para>

<FuncSynopsis>
	<FuncDef>void <Function>lower</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed to <Literal>lowerW</Literal> in Python.
</Para>

<FuncSynopsis>
	<FuncDef>void <Function>raise</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed to <Literal>raiseW</Literal> in Python.
</Para>
</Sect2>
%End


class QWidget : QObject, QPaintDevice
{
%TypeHeaderCode
#include <qwidget.h>
%End

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

	WId winId() const;
	bool isTopLevel() const;
%If (Qt_3_0_0 -)
	bool isDialog() const;
%End
	bool isPopup() const;
	bool isDesktop() const;
	bool isModal() const;
	bool isEnabled() const;
	bool isEnabledTo(QWidget *) const;
	bool isEnabledToTLW() const;
	const QRect &geometry() const;
	int x() const;
	int y() const;
	QPoint pos() const;
	QSize size() const;
	int width() const;
	int height() const;
	QRect rect() const;
	QRect childrenRect() const;
	QSize minimumSize() const;
	QSize maximumSize() const;
	void setMinimumSize(const QSize &);
	void setMaximumSize(const QSize &);
	void setMinimumWidth(int);
	void setMinimumHeight(int);
	void setMaximumWidth(int);
	void setMaximumHeight(int);
	QSize sizeIncrement() const;
	void setSizeIncrement(const QSize &);
	void setFixedSize(const QSize &);
	void setFixedSize(int,int);
	void setFixedWidth(int);
	void setFixedHeight(int);
	QPoint mapToGlobal(const QPoint &) const;
	QPoint mapFromGlobal(const QPoint &) const;
	QPoint mapToParent(const QPoint &) const;
	QPoint mapFromParent(const QPoint &) const;
%If (Qt_2_2_0 -)
	QPoint mapTo(QWidget *,const QPoint &) const;
	QPoint mapFrom(QWidget *,const QPoint &) const;
%End

	QWidget *topLevelWidget() const;

	BackgroundMode backgroundMode() const;
%If (- Qt_3_0_0)
	const QColor &backgroundColor() const;
	virtual void setBackgroundColor(const QColor &);
	const QPixmap *backgroundPixmap();
	virtual void setBackgroundPixmap(const QPixmap &);
%End

	const QColor &foregroundColor() const;

%If (Qt_3_0_0 -)
	const QColor &eraseColor() const;
	virtual void setEraseColor(const QColor &);

	const QPixmap *erasePixmap() const;
	virtual void setErasePixmap(const QPixmap &);
%End

	const QColorGroup &colorGroup() const;
	const QPalette &palette() const;
%If (Qt_2_2_0 -)
	bool ownPalette() const;
%End
	virtual void setPalette(const QPalette &);
%If (Qt_2_1_0 -)
	void unsetPalette();
%End

%If (Qt_3_0_0 -)
	const QColor &paletteForegroundColor() const;
	void setPaletteForegroundColor(const QColor &);
 
	const QColor &paletteBackgroundColor() const;
	virtual void setPaletteBackgroundColor(const QColor &);
 
	const QPixmap *paletteBackgroundPixmap() const;
	virtual void setPaletteBackgroundPixmap(const QPixmap &);

	const QBrush &backgroundBrush() const;
%End

%If (Qt_2_2_0 -)
	bool ownFont() const;
%End
	virtual void setFont(const QFont &);
	QFontMetrics fontMetrics() const;
	QFontInfo fontInfo() const;

%If (- Qt_3_0_0)
	enum PropagationMode
	{
		NoChildren,
		AllChildren,
		SameFont,
		SamePalette = SameFont
	};

	PropagationMode fontPropagation() const;
	PropagationMode palettePropagation() const;
%End

	const QCursor &cursor() const;
%If (Qt_2_2_0 -)
	bool ownCursor() const;
%End
	virtual void setCursor(const QCursor &);
	const QPixmap *icon() const;
	bool hasMouseTracking() const;
%If (Qt_3_0_0 -)
	bool hasMouse() const;
%End

	void clearMask();
	bool isActiveWindow() const;
	bool isFocusEnabled() const;
	FocusPolicy focusPolicy() const;
	bool hasFocus() const;
	static void setTabOrder(QWidget *,QWidget *);
	QWidget *focusProxy() const;

%If (Qt_3_2_0 -)
	void setInputMethodEnabled(bool);
	bool isInputMethodEnabled() const;
%End

	void grabMouse();
	void grabMouse(const QCursor &);
	void releaseMouse();
	void grabKeyboard();
	void releaseKeyboard();
	static QWidget *mouseGrabber();
	static QWidget *keyboardGrabber();
	bool isUpdatesEnabled() const;
	bool isVisible() const;
	bool isVisibleTo(QWidget *) const;
	bool isVisibleToTLW() const;
	virtual QSize sizeHint() const;
%If (- Qt_3_1_0)
	virtual void adjustSize();
%End
	void erase();
	void erase(int,int,int,int);
	void erase(const QRect &);
	void scroll(int,int);
	QWidget *focusWidget() const;
	bool acceptDrops() const;
%If (- Qt_3_0_0)
	QWidget *parentWidget() const;
	bool testWFlags(WFlags) const;
%End
%If (Qt_3_0_0 -)
	QWidget *parentWidget(bool = 0) const;
	WState testWState(WState) const;
	WFlags testWFlags(WFlags) const;
%End
	static QWidget *find(WId);

%If (Qt_3_0_0 -)
	QWidget *childAt(int,int,bool = 0) const;
	QWidget *childAt(const QPoint &,bool = 0) const;
%End

%If (Qt_3_3_0 -)
	void setWindowOpacity(double);
	double windowOpacity() const;
%End

%If (- Qt_2_00)
	GUIStyle style() const;
	virtual void setStyle(GUIStyle);
	const QRect &frameGeometry() const;
	void setMinimumSize(int,int);
	void setMaximumSize(int,int);
	void setSizeIncrement(int,int);

	enum BackgroundMode
	{
		FixedColor,
		FixedPixmap,
		NoBackground,
		PaletteForeground,
		PaletteBackground,
		PaletteLight,
		PaletteMidlight,
		PaletteDark,
		PaletteMid,
		PaletteText,
		PaletteBase
	};

	void setBackgroundMode(BackgroundMode);
	const QFont &font() const;
	void setFontPropagation(PropagationMode);
	void setPalettePropagation(PropagationMode);
	const char *caption() const;
	const char *iconText() const;
	void setMask(QBitmap);
	void setMask(const QRegion &);

	enum FocusPolicy
	{
		NoFocus = 0,
		TabFocus = 1,
		ClickFocus = 2,
		StrongFocus = 3
	};

	void setActiveWindow();
	void setFocusPolicy(FocusPolicy);
	void setFocus();
	void clearFocus();
	void setFocusProxy(QWidget *);
	virtual bool close(bool = 0);
	void recreate(QWidget *,WFlags,const QPoint &,bool = 0);
	void drawText(int,int,const char *);
	void drawText(const QPoint &,const char *);
	void setAcceptDrops(bool);
%End

%If (Qt_2_00 -)
	void setName(const char *);
	QStyle &style() const;
	void setStyle(QStyle *);
%If (Qt_3_0_0 -)
	QStyle *setStyle(const QString &);
%End
	QRect frameGeometry() const;
	QSize frameSize() const;
	QRegion childrenRegion() const;
	int minimumWidth() const;
	int minimumHeight() const;
	int maximumWidth() const;
	int maximumHeight() const;
	virtual void setMinimumSize(int,int);
	virtual void setMaximumSize(int,int);
	virtual void setSizeIncrement(int,int);
	QSize baseSize() const;
	void setBaseSize(const QSize &);
	void setBaseSize(int,int);

%If (- Qt_2_2_0)
	enum BackgroundMode
	{
		FixedColor,
		FixedPixmap,
		NoBackground,
		PaletteForeground,
		PaletteButton,
		PaletteLight,
		PaletteMidlight,
		PaletteDark,
		PaletteMid,
		PaletteText,
		PaletteBrightText,
		PaletteBase,
		PaletteBackground,
		PaletteShadow,
		PaletteHighlight,
		PaletteHighlightedText
	};
%End
%If (Qt_2_2_0 - Qt_3_0_0)
	enum BackgroundMode
	{
		FixedColor,
		FixedPixmap,
		NoBackground,
		PaletteForeground,
		PaletteButton,
		PaletteLight,
		PaletteMidlight,
		PaletteDark,
		PaletteMid,
		PaletteText,
		PaletteBrightText,
		PaletteBase,
		PaletteBackground,
		PaletteShadow,
		PaletteHighlight,
		PaletteHighlightedText,
		PaletteButtonText,
		X11ParentRelative
	};
%End

	virtual void setBackgroundMode(BackgroundMode);
%If (Qt_3_0_0 -)
	void setBackgroundMode(BackgroundMode,BackgroundMode);
%End
	QFont font() const;
%If (- Qt_3_0_0)
	void setPalette(const QPalette &,bool);
	void setFont(const QFont &,bool);
	virtual void setFontPropagation(PropagationMode);
	virtual void setPalettePropagation(PropagationMode);
%End
	virtual void unsetCursor();
	QString caption() const;
	QString iconText() const;
	virtual void setMask(const QBitmap &);
	virtual void setMask(const QRegion &);

	enum FocusPolicy
	{
		NoFocus = 0,
		TabFocus = 1,
		ClickFocus = 2,
		StrongFocus = 3,
		WheelFocus = 7
	};

	virtual void setActiveWindow();
	virtual void setFocusPolicy(FocusPolicy);
	virtual void setFocusProxy(QWidget *);
	virtual bool close(bool);
	// Obsolete.
	QRect visibleRect() const;
	bool isMinimized() const;
	virtual QSize minimumSizeHint() const;
	virtual QSizePolicy sizePolicy() const;
%If (Qt_2_2_0 -)
	bool isHidden() const;
	bool isMaximized() const;
%End
%If (Qt_3_1_0 -)
	bool isShown() const;
	bool isFullScreen() const;
%End

%If (Qt_3_3_0 -)
	uint windowState() const;
	void setWindowState(uint);
%End

%If (Qt_3_0_0 -)
	virtual void setSizePolicy(QSizePolicy);
%End
%If (Qt_3_1_0 -)
	void setSizePolicy(QSizePolicy::SizeType,QSizePolicy::SizeType,
			   bool = 0);
%End
%If (Qt_2_2_0 - Qt_3_0_0)
	void setSizePolicy(QSizePolicy);
%End
	virtual int heightForWidth(int) const;

%If (Qt_3_2_0 -)
	QRegion clipRegion() const;
%End

	QLayout *layout() const;
	void updateGeometry();

	virtual void reparent(QWidget * /GetWrapper/,WFlags,const QPoint &,
			      bool = 0);
%MethodCode
		if (sipCpp -> parent() != a0)
			if (a0)
				sipTransferTo(sipSelf,a0Wrapper);
			else
				sipTransferBack(sipSelf);

		Py_BEGIN_ALLOW_THREADS
		sipSelfWasArg ? sipCpp->QWidget::reparent(a0, a1, *a2, a3) : sipCpp->reparent(a0, a1, *a2, a3);
		Py_END_ALLOW_THREADS
%End

%If (Qt_2_1_0 -)
	void reparent(QWidget * /GetWrapper/,const QPoint &,bool = 0);
%MethodCode
		if (sipCpp -> parent() != a0)
			if (a0)
				sipTransferTo(sipSelf,a0Wrapper);
			else
				sipTransferBack(sipSelf);

		Py_BEGIN_ALLOW_THREADS
		sipCpp->reparent(a0, *a1, a2);
		Py_END_ALLOW_THREADS
%End
%End

	void erase(const QRegion &);
	void scroll(int,int,const QRect &);
	void drawText(int,int,const QString &);
	void drawText(const QPoint &,const QString &);
	virtual void setAcceptDrops(bool);
	virtual void setAutoMask(bool);
	bool autoMask() const;
	virtual bool customWhatsThis() const;
%If (- Qt_3_0_0)
	bool testWState(uint) const;
%End
%End

%If (Qt_2_1_0 -)
	QRect microFocusHint() const;
	void unsetFont();
%End

%If (Qt_2_1_0 -)
	enum BackgroundOrigin {
		WidgetOrigin,
		ParentOrigin,
%If (Qt_3_0_0 -)
		WindowOrigin,
%End
%If (Qt_3_1_0 -)
		AncestorOrigin,
%End
	};
%End
 
%If (Qt_2_1_0 - Qt_3_0_0)
	void setBackgroundOrigin(BackgroundOrigin);
%End
%If (Qt_3_0_0 -)
	virtual void setBackgroundOrigin(BackgroundOrigin);
%End
%If (Qt_2_1_0 -)
	BackgroundOrigin backgroundOrigin() const;
%End

%If (Qt_3_1_0 -)
	QPoint backgroundOffset() const;
%End

public slots:
%If (Qt_3_1_0 -)
	virtual void adjustSize();
%End
	virtual void setEnabled(bool);
%If (Qt_2_2_0 -)
	void setDisabled(bool);
%End
	void update();
	void update(int,int,int,int);
	void update(const QRect &);
	void repaint(int,int,int,int,bool = 1);
	void repaint(const QRect &,bool = 1);
	virtual void show();
	virtual void hide();
%If (Qt_3_1_0 -)
	void setShown(bool);
	void setHidden(bool);
%End
	void raise() /PyName=raiseW/;
	void lower() /PyName=lowerW/;
	virtual void move(int,int);
	void move(const QPoint &);
	virtual void resize(int,int);
	void resize(const QSize &);
	virtual void setGeometry(int,int,int,int);

%If (- Qt_2_00)
	void setCaption(const char *);
	void setIcon(const QPixmap &);
	void setIconText(const char *);
	void setMouseTracking(bool);
	void setUpdatesEnabled(bool);
	void repaint(bool = 1);
	void iconify();
	void setGeometry(const QRect &);
%End

%If (Qt_2_00 -)
	virtual void setCaption(const QString &);
	virtual void setIcon(const QPixmap &);
	virtual void setIconText(const QString &);
	virtual void setMouseTracking(bool);
	virtual void setFocus();
	void clearFocus();
	virtual void setUpdatesEnabled(bool);
	void repaint();
	void repaint(bool);
	void repaint(const QRegion &,bool = 1);
	virtual void showMinimized();
	virtual void showMaximized();
	virtual void showNormal();
	virtual void polish();
	bool close();
	virtual void setGeometry(const QRect &);
%End

%If (Qt_2_1_0 -)
	void showFullScreen();
	void constPolish() const;
%End

protected:
	bool event(QEvent *);
	virtual void mousePressEvent(QMouseEvent *);
	virtual void mouseReleaseEvent(QMouseEvent *);
	virtual void mouseDoubleClickEvent(QMouseEvent *);
	virtual void mouseMoveEvent(QMouseEvent *);
	virtual void keyPressEvent(QKeyEvent *);
	virtual void keyReleaseEvent(QKeyEvent *);
	virtual void focusInEvent(QFocusEvent *);
	virtual void focusOutEvent(QFocusEvent *);
	virtual void enterEvent(QEvent *);
	virtual void leaveEvent(QEvent *);
	virtual void paintEvent(QPaintEvent *);
	virtual void moveEvent(QMoveEvent *);
	virtual void resizeEvent(QResizeEvent *);
	virtual void closeEvent(QCloseEvent *);
%If (Qt_3_0_0 -)
	virtual void contextMenuEvent(QContextMenuEvent *);
	virtual void imStartEvent(QIMEvent *);
	virtual void imComposeEvent(QIMEvent *);
	virtual void imEndEvent(QIMEvent *);
	virtual void tabletEvent(QTabletEvent *);
%End
	virtual void enabledChange(bool);
%If (- Qt_3_0_0)
	virtual void backgroundColorChange(const QColor &);
	virtual void backgroundPixmapChange(const QPixmap &);
%End
	virtual void paletteChange(const QPalette &);
	virtual void fontChange(const QFont &);
%If (Qt_3_0_0 -)
	virtual void windowActivationChange(bool);
	void resetInputContext();
%End
	WFlags getWFlags() const;
	void clearWFlags(WFlags);
	virtual bool focusNextPrevChild(bool);
//	QWExtra *extraData();
//	QFocusData *focusData();

%If (- Qt_2_00)
	virtual void styleChange(GUIStyle);
	void create(WId);
	void create(WId,bool,bool);
	void destroy(bool,bool);
	void setWFlags(WFlags);
	void setFRect(const QRect &);
	void setCRect(const QRect &);
	void setSizeGrip(bool);
%End

%If (Qt_2_00 -)
	virtual void wheelEvent(QWheelEvent *);
%If (Qt_DRAGANDDROP)
	virtual void dragEnterEvent(QDragEnterEvent *);
	virtual void dragMoveEvent(QDragMoveEvent *);
	virtual void dragLeaveEvent(QDragLeaveEvent *);
	virtual void dropEvent(QDropEvent *);
%End
	virtual void showEvent(QShowEvent *);
	virtual void hideEvent(QHideEvent *);
%If (- Qt_3_0_0)
	virtual void customEvent(QCustomEvent *);
%End


	virtual void updateMask();

	virtual void styleChange(QStyle &);
	int metric(int) const;
	virtual void create(WId = 0,bool = 1,bool = 1);
	virtual void destroy(bool = 1,bool = 1);
	uint getWState() const;
	virtual void setWState(uint);
	void clearWState(uint);
	virtual void setWFlags(WFlags);
%If (- Qt_3_0_0)
	virtual void setFRect(const QRect &);
	virtual void setCRect(const QRect &);
%End
	virtual void setKeyCompression(bool);
%If (- Qt_3_0_0)
	virtual void setMicroFocusHint(int,int,int,int,bool = 1);
%End
%If (Qt_3_0_0 -)
	virtual void setMicroFocusHint(int,int,int,int,bool = 1,QFont * = 0);
%End
%End

private:
	QWidget(const QWidget &);
};
