Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qseditor.h 1.1.5 edited 2006-02-23T15:39:57$ 00003 ** 00004 ** Copyright (C) 2001-2006 Trolltech AS. All rights reserved. 00005 ** 00006 ** This file is part of the Qt Script for Applications framework (QSA). 00007 ** 00008 ** This file may be distributed and/or modified under the terms of the 00009 ** GNU General Public License version 2 as published by the Free Software 00010 ** Foundation and appearing in the file LICENSE.GPL included in the 00011 ** packaging of this file. 00012 ** 00013 ** Licensees holding a valid Qt Script for Applications license may use 00014 ** this file in accordance with the Qt Script for Applications License 00015 ** Agreement provided with the Software. 00016 ** 00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00019 ** 00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00021 ** information about QSA Commercial License Agreements. 00022 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00023 ** 00024 ** Contact info@trolltech.com if any conditions of this licensing are 00025 ** not clear to you. 00026 ** 00027 *****************************************************************************/ 00028 00029 #ifndef QSEDITOR_H 00030 #define QSEDITOR_H 00031 00032 #include <qsaglobal.h> 00033 #include <qwidget.h> 00034 00035 class QSAEditorInterface; 00036 class QTextEdit; 00037 class QSInterpreter; 00038 class QSProject; 00039 class QSScript; 00040 class QSEditorPrivate; 00041 00042 class QSA_EXPORT QSEditor : public QWidget 00043 { 00044 Q_OBJECT 00045 public: 00046 QSEditor(QWidget *parent, const char *name = 0); 00047 ~QSEditor(); 00048 00049 bool setScript(QSScript *source); 00050 QSScript *script() const; 00051 00052 bool setInterpreter(QSInterpreter *interpreter, QObject *context = 0); 00053 QSInterpreter *interpreter() const; 00054 00055 void setText(const QString &text); 00056 QString text() const; 00057 00058 bool isModified() const; 00059 void commit(); 00060 void revert(); 00061 00062 QSAEditorInterface *iface() const; 00063 00064 public: 00065 bool isActive() const { 00066 return active; 00067 } 00068 00069 bool isUndoAvailable() const; 00070 bool isRedoAvailable() const; 00071 void undo(); 00072 void redo(); 00073 void cut(); 00074 void copy(); 00075 void paste(); 00076 void selectAll(); 00077 bool find(const QString &expr, bool cs, bool wo, bool forward, bool startAtCursor); 00078 bool replace(const QString &find, const QString &replace, bool cs, bool wo, 00079 bool forward, bool startAtCursor, bool replaceAll); 00080 void gotoLine(int line); 00081 void indent(); 00082 void readSettings(); 00083 00084 void setErrorMark(int line); 00085 void removeErrorMark(); 00086 00087 QSize sizeHint() const; 00088 QSize minimumSizeHint() const; 00089 00090 QTextEdit *textEdit() const; 00091 QSProject *project() const; 00092 00093 signals: 00094 void textChanged(); 00095 00096 private slots: 00097 void scriptChanged(); 00098 void scriptDestroyed(); 00099 void modifyEditor(); 00100 00101 private: 00102 bool activate(); 00103 void release(); 00104 00105 protected: 00106 void resizeEvent(QResizeEvent *e); 00107 bool eventFilter(QObject *o, QEvent *e); 00108 00109 private: 00110 void init(); 00111 00112 private: 00113 QSEditorPrivate *d; 00114 uint active: 1; 00115 }; 00116 00117 #endif