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

<FuncSynopsis>
	<FuncDef>TQFocusData *<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 TQWidget : TQObject, TQPaintDevice
{
%TypeHeaderCode
#include <tqwidget.h>
%End

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

	WId winId() const;
	bool isTopLevel() const;
	bool isDialog() const;
	bool isPopup() const;
	bool isDesktop() const;
	bool isModal() const;
	bool isEnabled() const;
	bool isEnabledTo(TQWidget *) const;
	bool isEnabledToTLW() const;
	const TQRect &geometry() const;
	int x() const;
	int y() const;
	TQPoint pos() const;
	TQSize size() const;
	int width() const;
	int height() const;
	TQRect rect() const;
	TQRect childrenRect() const;
	TQSize minimumSize() const;
	TQSize maximumSize() const;
	void setMinimumSize(const TQSize &);
	void setMaximumSize(const TQSize &);
	void setMinimumWidth(int);
	void setMinimumHeight(int);
	void setMaximumWidth(int);
	void setMaximumHeight(int);
	TQSize sizeIncrement() const;
	void setSizeIncrement(const TQSize &);
	void setFixedSize(const TQSize &);
	void setFixedSize(int,int);
	void setFixedWidth(int);
	void setFixedHeight(int);
	TQPoint mapToGlobal(const TQPoint &) const;
	TQPoint mapFromGlobal(const TQPoint &) const;
	TQPoint mapToParent(const TQPoint &) const;
	TQPoint mapFromParent(const TQPoint &) const;
	TQPoint mapTo(TQWidget *,const TQPoint &) const;
	TQPoint mapFrom(TQWidget *,const TQPoint &) const;

	TQWidget *topLevelWidget() const;

	BackgroundMode backgroundMode() const;

	const TQColor &foregroundColor() const;

	const TQColor &eraseColor() const;
	virtual void setEraseColor(const TQColor &);

	const TQPixmap *erasePixmap() const;
	virtual void setErasePixmap(const TQPixmap &);

	const TQColorGroup &colorGroup() const;
	const TQPalette &palette() const;
	bool ownPalette() const;
	virtual void setPalette(const TQPalette &);
	void unsetPalette();

	const TQColor &paletteForegroundColor() const;
	void setPaletteForegroundColor(const TQColor &);
 
	const TQColor &paletteBackgroundColor() const;
	virtual void setPaletteBackgroundColor(const TQColor &);
 
	const TQPixmap *paletteBackgroundPixmap() const;
	virtual void setPaletteBackgroundPixmap(const TQPixmap &);

	const TQBrush &backgroundBrush() const;

	bool ownFont() const;
	virtual void setFont(const TQFont &);
	TQFontMetrics fontMetrics() const;
	TQFontInfo fontInfo() const;

	const TQCursor &cursor() const;
	bool ownCursor() const;
	virtual void setCursor(const TQCursor &);
	const TQPixmap *icon() const;
	bool hasMouseTracking() const;
	bool hasMouse() const;

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

	void setInputMethodEnabled(bool);
	bool isInputMethodEnabled() const;

	void grabMouse();
	void grabMouse(const TQCursor &);
	void releaseMouse();
	void grabKeyboard();
	void releaseKeyboard();
	static TQWidget *mouseGrabber();
	static TQWidget *keyboardGrabber();
	bool isUpdatesEnabled() const;
	bool isVisible() const;
	bool isVisibleTo(TQWidget *) const;
	bool isVisibleToTLW() const;
	virtual TQSize sizeHint() const;
	void erase();
	void erase(int,int,int,int);
	void erase(const TQRect &);
	void scroll(int,int);
	TQWidget *focusWidget() const;
	bool acceptDrops() const;
	TQWidget *parentWidget(bool = 0) const;
	WState testWState(WState) const;
	WFlags testWFlags(WFlags) const;
	static TQWidget *find(WId);

	TQWidget *childAt(int,int,bool = 0) const;
	TQWidget *childAt(const TQPoint &,bool = 0) const;

	void setWindowOpacity(double);
	double windowOpacity() const;

	void setName(const char *);
	TQStyle &style() const;
	void setStyle(TQStyle *);
	TQStyle *setStyle(const TQString &);
	TQRect frameGeometry() const;
	TQSize frameSize() const;
	TQRegion 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);
	TQSize baseSize() const;
	void setBaseSize(const TQSize &);
	void setBaseSize(int,int);

	virtual void setBackgroundMode(BackgroundMode);
	void setBackgroundMode(BackgroundMode,BackgroundMode);
	TQFont font() const;
	virtual void unsetCursor();
	TQString caption() const;
	TQString iconText() const;
	virtual void setMask(const TQBitmap &);
	virtual void setMask(const TQRegion &);

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

	virtual void setActiveWindow();
	virtual void setFocusPolicy(FocusPolicy);
	virtual void setFocusProxy(TQWidget *);
	virtual bool close(bool);
	// Obsolete.
	TQRect visibleRect() const;
	bool isMinimized() const;
	virtual TQSize minimumSizeHint() const;
	virtual TQSizePolicy sizePolicy() const;
	bool isHidden() const;
	bool isMaximized() const;
	bool isShown() const;
	bool isFullScreen() const;

	uint windowState() const;
	void setWindowState(uint);

	virtual void setSizePolicy(TQSizePolicy);
	void setSizePolicy(TQSizePolicy::SizeType,TQSizePolicy::SizeType,
			   bool = 0);
	virtual int heightForWidth(int) const;

	TQRegion clipRegion() const;

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

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

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

	void reparent(TQWidget * /GetWrapper/,const TQPoint &,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

	void erase(const TQRegion &);
	void scroll(int,int,const TQRect &);
	void drawText(int,int,const TQString &);
	void drawText(const TQPoint &,const TQString &);
	virtual void setAcceptDrops(bool);
	virtual void setAutoMask(bool);
	bool autoMask() const;
	virtual bool customWhatsThis() const;

	TQRect microFocusHint() const;
	void unsetFont();

	enum BackgroundOrigin {
		WidgetOrigin,
		ParentOrigin,
		WindowOrigin,
		AncestorOrigin,
	};
 
	virtual void setBackgroundOrigin(BackgroundOrigin);
	BackgroundOrigin backgroundOrigin() const;

	TQPoint backgroundOffset() const;

public slots:
	virtual void adjustSize();
	virtual void setEnabled(bool);
	void setDisabled(bool);
	void update();
	void update(int,int,int,int);
	void update(const TQRect &);
	void repaint(int,int,int,int,bool = 1);
	void repaint(const TQRect &,bool = 1);
	virtual void show();
	virtual void hide();
	void setShown(bool);
	void setHidden(bool);
	void raise() /PyName=raiseW/;
	void lower() /PyName=lowerW/;
	virtual void move(int,int);
	void move(const TQPoint &);
	virtual void resize(int,int);
	void resize(const TQSize &);
	virtual void setGeometry(int,int,int,int);

	virtual void setCaption(const TQString &);
	virtual void setIcon(const TQPixmap &);
	virtual void setIconText(const TQString &);
	virtual void setMouseTracking(bool);
	virtual void setFocus();
	void clearFocus();
	virtual void setUpdatesEnabled(bool);
	void repaint();
	void repaint(bool);
	void repaint(const TQRegion &,bool = 1);
	virtual void showMinimized();
	virtual void showMaximized();
	virtual void showNormal();
	virtual void polish();
	bool close();
	virtual void setGeometry(const TQRect &);

	void showFullScreen();
	void constPolish() const;

    // This was added before v3 but I can't be bothered to work out exactly
    // when.
    void stackUnder(TQWidget *);

protected:
	bool event(TQEvent *);
	virtual void mousePressEvent(TQMouseEvent *);
	virtual void mouseReleaseEvent(TQMouseEvent *);
	virtual void mouseDoubleClickEvent(TQMouseEvent *);
	virtual void mouseMoveEvent(TQMouseEvent *);
	virtual void keyPressEvent(TQKeyEvent *);
	virtual void keyReleaseEvent(TQKeyEvent *);
	virtual void focusInEvent(TQFocusEvent *);
	virtual void focusOutEvent(TQFocusEvent *);
	virtual void enterEvent(TQEvent *);
	virtual void leaveEvent(TQEvent *);
	virtual void paintEvent(TQPaintEvent *);
	virtual void moveEvent(TQMoveEvent *);
	virtual void resizeEvent(TQResizeEvent *);
	virtual void closeEvent(TQCloseEvent *);
	virtual void contextMenuEvent(TQContextMenuEvent *);
	virtual void imStartEvent(TQIMEvent *);
	virtual void imComposeEvent(TQIMEvent *);
	virtual void imEndEvent(TQIMEvent *);
	virtual void tabletEvent(TQTabletEvent *);
	virtual void enabledChange(bool);
	virtual void paletteChange(const TQPalette &);
	virtual void fontChange(const TQFont &);
	virtual void windowActivationChange(bool);
	void resetInputContext();
	WFlags getWFlags() const;
	void clearWFlags(WFlags);
	virtual bool focusNextPrevChild(bool);
//	TQWExtra *extraData();
//	TQFocusData *focusData();

	virtual void wheelEvent(TQWheelEvent *);
%If (TQt_DRAGANDDROP)
	virtual void dragEnterEvent(TQDragEnterEvent *);
	virtual void dragMoveEvent(TQDragMoveEvent *);
	virtual void dragLeaveEvent(TQDragLeaveEvent *);
	virtual void dropEvent(TQDropEvent *);
%End
	virtual void showEvent(TQShowEvent *);
	virtual void hideEvent(TQHideEvent *);
	virtual void customEvent(TQCustomEvent *);

	virtual void updateMask();

	virtual void styleChange(TQStyle &);
	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);
	virtual void setKeyCompression(bool);
	virtual void setMicroFocusHint(int,int,int,int,bool = 1,TQFont * = 0);

private:
	TQWidget(const TQWidget &);
};
