|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 */ |
|
18 |
|
19 #ifndef ABSTRACTPAGE_H |
|
20 #define ABSTRACTPAGE_H |
|
21 |
|
22 #include <QWidget> |
|
23 #include <QPushButton> |
|
24 #include <QFont> |
|
25 #include <QGridLayout> |
|
26 #include <QComboBox> |
|
27 #include <QSignalMapper> |
|
28 |
|
29 class QPushButton; |
|
30 class QGroupBox; |
|
31 class QComboBox; |
|
32 class QLabel; |
|
33 class QToolBox; |
|
34 class QLineEdit; |
|
35 class QListWidget; |
|
36 class QCheckBox; |
|
37 class QSpinBox; |
|
38 class QTextEdit; |
|
39 class QRadioButton; |
|
40 class QTableView; |
|
41 class QTextBrowser; |
|
42 class QTableWidget; |
|
43 class QAction; |
|
44 class QDataWidgetMapper; |
|
45 class QAbstractItemModel; |
|
46 class QSettings; |
|
47 class QSlider; |
|
48 |
|
49 class AbstractPage : public QWidget |
|
50 { |
|
51 Q_OBJECT |
|
52 |
|
53 public: |
|
54 |
|
55 protected: |
|
56 AbstractPage(QWidget* parent = 0) { |
|
57 Q_UNUSED(parent); |
|
58 |
|
59 font14 = new QFont("MS Shell Dlg", 14); |
|
60 //setFocusPolicy(Qt::StrongFocus); |
|
61 } |
|
62 virtual ~AbstractPage() {}; |
|
63 |
|
64 QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
|
65 QPushButton* butt = new QPushButton(this); |
|
66 if (!iconed) { |
|
67 butt->setFont(*font14); |
|
68 butt->setText(btname); |
|
69 //butt->setStyleSheet("background-color: #0d0544"); |
|
70 } else { |
|
71 const QIcon& lp=QIcon(btname); |
|
72 QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
73 butt->setIcon(lp); |
|
74 butt->setFixedSize(sz); |
|
75 butt->setIconSize(sz); |
|
76 butt->setFlat(true); |
|
77 butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
78 } |
|
79 grid->addWidget(butt, wy, wx); |
|
80 return butt; |
|
81 }; |
|
82 |
|
83 QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
|
84 QPushButton* butt = new QPushButton(this); |
|
85 if (!iconed) { |
|
86 butt->setFont(*font14); |
|
87 butt->setText(btname); |
|
88 } else { |
|
89 const QIcon& lp=QIcon(btname); |
|
90 QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
91 butt->setIcon(lp); |
|
92 butt->setFixedSize(sz); |
|
93 butt->setIconSize(sz); |
|
94 butt->setFlat(true); |
|
95 butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
96 } |
|
97 grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
|
98 return butt; |
|
99 }; |
|
100 |
|
101 QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { |
|
102 QPushButton* butt = new QPushButton(this); |
|
103 if (!iconed) { |
|
104 butt->setFont(*font14); |
|
105 butt->setText(btname); |
|
106 } else { |
|
107 const QIcon& lp=QIcon(btname); |
|
108 QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
109 butt->setIcon(lp); |
|
110 butt->setFixedSize(sz); |
|
111 butt->setIconSize(sz); |
|
112 butt->setFlat(true); |
|
113 butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
114 } |
|
115 box->addWidget(butt, where); |
|
116 return butt; |
|
117 }; |
|
118 |
|
119 QFont * font14; |
|
120 }; |
|
121 |
|
122 #endif |
|
123 |