Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** $Id: qt/qmultilineedit.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QMultiLineEdit widget class 00005 ** 00006 ** Created : 961005 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 QMULTILINEEDIT_H 00039 #define QMULTILINEEDIT_H 00040 00041 #ifndef QT_H 00042 #include "qtextedit.h" 00043 #endif // QT_H 00044 00045 #ifndef QT_NO_MULTILINEEDIT 00046 00047 class QMultiLineEditCommand; 00048 class QValidator; 00049 class QMultiLineEditData; 00050 00051 class Q_EXPORT QMultiLineEdit : public QTextEdit 00052 { 00053 Q_OBJECT 00054 Q_PROPERTY( int numLines READ numLines ) 00055 Q_PROPERTY( bool atBeginning READ atBeginning ) 00056 Q_PROPERTY( bool atEnd READ atEnd ) 00057 Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) 00058 Q_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false ) 00059 00060 public: 00061 QMultiLineEdit( QWidget* parent=0, const char* name=0 ); 00062 ~QMultiLineEdit(); 00063 00064 QString textLine( int line ) const; 00065 int numLines() const; 00066 00067 virtual void insertLine( const QString &s, int line = -1 ); 00068 virtual void insertAt( const QString &s, int line, int col ) { 00069 insertAt( s, line, col, FALSE ); 00070 } 00071 virtual void insertAt( const QString &s, int line, int col, bool mark ); 00072 virtual void removeLine( int line ); 00073 virtual void setCursorPosition( int line, int col ) { 00074 setCursorPosition( line, col, FALSE ); 00075 } 00076 virtual void setCursorPosition( int line, int col, bool mark ); 00077 bool atBeginning() const; 00078 bool atEnd() const; 00079 00080 void setAlignment( int flags ); 00081 int alignment() const; 00082 00083 void setEdited( bool ); 00084 bool edited() const; 00085 00086 bool hasMarkedText() const; 00087 QString markedText() const; 00088 00089 void cursorWordForward( bool mark ); 00090 void cursorWordBackward( bool mark ); 00091 00092 // noops 00093 bool autoUpdate() const { return TRUE; } 00094 virtual void setAutoUpdate( bool ) {} 00095 00096 int totalWidth() const { return contentsWidth(); } 00097 int totalHeight() const { return contentsHeight(); } 00098 00099 int maxLines() const { return QWIDGETSIZE_MAX; } 00100 void setMaxLines( int ) {} 00101 00102 public slots: 00103 void deselect() { selectAll( FALSE ); } 00104 00105 protected: 00106 QPoint cursorPoint() const; 00107 00108 protected: 00109 virtual void insertAndMark( const QString&, bool mark ); 00110 virtual void newLine(); 00111 virtual void killLine(); 00112 virtual void pageUp( bool mark=FALSE ); 00113 virtual void pageDown( bool mark=FALSE ); 00114 virtual void cursorLeft( bool mark=FALSE, bool wrap = TRUE ); 00115 virtual void cursorRight( bool mark=FALSE, bool wrap = TRUE ); 00116 virtual void cursorUp( bool mark=FALSE ); 00117 virtual void cursorDown( bool mark=FALSE ); 00118 virtual void backspace(); 00119 virtual void home( bool mark=FALSE ); 00120 virtual void end( bool mark=FALSE ); 00121 00122 bool getMarkedRegion( int *line1, int *col1, 00123 int *line2, int *col2 ) const; 00124 int lineLength( int row ) const; 00125 00126 private: 00127 QMultiLineEditData *d; 00128 00129 private: // Disabled copy constructor and operator= 00130 #if defined(Q_DISABLE_COPY) 00131 QMultiLineEdit( const QMultiLineEdit & ); 00132 QMultiLineEdit &operator=( const QMultiLineEdit & ); 00133 #endif 00134 }; 00135 00136 #endif // QT_NO_MULTILINEEDIT 00137 00138 #endif // QMULTILINED_H