source: terepaima/terepaima-0.4.16/sources/formfieldwidgets.h

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2
3Copyright 2012-2013 Adam Reichold
4
5This file is part of qpdfview.
6
7qpdfview is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12qpdfview is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22#ifndef FORMFIELDWIDGETS_H
23#define FORMFIELDWIDGETS_H
24
25#include <QCheckBox>
26#include <QComboBox>
27#include <QLineEdit>
28#include <QListWidget>
29#include <QPlainTextEdit>
30#include <QRadioButton>
31
32class QMutex;
33
34namespace Poppler
35{
36class FormField;
37class FormFieldText;
38class FormFieldChoice;
39class FormFieldButton;
40}
41
42namespace qpdfview
43{
44
45class NormalTextFieldWidget : public QLineEdit
46{
47    Q_OBJECT
48
49public:
50    NormalTextFieldWidget(QMutex* mutex, Poppler::FormFieldText* formField, QWidget* parent = 0);
51
52signals:
53    void wasModified();
54
55protected:
56    void keyPressEvent(QKeyEvent* event);
57
58protected slots:
59    void on_textChanged(const QString& text);
60
61private:
62    Q_DISABLE_COPY(NormalTextFieldWidget)
63
64    QMutex* m_mutex;
65    Poppler::FormFieldText* m_formField;
66
67};
68
69class MultilineTextFieldWidget : public QPlainTextEdit
70{
71    Q_OBJECT
72
73public:
74    MultilineTextFieldWidget(QMutex* mutex, Poppler::FormFieldText* formField, QWidget* parent = 0);
75
76signals:
77    void wasModified();
78
79protected:
80    void keyPressEvent(QKeyEvent* event);
81
82protected slots:
83    void on_textChanged();
84
85private:
86    Q_DISABLE_COPY(MultilineTextFieldWidget)
87
88    QMutex* m_mutex;
89    Poppler::FormFieldText* m_formField;
90
91};
92
93class ComboBoxChoiceFieldWidget : public QComboBox
94{
95    Q_OBJECT
96
97public:
98    ComboBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent = 0);
99
100signals:
101    void wasModified();
102
103protected:
104    void keyPressEvent(QKeyEvent* event);
105
106    void showPopup();
107    void hidePopup();
108
109protected slots:
110    void on_currentIndexChanged(int index);
111    void on_currentTextChanged(const QString& text);
112
113private:
114    Q_DISABLE_COPY(ComboBoxChoiceFieldWidget)
115
116    QMutex* m_mutex;
117    Poppler::FormFieldChoice* m_formField;
118
119};
120
121class ListBoxChoiceFieldWidget : public QListWidget
122{
123    Q_OBJECT
124
125public:
126    ListBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent = 0);
127
128signals:
129    void wasModified();
130
131protected:
132    void keyPressEvent(QKeyEvent* event);
133
134protected slots:
135    void on_itemSelectionChanged();
136
137private:
138    Q_DISABLE_COPY(ListBoxChoiceFieldWidget)
139
140    QMutex* m_mutex;
141    Poppler::FormFieldChoice* m_formField;
142
143};
144
145class CheckBoxChoiceFieldWidget : public QCheckBox
146{
147    Q_OBJECT
148
149public:
150    CheckBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldButton* formField, QWidget* parent = 0);
151
152signals:
153    void wasModified();
154
155protected:
156    void keyPressEvent(QKeyEvent* event);
157
158protected slots:
159    void on_toggled(bool checked);
160
161protected slots:
162
163private:
164    Q_DISABLE_COPY(CheckBoxChoiceFieldWidget)
165
166    QMutex* m_mutex;
167    Poppler::FormFieldButton* m_formField;
168
169};
170
171class RadioChoiceFieldWidget : public QRadioButton
172{
173    Q_OBJECT
174
175public:
176    RadioChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldButton* formField, QWidget* parent = 0);
177    ~RadioChoiceFieldWidget();
178
179signals:
180    void wasModified();
181
182protected:
183    void keyPressEvent(QKeyEvent* event);
184
185protected slots:
186    void on_toggled(bool checked);
187
188private:
189    Q_DISABLE_COPY(RadioChoiceFieldWidget)
190
191    typedef QMap< QPair< QMutex*, int >, RadioChoiceFieldWidget* > Siblings;
192    static Siblings s_siblings;
193
194    QMutex* m_mutex;
195    Poppler::FormFieldButton* m_formField;
196
197};
198
199} // qpdfview
200
201#endif // FORMFIELDWIDGETS_H
Note: See TracBrowser for help on using the repository browser.