// This is the SIP interface definition for TQLineEdit.
//
// 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>TQLineEdit</Title>
<FuncSynopsis>
	<FuncDef>int <Function>characterAt</Function></FuncDef>
	<ParamDef>int <Parameter>xpos</Parameter></ParamDef>
	<ParamDef>TQChar *<Parameter>chr</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes only the <Literal>xpos</Literal> parameter and returns the int
result and the <Literal>chr</Literal> value as a tuple.  (TQt v3+)
</Para>

<FuncSynopsis>
	<FuncDef>void <Function>del</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed <Literal>delChar</Literal> in Python.  (TQt v2+)
</Para>

<FuncSynopsis>
	<FuncDef>bool <Function>getSelection</Function></FuncDef>
	<ParamDef>int *<Parameter>start</Parameter></ParamDef>
	<ParamDef>int *<Parameter>end</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes no parameters and returns the bool result and the
<Literal>start</Literal> and <Literal>end</Literal> values as a tuple.
(TQt v3+)
</Para>
</Sect2>
%End


class TQLineEdit : TQFrame
{
%TypeHeaderCode
#include <tqlineedit.h>
%End

public:
	TQLineEdit(TQWidget * /TransferThis/,const char * = 0);
	TQLineEdit(const TQString &,TQWidget * /TransferThis/,const char * = 0);
	TQLineEdit(const TQString &,const TQString &,TQWidget * /TransferThis/,
		  const char * = 0);

	TQString text() const;

	TQString displayText() const;

	int maxLength() const;

	bool frame() const;

	enum EchoMode {
		Normal,
		NoEcho,
		Password
	};

	EchoMode echoMode() const;

	bool isReadOnly() const;

	const TQValidator *validator() const;

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

	int cursorPosition() const;
	// Obsolete.
	bool validateAndSet(const TQString &,int,int,int);

	int alignment() const;

	void cursorForward(bool,int = 1);
	void cursorBackward(bool,int = 1);
	void cursorWordForward(bool);
	void cursorWordBackward(bool);
	void backspace();
	void del() /PyName=delChar/;
	void home(bool);
	void end(bool);

	bool isModified() const;
	void clearModified();

	// Obsolete.
	bool edited() const;
	// Obsolete.
	void setEdited(bool);

	bool hasSelectedText() const;
	TQString selectedText() const;
	int selectionStart() const;

	bool isUndoAvailable() const;
	bool isRedoAvailable() const;

	bool dragEnabled() const;

	TQString inputMask() const;
	void setInputMask(const TQString &);
	bool hasAcceptableInput() const;

public slots:
	virtual void setText(const TQString &);
	virtual void selectAll();
	virtual void deselect();
	virtual void clearValidator();
	virtual void insert(const TQString &);
	virtual void clear();
	virtual void undo();
	virtual void redo();
	virtual void setMaxLength(int);
	virtual void setFrame(bool);
	virtual void setEchoMode(EchoMode);
	virtual void setReadOnly(bool);
	virtual void setValidator(const TQValidator *);
	virtual void setFont(const TQFont &);
	virtual void setPalette(const TQPalette &);
	virtual void setSelection(int,int);
	virtual void setCursorPosition(int);
	virtual void setAlignment(int);
%If (TQt_CLIPBOARD)
	virtual void cut();
	virtual void copy() const;
	virtual void paste();
%End
	virtual void setDragEnabled(bool);

signals:
	void textChanged(const TQString &);
	void returnPressed();
	void lostFocus();
	void selectionChanged();

protected:
	bool event(TQEvent *);
	void mousePressEvent(TQMouseEvent *);
	void mouseMoveEvent(TQMouseEvent *);
	void mouseReleaseEvent(TQMouseEvent *);
	void mouseDoubleClickEvent(TQMouseEvent *);
	void keyPressEvent(TQKeyEvent *);
	void imStartEvent(TQIMEvent *);
	void imComposeEvent(TQIMEvent *);
	void imEndEvent(TQIMEvent *);
	void focusInEvent(TQFocusEvent *);
	void focusOutEvent(TQFocusEvent *);
	void resizeEvent(TQResizeEvent *);
	void drawContents(TQPainter *);
%If (TQt_DRAGANDDROP)
	void dragEnterEvent(TQDragEnterEvent *);
	void dragMoveEvent(TQDragMoveEvent *);
	void dragLeaveEvent(TQDragLeaveEvent *);
	void dropEvent(TQDropEvent *);
%End
	void contextMenuEvent(TQContextMenuEvent *);
	virtual TQPopupMenu *createPopupMenu() /Factory/;
	void windowActivationChange(bool);

public:
	// These appeared in v3.0.2 but defined as incompatible 3.0 addons,
	// until v3.1.0.  v3.2.0 then defined them as internal and obsolete.
	void setPasswordChar(TQChar);
	TQChar passwordChar() const;

	// Obsolete.
	SIP_PYTUPLE characterAt(int) const;
%MethodCode
		int res;
		TQChar *chr;
 
		Py_BEGIN_ALLOW_THREADS
		chr = new TQChar();
		res = sipCpp -> characterAt(a0,chr);
		Py_END_ALLOW_THREADS
 
		sipRes = sipBuildResult(&sipIsErr,"(iB)",res,chr,sipClass_TQChar,NULL);
%End

	// Obsolete.
	bool getSelection(int *,int *);

private:
	TQLineEdit(const TQLineEdit &);
};
