~ubuntu-branches/ubuntu/maverick/scidavis/maverick

« back to all changes in this revision

Viewing changes to scidavis/src/TextDialog.h

  • Committer: Bazaar Package Importer
  • Author(s): Ruben Molina
  • Date: 2009-09-06 11:34:04 UTC
  • Revision ID: james.westby@ubuntu.com-20090906113404-4awaey82l3686w4q
Tags: upstream-0.2.3
ImportĀ upstreamĀ versionĀ 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    File                 : TextDialog.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          : Text label/axis label options dialog
 
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 TEXTDLG_H
 
31
#define TEXTDLG_H
 
32
 
 
33
#include <QDialog>
 
34
class QGroupBox;
 
35
class QTextEdit;
 
36
class QTextCursor;
 
37
class QComboBox;
 
38
class QLabel;
 
39
class QSpinBox;
 
40
        
 
41
#include "ColorButton.h"
 
42
#include "TextFormatButtons.h"
 
43
 
 
44
//! Options dialog for text labels/axes labels
 
45
class TextDialog : public QDialog
 
46
 
47
        Q_OBJECT
 
48
 
 
49
public:
 
50
        //! Label types
 
51
        enum TextType{
 
52
                TextMarker, /*!< normal text label */ 
 
53
                AxisTitle   /*!< axis label */ 
 
54
        };
 
55
 
 
56
        //! Constructor
 
57
        /**
 
58
         * \param type text type (TextMarker | AxisTitle)
 
59
         * \param parent parent widget
 
60
         * \param fl window flags
 
61
         */
 
62
        TextDialog(TextType type, QWidget* parent = 0, Qt::WFlags fl = 0 );
 
63
        //! Destructor
 
64
        ~TextDialog(){};
 
65
 
 
66
        //! Return axis label alignment
 
67
        /**
 
68
         * \sa setAlignment()
 
69
         */
 
70
        int alignment();
 
71
        //! Return rotation angle (not yet implemented)
 
72
        int angle();
 
73
 
 
74
public slots:
 
75
        //! Set label background type
 
76
        /**
 
77
         * \param bkg label background type
 
78
         * 0 -> plain, no border
 
79
         * 1 -> with border
 
80
         * 2 -> border + shadow
 
81
         */
 
82
        void setBackgroundType(int bkg);
 
83
        //! Set rotation angle (not yet implemented)
 
84
        void setAngle(int angle);
 
85
        //! Set the background color to 'c'
 
86
        void setBackgroundColor(QColor c);
 
87
        //! Set the text color to 'c'
 
88
        void setTextColor(QColor c);
 
89
        //! Set the current font to 'fnt'
 
90
        void setFont(const QFont& fnt);
 
91
        //! Set the contents of the text editor box
 
92
        void setText(const QString & t);
 
93
        //! Set axis label alignment
 
94
        /**
 
95
         * \param align alignment (can be -1 for invalid,
 
96
         *  Qt::AlignHCenter, Qt::AlignLeft, or Qt::AlignRight)
 
97
         */
 
98
        void setAlignment(int align);
 
99
 
 
100
private slots:
 
101
        //! Let the user select another font
 
102
        void customFont();
 
103
        //! Let the user pick the background color
 
104
        void pickBackgroundColor();
 
105
        //! Let the user pick the text color
 
106
        void pickTextColor();
 
107
        //! Accept changes and close dialog
 
108
        void accept();
 
109
        //! Apply changes
 
110
        void apply();
 
111
        void setDefaultValues();
 
112
 
 
113
        void updateTransparency(int alpha);
 
114
 
 
115
signals:
 
116
        //! Emit all current values
 
117
        /**
 
118
         * \param text the label text
 
119
         * \param angle the rotation angle
 
120
         * \param bkg the background type
 
121
         * \param fnt the text font
 
122
         * \param textColor the text color
 
123
         * \param backgroundColor the backgroundcolor
 
124
         */
 
125
        void values(const QString& text, int angle, int bkg, const QFont& fnt, const QColor& textColor, const QColor& backgroundColor);
 
126
        
 
127
        //! Signal for axes labels: change text
 
128
        void changeText(const QString &);
 
129
        //! Signal for axes labels: change text color
 
130
        void changeColor(const QColor &);
 
131
        //! Signal for axes labels: change text alignment
 
132
        void changeAlignment(int);
 
133
        //! Signal for axes labels: change font
 
134
        void changeFont(const QFont &);
 
135
 
 
136
protected:
 
137
        //! current font
 
138
        QFont selectedFont;
 
139
        TextType textType;
 
140
 
 
141
        ColorButton *colorBtn, *backgroundBtn;
 
142
        QPushButton *buttonFont;
 
143
        QComboBox *backgroundBox;
 
144
        QPushButton *buttonOk;
 
145
        QPushButton *buttonCancel;
 
146
        QPushButton *buttonApply;
 
147
        QPushButton *buttonDefault;
 
148
        QComboBox *rotateBox;
 
149
        QTextEdit *textEditBox;
 
150
        QGroupBox *groupBox1, *groupBox2;
 
151
        QComboBox *alignmentBox;
 
152
        TextFormatButtons *formatButtons;
 
153
        QSpinBox *boxBackgroundTransparency;
 
154
};
 
155
 
 
156
#endif // TEXTDLG_H