SciDAVis  1.D4
TextFormatButtons.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : TextFormatButtons.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7  Description : Widget with text format buttons (connected to a QTextEdit)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef TEXTFORMATBUTTONS_H
31 #define TEXTFORMATBUTTONS_H
32 
33 #include <QWidget>
34 class QTextEdit;
35 class QPushButton;
36 
38 class TextFormatButtons : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
44 
48  TextFormatButtons(QTextEdit * textEdit, QWidget * parent=0);
50  void toggleCurveButton(bool enable);
51 
52 private:
53  QTextEdit *connectedTextEdit;
54  QPushButton *buttonCurve;
55  QPushButton *buttonSubscript;
56  QPushButton *buttonSuperscript;
57  QPushButton *buttonLowerGreek;
58  QPushButton *buttonUpperGreek;
59  QPushButton *buttonMathSymbols;
60  QPushButton *buttonArrowSymbols;
61  QPushButton *buttonBold;
62  QPushButton *buttonItalics;
63  QPushButton *buttonUnderline;
64 
66  void formatText(const QString & prefix, const QString & postfix);
67 
68 private slots:
70  void addSubscript();
72  void addSuperscript();
74  void addUnderline();
76  void addItalics();
78  void addBold();
80  void addCurve();
81 
83  void showLowerGreek();
85  void showUpperGreek();
87  void showMathSymbols();
89  void showArrowSymbols();
91  void addSymbol(const QString& letter);
92 };
93 
94 #endif // TEXTFORMATBUTTONS_H