Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** $Id: qt/qlineedit.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QLineEdit widget class 00005 ** 00006 ** Created : 941011 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the widgets module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QLINEEDIT_H 00039 #define QLINEEDIT_H 00040 00041 struct QLineEditPrivate; 00042 00043 class QValidator; 00044 class QPopupMenu; 00045 00046 #ifndef QT_H 00047 #include "qframe.h" 00048 #include "qstring.h" 00049 #endif // QT_H 00050 00051 #ifndef QT_NO_LINEEDIT 00052 00053 class QTextParagraph; 00054 class QTextCursor; 00055 00056 class Q_EXPORT QLineEdit : public QFrame 00057 { 00058 Q_OBJECT 00059 Q_ENUMS( EchoMode ) 00060 Q_PROPERTY( QString text READ text WRITE setText ) 00061 Q_PROPERTY( int maxLength READ maxLength WRITE setMaxLength ) 00062 Q_PROPERTY( bool frame READ frame WRITE setFrame ) 00063 Q_PROPERTY( EchoMode echoMode READ echoMode WRITE setEchoMode ) 00064 Q_PROPERTY( QString displayText READ displayText ) 00065 Q_PROPERTY( int cursorPosition READ cursorPosition WRITE setCursorPosition ) 00066 Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) 00067 Q_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false ) 00068 Q_PROPERTY( bool modified READ isModified ) 00069 Q_PROPERTY( bool hasMarkedText READ hasMarkedText DESIGNABLE false ) 00070 Q_PROPERTY( bool hasSelectedText READ hasSelectedText ) 00071 Q_PROPERTY( QString markedText READ markedText DESIGNABLE false ) 00072 Q_PROPERTY( QString selectedText READ selectedText ) 00073 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) 00074 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) 00075 Q_PROPERTY( bool undoAvailable READ isUndoAvailable ) 00076 Q_PROPERTY( bool redoAvailable READ isRedoAvailable ) 00077 Q_PROPERTY( QString inputMask READ inputMask WRITE setInputMask ) 00078 Q_PROPERTY( bool acceptableInput READ hasAcceptableInput ) 00079 00080 public: 00081 QLineEdit( QWidget* parent, const char* name=0 ); 00082 QLineEdit( const QString &, QWidget* parent, const char* name=0 ); 00083 QLineEdit( const QString &, const QString &, QWidget* parent, const char* name=0 ); 00084 ~QLineEdit(); 00085 00086 QString text() const; 00087 00088 QString displayText() const; 00089 00090 int maxLength() const; 00091 00092 bool frame() const; 00093 00094 enum EchoMode { Normal, NoEcho, Password }; 00095 EchoMode echoMode() const; 00096 00097 bool isReadOnly() const; 00098 00099 const QValidator * validator() const; 00100 00101 QSize sizeHint() const; 00102 QSize minimumSizeHint() const; 00103 00104 int cursorPosition() const; 00105 bool validateAndSet( const QString &, int, int, int ); // obsolete 00106 00107 int alignment() const; 00108 00109 #ifndef QT_NO_COMPAT 00110 void cursorLeft( bool mark, int steps = 1 ) { cursorForward( mark, -steps ); } 00111 void cursorRight( bool mark, int steps = 1 ) { cursorForward( mark, steps ); } 00112 #endif 00113 void cursorForward( bool mark, int steps = 1 ); 00114 void cursorBackward( bool mark, int steps = 1 ); 00115 void cursorWordForward( bool mark ); 00116 void cursorWordBackward( bool mark ); 00117 void backspace(); 00118 void del(); 00119 void home( bool mark ); 00120 void end( bool mark ); 00121 00122 bool isModified() const; 00123 void clearModified(); 00124 00125 bool edited() const; // obsolete, use isModified() 00126 void setEdited( bool ); // obsolete, use clearModified() 00127 00128 bool hasSelectedText() const; 00129 QString selectedText() const; 00130 int selectionStart() const; 00131 00132 bool isUndoAvailable() const; 00133 bool isRedoAvailable() const; 00134 00135 #ifndef QT_NO_COMPAT 00136 bool hasMarkedText() const { return hasSelectedText(); } 00137 QString markedText() const { return selectedText(); } 00138 #endif 00139 00140 bool dragEnabled() const; 00141 00142 QString inputMask() const; 00143 void setInputMask( const QString &inputMask ); 00144 bool hasAcceptableInput() const; 00145 00146 public slots: 00147 virtual void setText( const QString &); 00148 virtual void selectAll(); 00149 virtual void deselect(); 00150 virtual void clearValidator(); 00151 virtual void insert( const QString &); 00152 virtual void clear(); 00153 virtual void undo(); 00154 virtual void redo(); 00155 virtual void setMaxLength( int ); 00156 virtual void setFrame( bool ); 00157 virtual void setEchoMode( EchoMode ); 00158 virtual void setReadOnly( bool ); 00159 virtual void setValidator( const QValidator * ); 00160 virtual void setFont( const QFont & ); 00161 virtual void setPalette( const QPalette & ); 00162 virtual void setSelection( int, int ); 00163 virtual void setCursorPosition( int ); 00164 virtual void setAlignment( int flag ); 00165 #ifndef QT_NO_CLIPBOARD 00166 virtual void cut(); 00167 virtual void copy() const; 00168 virtual void paste(); 00169 #endif 00170 virtual void setDragEnabled( bool b ); 00171 00172 signals: 00173 void textChanged( const QString &); 00174 void returnPressed(); 00175 void lostFocus(); 00176 void selectionChanged(); 00177 00178 protected: 00179 bool event( QEvent * ); 00180 void mousePressEvent( QMouseEvent * ); 00181 void mouseMoveEvent( QMouseEvent * ); 00182 void mouseReleaseEvent( QMouseEvent * ); 00183 void mouseDoubleClickEvent( QMouseEvent * ); 00184 void keyPressEvent( QKeyEvent * ); 00185 void imStartEvent( QIMEvent * ); 00186 void imComposeEvent( QIMEvent * ); 00187 void imEndEvent( QIMEvent * ); 00188 void focusInEvent( QFocusEvent * ); 00189 void focusOutEvent( QFocusEvent * ); 00190 void resizeEvent( QResizeEvent * ); 00191 void drawContents( QPainter * ); 00192 #ifndef QT_NO_DRAGANDDROP 00193 void dragEnterEvent( QDragEnterEvent * ); 00194 void dragMoveEvent( QDragMoveEvent *e ); 00195 void dragLeaveEvent( QDragLeaveEvent *e ); 00196 void dropEvent( QDropEvent * ); 00197 #endif 00198 void contextMenuEvent( QContextMenuEvent * ); 00199 virtual QPopupMenu *createPopupMenu(); 00200 void windowActivationChange( bool ); 00201 #ifndef QT_NO_COMPAT 00202 void repaintArea( int, int ) { update(); } 00203 #endif 00204 00205 private slots: 00206 void clipboardChanged(); 00207 00208 public: 00209 void setPasswordChar( QChar c ); // internal obsolete 00210 QChar passwordChar() const; // obsolete internal 00211 int characterAt( int, QChar* ) const; // obsolete 00212 bool getSelection( int *, int * ); // obsolete 00213 00214 private: 00215 friend struct QLineEditPrivate; 00216 QLineEditPrivate * d; 00217 00218 private: // Disabled copy constructor and operator= 00219 #if defined(Q_DISABLE_COPY) 00220 QLineEdit( const QLineEdit & ); 00221 QLineEdit &operator=( const QLineEdit & ); 00222 #endif 00223 }; 00224 00225 00226 #endif // QT_NO_LINEEDIT 00227 00228 #endif // QLINEEDIT_H