00001 /*************************************************************************** 00002 File : TextDialog.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 : Text label/axis label options dialog 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 TEXTDLG_H 00031 #define TEXTDLG_H 00032 00033 #include <QDialog> 00034 class QGroupBox; 00035 class QTextEdit; 00036 class QTextCursor; 00037 class QComboBox; 00038 class QLabel; 00039 class QSpinBox; 00040 class LegendWidget; 00041 00042 #include "ColorButton.h" 00043 #include "TextFormatButtons.h" 00044 00046 class TextDialog : public QDialog 00047 { 00048 Q_OBJECT 00049 00050 public: 00052 enum TextType{ 00053 TextMarker, 00054 AxisTitle 00055 }; 00056 00058 00063 TextDialog(TextType type, QWidget* parent = 0, Qt::WFlags fl = 0 ); 00065 ~TextDialog(){}; 00066 00068 00071 int alignment(); 00073 int angle(); 00074 00075 public slots: 00077 00083 void setBackgroundType(int bkg); 00085 void setAngle(int angle); 00087 void setBackgroundColor(QColor c); 00089 void setTextColor(QColor c); 00091 void setFont(const QFont& fnt); 00093 void setText(const QString & t); 00095 00099 void setAlignment(int align); 00100 void setLegendWidget(LegendWidget *); 00101 00102 private slots: 00104 void customFont(); 00106 void accept(); 00108 void apply(); 00109 void setDefaultValues(); 00110 00111 void updateTransparency(int alpha); 00112 00113 signals: 00115 void changeText(const QString &); 00117 void changeColor(const QColor &); 00119 void changeAlignment(int); 00121 void changeFont(const QFont &); 00122 00123 protected: 00125 QFont selectedFont; 00126 TextType textType; 00127 00128 ColorButton *colorBtn, *backgroundBtn; 00129 QPushButton *buttonFont; 00130 QComboBox *backgroundBox; 00131 QPushButton *buttonOk; 00132 QPushButton *buttonCancel; 00133 QPushButton *buttonApply; 00134 QPushButton *buttonDefault; 00135 QComboBox *rotateBox; 00136 QTextEdit *textEditBox; 00137 QGroupBox *groupBox1, *groupBox2; 00138 QComboBox *alignmentBox; 00139 TextFormatButtons *formatButtons; 00140 QSpinBox *boxBackgroundTransparency; 00141 00142 LegendWidget *d_legend; 00143 }; 00144 00145 #endif // TEXTDLG_H