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: 00043 enum Buttons{Plot3D, AxisLabel, Legend, Equation, TexLegend}; 00044 00046 00050 TextFormatButtons(QTextEdit * textEdit, Buttons buttons = Plot3D, QWidget * parent=0); 00051 void setButtons(Buttons btns); 00052 00053 private: 00054 QTextEdit *connectedTextEdit; 00055 Buttons d_buttons; 00057 void formatText(const QString & prefix, const QString & postfix); 00058 void init(Buttons btns); 00059 00060 private slots: 00062 void addFraction(); 00064 void addSquareRoot(); 00066 void addSubscript(); 00068 void addSuperscript(); 00070 void addUnderline(); 00072 void addItalics(); 00074 void addBold(); 00076 void addCurve(); 00077 00079 void showLowerGreek(); 00081 void showUpperGreek(); 00083 void showMathSymbols(); 00085 void showArrowSymbols(); 00087 void addSymbol(const QString& letter); 00088 }; 00089 00090 #endif // TEXTFORMATBUTTONS_H