// This is the SIP interface definition for QLineEdit.
//
// 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>QLineEdit</Title>
<FuncSynopsis>
	<FuncDef>int <Function>characterAt</Function></FuncDef>
	<ParamDef>int <Parameter>xpos</Parameter></ParamDef>
	<ParamDef>QChar *<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.  (Qt v3+)
</Para>

<FuncSynopsis>
	<FuncDef>void <Function>del</Function></FuncDef>
	<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed <Literal>delChar</Literal> in Python.  (Qt 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.
(Qt v3+)
</Para>
</Sect2>
%End


%If (Qt_3_0_0 -)

class QLineEdit : QFrame
{
%TypeHeaderCode
#include <qlineedit.h>
%End

public:
	QLineEdit(QWidget * /TransferThis/,const char * = 0);
	QLineEdit(const QString &,QWidget * /TransferThis/,const char * = 0);
%If (Qt_3_2_0 -)
	QLineEdit(const QString &,const QString &,QWidget * /TransferThis/,
		  const char * = 0);
%End

	QString text() const;

	QString displayText() const;

	int maxLength() const;

	bool frame() const;

	enum EchoMode {
		Normal,
		NoEcho,
		Password
	};

	EchoMode echoMode() const;

	bool isReadOnly() const;

	const QValidator *validator() const;

	QSize sizeHint() const;
	QSize minimumSizeHint() const;

	int cursorPosition() const;
	// Obsolete.
	bool validateAndSet(const QString &,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);

%If (Qt_3_2_0 -)
	bool isModified() const;
	void clearModified();
%End

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

	bool hasSelectedText() const;
	QString selectedText() const;
%If (Qt_3_2_0 -)
	int selectionStart() const;
%End

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

	bool dragEnabled() const;

%If (Qt_3_2_0 -)
	QString inputMask() const;
	void setInputMask(const QString &);
	bool hasAcceptableInput() const;
%End

public slots:
	virtual void setText(const QString &);
	virtual void selectAll();
	virtual void deselect();
	virtual void clearValidator();
	virtual void insert(const QString &);
	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 QValidator *);
	virtual void setFont(const QFont &);
	virtual void setPalette(const QPalette &);
	virtual void setSelection(int,int);
	virtual void setCursorPosition(int);
	virtual void setAlignment(int);
%If (Qt_CLIPBOARD)
	virtual void cut();
	virtual void copy() const;
	virtual void paste();
%End
	virtual void setDragEnabled(bool);

signals:
	void textChanged(const QString &);
	void returnPressed();
%If (Qt_3_1_0 -)
	void lostFocus();
%End
	void selectionChanged();

protected:
	bool event(QEvent *);
	void mousePressEvent(QMouseEvent *);
	void mouseMoveEvent(QMouseEvent *);
	void mouseReleaseEvent(QMouseEvent *);
	void mouseDoubleClickEvent(QMouseEvent *);
	void keyPressEvent(QKeyEvent *);
	void imStartEvent(QIMEvent *);
	void imComposeEvent(QIMEvent *);
	void imEndEvent(QIMEvent *);
	void focusInEvent(QFocusEvent *);
	void focusOutEvent(QFocusEvent *);
	void resizeEvent(QResizeEvent *);
	void drawContents(QPainter *);
%If (Qt_DRAGANDDROP)
	void dragEnterEvent(QDragEnterEvent *);
	void dragMoveEvent(QDragMoveEvent *);
	void dragLeaveEvent(QDragLeaveEvent *);
	void dropEvent(QDropEvent *);
%End
	void contextMenuEvent(QContextMenuEvent *);
	virtual QPopupMenu *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.
%If (Qt_3_1_0 -)
	void setPasswordChar(QChar);
	QChar passwordChar() const;
%End

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

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

private:
	QLineEdit(const QLineEdit &);
};

%End


%If (- Qt_3_0_0)

class QLineEdit : QWidget
{
%TypeHeaderCode
#include <qlineedit.h>
%End

public:
%If (- Qt_2_00)
	QLineEdit(QWidget * /TransferThis/ = 0,const char * = 0);
%End
%If (Qt_2_00 -)
	QLineEdit(QWidget * /TransferThis/,const char * = 0);
	QLineEdit(const QString &,QWidget * /TransferThis/,const char * = 0);
%End

%If (- Qt_2_00)
	const char *text() const;
%End
%If (Qt_2_00 -)
	QString text() const;

