Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved. 00003 ** 00004 ** This file is part of Qt Designer. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00012 ** licenses may use this file in accordance with the Qt Commercial License 00013 ** Agreement provided with the Software. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00019 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00020 ** information about Qt Commercial License Agreements. 00021 ** 00022 ** Contact info@trolltech.com if any conditions of this licensing are 00023 ** not clear to you. 00024 ** 00025 **********************************************************************/ 00026 00027 #ifndef EDITOR_H 00028 #define EDITOR_H 00029 00030 #include <qtextedit.h> 00031 00032 struct Config; 00033 class ParenMatcher; 00034 class EditorCompletion; 00035 class EditorBrowser; 00036 class QAccel; 00037 00038 class Editor : public QTextEdit 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 enum Selection { 00044 Error = 3, 00045 Step = 4 00046 }; 00047 00048 Editor( const QString &fn, QWidget *parent, const char *name ); 00049 ~Editor(); 00050 virtual void load( const QString &fn ); 00051 virtual void save( const QString &fn ); 00052 QTextDocument *document() const { return QTextEdit::document(); } 00053 void placeCursor( const QPoint &p, QTextCursor *c ) { QTextEdit::placeCursor( p, c ); } 00054 void setDocument( QTextDocument *doc ) { QTextEdit::setDocument( doc ); } 00055 QTextCursor *textCursor() const { return QTextEdit::textCursor(); } 00056 void repaintChanged() { QTextEdit::repaintChanged(); } 00057 00058 virtual EditorCompletion *completionManager() { return 0; } 00059 virtual EditorBrowser *browserManager() { return 0; } 00060 virtual void configChanged(); 00061 00062 Config *config() { return cfg; } 00063 00064 void setErrorSelection( int line ); 00065 void setStepSelection( int line ); 00066 void clearStepSelection(); 00067 void clearSelections(); 00068 00069 virtual bool supportsErrors() const { return TRUE; } 00070 virtual bool supportsBreakPoints() const { return TRUE; } 00071 virtual void makeFunctionVisible( QTextParagraph * ) {} 00072 00073 void drawCursor( bool b ) { QTextEdit::drawCursor( b ); } 00074 00075 QPopupMenu *createPopupMenu( const QPoint &p ); 00076 bool eventFilter( QObject *o, QEvent *e ); 00077 00078 void setEditable( bool b ) { editable = b; } 00079 00080 protected: 00081 void doKeyboardAction( KeyboardAction action ); 00082 void keyPressEvent( QKeyEvent *e ); 00083 00084 signals: 00085 void clearErrorMarker(); 00086 void intervalChanged(); 00087 00088 private slots: 00089 void cursorPosChanged( QTextCursor *c ); 00090 void doChangeInterval(); 00091 void commentSelection(); 00092 void uncommentSelection(); 00093 00094 protected: 00095 ParenMatcher *parenMatcher; 00096 QString filename; 00097 Config *cfg; 00098 bool hasError; 00099 QAccel *accelComment, *accelUncomment; 00100 bool editable; 00101 00102 }; 00103 00104 #endif