00001 /*************************************************************************** 00002 File : TextFormatButtons.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 : Widget with text format buttons (connected to a QTextEdit) 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 00030 #ifndef TEXTFORMATBUTTONS_H 00031 #define TEXTFORMATBUTTONS_H 00032 00033 #include <QWidget> 00034 class QTextEdit; 00035 class QPushButton; 00036 00038 class TextFormatButtons : public QWidget 00039 { 00040 Q_OBJECT 00041 00042 public: 00044 00048 TextFormatButtons(QTextEdit * textEdit, QWidget * parent=0); 00050 void toggleCurveButton(bool enable); 00051 00052 private: 00053 QTextEdit *connectedTextEdit; 00054 QPushButton *buttonCurve; 00055 QPushButton *buttonSubscript; 00056 QPushButton *buttonSuperscript; 00057 QPushButton *buttonLowerGreek; 00058 QPushButton *buttonUpperGreek; 00059 QPushButton *buttonMathSymbols; 00060 QPushButton *buttonArrowSymbols; 00061 QPushButton *buttonBold; 00062 QPushButton *buttonItalics; 00063 QPushButton *buttonUnderline; 00064 00066 void formatText(const QString & prefix, const QString & postfix); 00067 00068 private slots: 00070 void addSubscript(); 00072 void addSuperscript(); 00074 void addUnderline(); 00076 void addItalics(); 00078 void addBold(); 00080 void addCurve(); 00081 00083 void showLowerGreek(); 00085 void showUpperGreek(); 00087 void showMathSymbols(); 00089 void showArrowSymbols(); 00091 void addSymbol(const QString& letter); 00092 }; 00093 00094 #endif // TEXTFORMATBUTTONS_H