	QString displayText() const;
%End

%If (- Qt_2_00)
	void setMaxLength(int);
%End
%If (Qt_2_00 -)
	virtual void setMaxLength(int);
%End
	int maxLength() const;

%If (- Qt_2_00)
	void setFrame(bool);
%End
%If (Qt_2_00 -)
	virtual void setFrame(bool);
%End
	bool frame() const;

	enum EchoMode {
		Normal,
		NoEcho,
		Password
	};

%If (- Qt_2_00)
	void setEchoMode(EchoMode);
%End
%If (Qt_2_00 -)
	virtual void setEchoMode(EchoMode);
%End
	EchoMode echoMode() const;

%If (Qt_2_1_0 -)
	void setReadOnly(bool);
%End
%If (Qt_2_1_0 -)
	bool isReadOnly() const;
%End

%If (- Qt_2_00)
	void setValidator(QValidator *);
	QValidator *validator() const;
%End
%If (Qt_2_00 -)
	virtual void setValidator(QValidator *);
%End
%If (Qt_2_00 -)
	const QValidator *validator() const;
%End

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

%If (- Qt_2_00)
	void setCursorPosition(int);
%End
%If (Qt_2_00 -)
	virtual void setCursorPosition(int);
%End
	int cursorPosition() const;
%If (- Qt_2_00)
	bool validateAndSet(const char *,int,int,int);
%End
%If (Qt_2_00 -)
	bool validateAndSet(const QString &,int,int,int);
%End

%If (Qt_2_00 -)
	int alignment() const;
%End

%If (Qt_2_00 -)
	void cursorLeft(bool,int = 1);
	void cursorRight(bool,int = 1);
	void cursorWordForward(bool);
	void cursorWordBackward(bool);
	void backspace();
	void del() /PyName=delChar/;
	void home(bool);
	void end(bool);

	void setEdited(bool);
	bool edited() const;
%End

%If (Qt_2_00 -)
	bool hasMarkedText() const;
	QString markedText() const;
%End

%If (Qt_CLIPBOARD)
	void cut();
	void copy() const;
	void paste();
%End

%If (- Qt_2_00)
	void setEnabled(bool);
	void setFont(const QFont &);
	void setPalette(const QPalette &);
	void setSelection(int,int);
%End
%If (Qt_2_00 -)
	virtual void setEnabled(bool);
	virtual void setFont(const QFont &);
	virtual void setPalette(const QPalette &);
	virtual void setSelection(int,int);

	void setAlignment(int);
%End

public slots:
%If (- Qt_2_00)
	void setText(const char *);
%End
%If (Qt_2_00 -)
	virtual void setText(const QString &);
%End
	void selectAll();
	void deselect();
	void clearValidator();
%If (- Qt_2_00)
	void insert(const char *);
%End
%If (Qt_2_00 -)
	void insert(const QString &);
%End
	void clear();

signals:
%If (- Qt_2_00)
	void textChanged(const char *);
%End
%If (Qt_2_00 -)
	void textChanged(const QString &);
%End
	void returnPressed();

protected:
%If (Qt_2_2_0 -)
	bool event(QEvent *);
%End
	void mousePressEvent(QMouseEvent *);
	void mouseMoveEvent(QMouseEvent *);
	void mouseReleaseEvent(QMouseEvent *);
	void mouseDoubleClickEvent(QMouseEvent *);
	void keyPressEvent(QKeyEvent *);
	void focusInEvent(QFocusEvent *);
	void focusOutEvent(QFocusEvent *);
	void paintEvent(QPaintEvent *);
	void resizeEvent(QResizeEvent *);
	void leaveEvent(QEvent *);
	void repaintArea(int,int);
%If (- Qt_2_00)
	void timerEvent(QTimerEvent *);
	bool event(QEvent *);
	bool hasMarkedText() const;
	QString markedText() const;
%End
%If (Qt_2_00 -)
%If (Qt_DRAGANDDROP)
	void dragEnterEvent(QDragEnterEvent *);
	void dropEvent(QDropEvent *);
%End
%End

private:
	QLineEdit(const QLineEdit &);
};

%End
