|
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 class QGridlayout; |
|
49 |
|
50 class AbstractPage : public QWidget |
|
51 { |
|
52 Q_OBJECT |
|
53 |
|
54 signals: |
|
55 void goBack(); |
|
56 |
|
57 protected: |
|
58 // constructor and virtual destructor |
|
59 AbstractPage(QWidget * parent = 0); |
|
60 |
|
61 // call this in the constructor of your subclass |
|
62 void initPage(); |
|
63 |
|
64 // the following methods are used during page construction |
|
65 |
|
66 // you MUST implement this method in your subclass |
|
67 // only define layout, not behavior in here |
|
68 virtual QLayout * bodyLayoutDefinition() = 0; |
|
69 |
|
70 // you CAN implement this method in your subclass |
|
71 virtual QLayout * footerLayoutDefinition() { return NULL; }; |
|
72 |
|
73 // you CAN but most likely want to implement this method in your subclass |
|
74 // keep in mind not to expose twidgets as public! |
|
75 // instead define a signal with a meaningful name and connect the widget |
|
76 // signals to your page signals |
|
77 virtual void connectSignals() {}; |
|
78 |
|
79 virtual ~AbstractPage() {}; |
|
80 |
|
81 QPushButton * formattedButton(const QString & btname, bool hasIcon = false); |
|
82 QPushButton * addButton(const QString & btname, QGridLayout * grid, int wy, int wx, bool hasIcon = false); |
|
83 QPushButton * addButton(const QString & btname, QGridLayout * grid, int wy, int wx, int rowSpan, int columnSpan, bool hasIcon = false); |
|
84 QPushButton * addButton(const QString & btname, QBoxLayout * box, int where, bool hasIcon = false); |
|
85 |
|
86 void setBackButtonVisible(bool visible = true); |
|
87 |
|
88 QFont * font14; |
|
89 |
|
90 private: |
|
91 |
|
92 QPushButton * btnBack; |
|
93 }; |
|
94 |
|
95 #endif |
|
96 |