home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qmultilineedit.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  134 lines

  1. /**********************************************************************
  2. ** $Id:  qt/qmultilineedit.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QMultiLineEdit widget class
  5. **
  6. ** Created : 961005
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QMULTILINEEDIT_H
  39. #define QMULTILINEEDIT_H
  40.  
  41. #ifndef QT_H
  42. #include "qtextedit.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_MULTILINEEDIT
  46.  
  47. class QMultiLineEditCommand;
  48. class QValidator;
  49. class QMultiLineEditData;
  50.  
  51. class Q_EXPORT QMultiLineEdit : public QTextEdit
  52. {
  53.     Q_OBJECT
  54.     Q_PROPERTY( int numLines READ numLines )
  55.     Q_PROPERTY( bool atBeginning READ atBeginning )
  56.     Q_PROPERTY( bool atEnd READ atEnd )
  57.     Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment )
  58.     Q_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false )
  59.  
  60. public:
  61.     QMultiLineEdit( QWidget* parent=0, const char* name=0 );
  62.     ~QMultiLineEdit();
  63.  
  64.     QString textLine( int line ) const;
  65.     int numLines() const;
  66.  
  67.     virtual void insertLine( const QString &s, int line = -1 );
  68.     virtual void insertAt( const QString &s, int line, int col, bool mark = FALSE );
  69.     virtual void removeLine( int line );
  70.  
  71.     virtual void setCursorPosition( int line, int col, bool mark = FALSE );
  72.     bool atBeginning() const;
  73.     bool atEnd() const;
  74.  
  75.     void setAlignment( int flags );
  76.     int alignment() const;
  77.  
  78.     void setEdited( bool );
  79.     bool edited() const;
  80.  
  81.     bool hasMarkedText() const;
  82.     QString markedText() const;
  83.  
  84.     void cursorWordForward( bool mark );
  85.     void cursorWordBackward( bool mark );
  86.  
  87.     // noops
  88.     bool autoUpdate() const { return TRUE; }
  89.     virtual void setAutoUpdate( bool ) {}
  90.  
  91.     int totalWidth() const { return contentsWidth(); }
  92.     int totalHeight() const { return contentsHeight(); }
  93.  
  94.     int maxLines() const { return QWIDGETSIZE_MAX; }
  95.     void setMaxLines( int ) {}
  96.  
  97. public slots:
  98.     void deselect() { selectAll( FALSE ); }
  99.  
  100. protected:
  101.     QPoint    cursorPoint() const;
  102.  
  103. protected:
  104.     virtual void insertAndMark( const QString&, bool mark );
  105.     virtual void newLine();
  106.     virtual void killLine();
  107.     virtual void pageUp( bool mark=FALSE );
  108.     virtual void pageDown( bool mark=FALSE );
  109.     virtual void cursorLeft( bool mark=FALSE, bool wrap = TRUE );
  110.     virtual void cursorRight( bool mark=FALSE, bool wrap = TRUE );
  111.     virtual void cursorUp( bool mark=FALSE );
  112.     virtual void cursorDown( bool mark=FALSE );
  113.     virtual void backspace();
  114.     virtual void home( bool mark=FALSE );
  115.     virtual void end( bool mark=FALSE );
  116.  
  117.     bool getMarkedRegion( int *line1, int *col1,
  118.               int *line2, int *col2 ) const;
  119.     int lineLength( int row ) const;
  120.  
  121. private:
  122.     QMultiLineEditData *d;
  123.  
  124. private:    // Disabled copy constructor and operator=
  125. #if defined(Q_DISABLE_COPY)
  126.     QMultiLineEdit( const QMultiLineEdit & );
  127.     QMultiLineEdit &operator=( const QMultiLineEdit & );
  128. #endif
  129. };
  130.  
  131. #endif // QT_NO_MULTILINEEDIT
  132.  
  133. #endif // QMULTILINED_H
  134.