KDevelop API Documentation

qeditor.h

Go to the documentation of this file.
00001 /* $Id: qeditor.h,v 1.19 2003/01/21 19:48:17 cunz Exp $
00002  *
00003  *  This file is part of Klint
00004  *  Copyright (C) 2002 Roberto Raggi (roberto@kdevelop.org)
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; see the file COPYING.  If not, write to
00018  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  *  Boston, MA 02111-1307, USA.
00020  *
00021  */
00022 
00023 /**********************************************************************
00024 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00025 **
00026 ** This file is part of Qt Designer.
00027 **
00028 ** This file may be distributed and/or modified under the terms of the
00029 ** GNU General Public License version 2 as published by the Free Software
00030 ** Foundation and appearing in the file COPYING included in the
00031 ** packaging of this file.
00032 **
00033 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00034 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00035 **
00036 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00037 **
00038 ** Contact info@trolltech.com if any conditions of this licensing are
00039 ** not clear to you.
00040 **
00041 **********************************************************************/
00042 
00043 #ifndef qeditor_h
00044 #define qeditor_h
00045 
00046 
00047 #if defined(HAVE_KTEXTEDIT)
00048 #  include <ktextedit.h>
00049 #else
00050 #  include <qtextedit.h>
00051 #  define KTextEdit QTextEdit
00052 #endif
00053 
00054 #include <qstringlist.h>
00055 #include <qptrlist.h>
00056 
00057 class ParenMatcher;
00058 class QPopupMenu;
00059 class QSourceColorizer;
00060 class QEditorIndenter;
00061 class QEditorKey;
00062 
00063 class QEditor: public KTextEdit
00064 {
00065     Q_OBJECT
00066 public:
00067     QEditor( QWidget* parent=0, const char* name=0 );
00068     virtual ~QEditor();
00069 
00070     bool isRecording() const { return m_recording; }
00071     void setIsRecording( bool b ) { m_recording = b; }
00072 
00073     QEditorIndenter* indenter() const;
00074 
00075     QTextCursor* textCursor() const;
00076 
00077     QTextDocument* document() const;
00078     void setDocument( QTextDocument*);
00079 
00080     void drawCursor( bool visible );
00081     void updateStyles();
00082     void repaintChanged();
00083 
00084     virtual void zoomIn();
00085     virtual void zoomOut();
00086 
00087     virtual QString electricKeys() const { return m_electricKeys; }
00088     virtual void setElectricKeys( const QString& keys ) { m_electricKeys = keys; }
00089 
00090     virtual int tabStop() const;
00091     virtual void setTabStop( int );
00092 
00093     virtual bool tabIndentEnabled() const { return m_tabIndent; }
00094     virtual void setTabIndentEnabled( bool b ) { m_tabIndent = b; }
00095 
00096     virtual bool backspaceIndentEnabled() const { return m_backspaceIndent; }
00097     virtual void setBackspaceIndentEnabled( bool b ) { m_backspaceIndent = b; }
00098 
00099     virtual bool replace( const QString &find, const QString &replace,
00100               bool cs, bool wo, bool forward, bool startAtCursor,
00101               bool replaceAll );
00102     virtual QString textLine( uint ) const;
00103 
00104     virtual void setLanguage( const QString& );
00105     virtual QString language() const;
00106 
00107     virtual void setText( const QString& );
00108 
00109     virtual int level( int ) const;
00110     virtual void setLevel( int, int );
00111 
00112     virtual void setApplicationMenu( QPopupMenu* menu ) { m_applicationMenu = menu; }
00113     virtual QPopupMenu* createPopupMenu( const QPoint& );
00114     
00115     virtual void indent();
00116 
00117     QSourceColorizer* colorizer() const;
00118     
00119 signals:
00120     void parsed();
00121     void ensureTextIsVisible( QTextParagraph* );
00122 
00123 public slots:
00124     void doGotoLine( int line );
00125     virtual void configChanged();
00126     virtual void refresh();
00127     virtual void startMacro();
00128     virtual void stopMacro();
00129     virtual void executeMacro();
00130 
00131 private slots:
00132     void doMatch( QTextCursor* );
00133     void slotCursorPositionChanged( int, int );
00134 
00135 protected:
00136     virtual bool event( QEvent* );
00137     virtual void keyPressEvent( QKeyEvent* );
00138     virtual void backspaceIndent( QKeyEvent* );
00139     int backspace_indentation( const QString &s );
00140     int backspace_indentForLine( int line );
00141     void contentsMouseDoubleClickEvent( QMouseEvent *e );
00142     bool isDelimiter(const QChar& c);
00143 
00144 private:
00145     ParenMatcher* parenMatcher;
00146     bool m_tabIndent;
00147     bool m_completion;
00148     bool m_backspaceIndent;
00149     QString m_language;
00150     int m_currentLine;
00151     int m_tabStop;
00152     QString m_electricKeys;
00153     QPopupMenu* m_applicationMenu;
00154     bool m_recording;
00155     QPtrList<QEditorKey> m_keys;
00156 };
00157 
00158 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:24 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003