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); 00052 void toggleFontButtons(bool enable); 00053 00054 private: 00055 QTextEdit *connectedTextEdit; 00056 QPushButton *buttonCurve; 00057 QPushButton *buttonSubscript; 00058 QPushButton *buttonSuperscript; 00059 QPushButton *buttonLowerGreek; 00060 QPushButton *buttonUpperGreek; 00061 QPushButton *buttonMathSymbols; 00062 QPushButton *buttonArrowSymbols; 00063 QPushButton *buttonBold; 00064 QPushButton *buttonItalics; 00065 QPushButton *buttonUnderline; 00066 00068 void formatText(const QString & prefix, const QString & postfix); 00069 00070 private slots: 00072 void addSubscript(); 00074 void addSuperscript(); 00076 void addUnderline(); 00078 void addItalics(); 00080 void addBold(); 00082 void addCurve(); 00083 00085 void showLowerGreek(); 00087 void showUpperGreek(); 00089 void showMathSymbols(); 00091 void showArrowSymbols(); 00093 void addSymbol(const QString& letter); 00094 }; 00095 00096 #endif // TEXTFORMATBUTTONS_H