00001 /*************************************************************************** 00002 File : Note.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen 00006 Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net 00007 Description : Notes window class 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef NOTE_H 00030 #define NOTE_H 00031 00032 #include "MyWidget.h" 00033 #include "ScriptEdit.h" 00034 #include <qtextedit.h> 00035 00036 class ScriptingEnv; 00037 00043 class Note: public MyWidget 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 00049 Note(ScriptingEnv *env, const QString& label, QWidget* parent=0, const QString& name = QString(), Qt::WFlags f=0); 00050 ~Note(){}; 00051 00052 void init(ScriptingEnv *env); 00053 void setName(const QString& name); 00054 00055 public slots: 00056 QString saveToString(const QString &info, bool = false); 00057 void restore(const QStringList&); 00058 00059 QTextEdit* textWidget(){return (QTextEdit*)te;}; 00060 bool autoexec() const { return autoExec; } 00061 void setAutoexec(bool); 00062 void modifiedNote(); 00063 00064 // ScriptEdit methods 00065 QString text() { return te->text(); }; 00066 void setText(const QString &s) { te->setText(s); }; 00067 void print() { te->print(); }; 00068 void exportPDF(const QString& fileName){te->exportPDF(fileName);}; 00069 QString exportASCII(const QString &file=QString::null) { return te->exportASCII(file); }; 00070 QString importASCII(const QString &file=QString::null) { return te->importASCII(file); }; 00071 void execute() { te->execute(); }; 00072 void executeAll() { te->executeAll(); }; 00073 void evaluate() { te->evaluate(); }; 00074 void setDirPath(const QString& path){te->setDirPath(path);}; 00075 00076 signals: 00077 void dirPathChanged(const QString& path); 00078 00079 private: 00080 ScriptEdit *te; 00081 bool autoExec; 00082 }; 00083 00084 #endif