src/qt3support/text/q3multilineedit.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the Qt3Support module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef Q3MULTILINEEDIT_H
00025 #define Q3MULTILINEEDIT_H
00026 
00027 #include <Qt3Support/q3textedit.h>
00028 
00029 QT_BEGIN_HEADER
00030 
00031 QT_MODULE(Qt3SupportLight)
00032 
00033 #ifndef QT_NO_MULTILINEEDIT
00034 
00035 class Q3MultiLineEditCommand;
00036 class QValidator;
00037 class Q3MultiLineEditData;
00038 
00039 class Q_COMPAT_EXPORT Q3MultiLineEdit : public Q3TextEdit
00040 {
00041     Q_OBJECT
00042     Q_PROPERTY(int numLines READ numLines)
00043     Q_PROPERTY(bool atBeginning READ atBeginning)
00044     Q_PROPERTY(bool atEnd READ atEnd)
00045     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
00046     Q_PROPERTY(bool edited READ edited WRITE setEdited DESIGNABLE false)
00047 
00048 public:
00049     Q3MultiLineEdit(QWidget* parent=0, const char* name=0);
00050     ~Q3MultiLineEdit();
00051 
00052     QString textLine(int line) const;
00053     int numLines() const;
00054 
00055     virtual void insertLine(const QString &s, int line = -1);
00056     virtual void insertAt(const QString &s, int line, int col) {
00057         insertAt(s, line, col, false);
00058     }
00059     virtual void insertAt(const QString &s, int line, int col, bool mark);
00060     virtual void removeLine(int line);
00061     virtual void setCursorPosition(int line, int col) {
00062         setCursorPosition(line, col, false);
00063     }
00064     virtual void setCursorPosition(int line, int col, bool mark);
00065     bool atBeginning() const;
00066     bool atEnd() const;
00067 
00068     void setAlignment(Qt::Alignment flags);
00069     Qt::Alignment alignment() const;
00070 
00071     void setEdited(bool);
00072     bool edited() const;
00073 
00074     bool hasMarkedText() const;
00075     QString markedText() const;
00076 
00077     void cursorWordForward(bool mark);
00078     void cursorWordBackward(bool mark);
00079 
00080     // noops
00081     bool autoUpdate() const { return true; }
00082     virtual void setAutoUpdate(bool) {}
00083 
00084     int totalWidth() const { return contentsWidth(); }
00085     int totalHeight() const { return contentsHeight(); }
00086 
00087     int maxLines() const { return QWIDGETSIZE_MAX; }
00088     void setMaxLines(int) {}
00089 
00090 public Q_SLOTS:
00091     void deselect() { selectAll(false); }
00092 
00093 protected:
00094     QPoint cursorPoint() const;
00095     virtual void insertAndMark(const QString&, bool mark);
00096     virtual void newLine();
00097     virtual void killLine();
00098     virtual void pageUp(bool mark=false);
00099     virtual void pageDown(bool mark=false);
00100     virtual void cursorLeft(bool mark=false, bool wrap = true);
00101     virtual void cursorRight(bool mark=false, bool wrap = true);
00102     virtual void cursorUp(bool mark=false);
00103     virtual void cursorDown(bool mark=false);
00104     virtual void backspace();
00105     virtual void home(bool mark=false);
00106     virtual void end(bool mark=false);
00107 
00108     bool getMarkedRegion(int *line1, int *col1, int *line2, int *col2) const;
00109     int lineLength(int row) const;
00110 
00111 private:
00112     Q_DISABLE_COPY(Q3MultiLineEdit)
00113 
00114     Q3MultiLineEditData *d;
00115 };
00116 
00117 #endif // QT_NO_MULTILINEEDIT
00118 
00119 QT_END_HEADER
00120 
00121 #endif // Q3MULTILINEEDIT_H

Generated on Thu Mar 15 11:58:32 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1