author | nemo |
Mon, 14 Nov 2011 17:56:44 -0500 | |
changeset 6379 | ef4288298e57 |
parent 6200 | 6a4ace88d85a |
child 6477 | ad5741c252b9 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
4976 | 3 |
* Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 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 |
||
6200 | 19 |
/** |
20 |
* @file |
|
21 |
* @brief AbstractPage class definition |
|
22 |
*/ |
|
23 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
24 |
#ifndef ABSTRACTPAGE_H |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
25 |
#define ABSTRACTPAGE_H |
184 | 26 |
|
27 |
#include <QWidget> |
|
684 | 28 |
#include <QPushButton> |
29 |
#include <QFont> |
|
30 |
#include <QGridLayout> |
|
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
31 |
#include <QComboBox> |
1840 | 32 |
#include <QSignalMapper> |
184 | 33 |
|
34 |
class QPushButton; |
|
35 |
class QGroupBox; |
|
36 |
class QComboBox; |
|
37 |
class QLabel; |
|
38 |
class QToolBox; |
|
39 |
class QLineEdit; |
|
665 | 40 |
class QListWidget; |
41 |
class QCheckBox; |
|
42 |
class QSpinBox; |
|
43 |
class QTextEdit; |
|
44 |
class QRadioButton; |
|
45 |
class QTableView; |
|
1377 | 46 |
class QTextBrowser; |
1399 | 47 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
48 |
class QAction; |
1885 | 49 |
class QDataWidgetMapper; |
1887 | 50 |
class QAbstractItemModel; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2762
diff
changeset
|
51 |
class QSettings; |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
52 |
class QSlider; |
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
53 |
class QGridlayout; |
665 | 54 |
|
684 | 55 |
class AbstractPage : public QWidget |
56 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
57 |
Q_OBJECT |
1885 | 58 |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
59 |
signals: |
6200 | 60 |
/** |
61 |
* @brief This signal is emitted when going back to the previous is |
|
62 |
* requested - e.g. when the back-button is clicked. |
|
63 |
*/ |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
64 |
void goBack(); |
684 | 65 |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
66 |
protected: |
6200 | 67 |
/** |
68 |
* @brief Class constructor |
|
69 |
* |
|
70 |
* @param parent parent widget. |
|
71 |
*/ |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
72 |
AbstractPage(QWidget * parent = 0); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
73 |
|
6200 | 74 |
/// Class Destructor |
75 |
virtual ~AbstractPage() {}; |
|
76 |
||
77 |
/// Call this in the constructor of your subclass. |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
78 |
void initPage(); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
79 |
|
6200 | 80 |
/** |
81 |
* @brief Used during page construction. |
|
82 |
* You MUST implement this method in your subclass. |
|
83 |
* |
|
84 |
* Use it to define the main layout (no behavior) of the page. |
|
85 |
*/ |
|
86 |
virtual QLayout * bodyLayoutDefinition() = 0; |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
87 |
|
6200 | 88 |
/** |
89 |
* @brief Used during page construction. |
|
90 |
* You can implement this method in your subclass. |
|
91 |
* |
|
92 |
* Use it to define layout (not behavior) of the page's footer. |
|
93 |
*/ |
|
94 |
virtual QLayout * footerLayoutDefinition() { return NULL; }; |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
95 |
|
6200 | 96 |
/** |
97 |
* @brief Used during page construction. |
|
98 |
* You can implement this method in your subclass. |
|
99 |
* |
|
100 |
* This is a good place to connect signals within your page in order |
|
101 |
* to get the desired page behavior.<br /> |
|
102 |
* Keep in mind not to expose twidgets as public! |
|
103 |
* instead define a signal with a meaningful name and connect the widget |
|
104 |
* signals to your page signals |
|
105 |
*/ |
|
106 |
virtual void connectSignals() {}; |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
107 |
|
6200 | 108 |
/** |
109 |
* @brief Creates a default formatted button for this page. |
|
110 |
* |
|
111 |
* @param name name of the button - used as its text if not hasIcon. |
|
112 |
* @param hasIcon set to true if this is a picture button. |
|
113 |
* |
|
114 |
* @return the button. |
|
115 |
*/ |
|
116 |
QPushButton * formattedButton(const QString & name, bool hasIcon = false); |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
117 |
|
6200 | 118 |
/** |
119 |
* @brief Creates a default formatted button and adds it to a |
|
120 |
* grid layout at the location specified. |
|
121 |
* |
|
122 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
123 |
* @param grid pointer of the grid layout in which to insert the button. |
|
124 |
* @param row layout row index in which to insert the button. |
|
125 |
* @param column layout column index in which to insert the button. |
|
126 |
* @param rowSpan how many layout rows the button will span. |
|
127 |
* @param columnSpan how many layout columns the button will span. |
|
128 |
* @param hasIcon set to true if this is a picture button. |
|
129 |
* |
|
130 |
* @return the button. |
|
131 |
*/ |
|
132 |
QPushButton * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false); |
|
684 | 133 |
|
6200 | 134 |
/** |
135 |
* @brief Creates a default formatted button and adds it to a |
|
136 |
* grid layout at the location specified. |
|
137 |
* |
|
138 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
139 |
* @param box pointer of the box layout in which to insert the button. |
|
140 |
* @param where layout ndex in which to insert the button. |
|
141 |
* @param hasIcon set to true if this is a picture button. |
|
142 |
* |
|
143 |
* @return the button. |
|
144 |
*/ |
|
145 |
QPushButton * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false); |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
146 |
|
6200 | 147 |
/** |
148 |
* @brief Changes visibility of the back-button. |
|
149 |
* |
|
150 |
* @param visible set to true if the button should be visible. |
|
151 |
*/ |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
152 |
void setBackButtonVisible(bool visible = true); |
692 | 153 |
|
6200 | 154 |
QFont * font14; ///< used font |
684 | 155 |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
156 |
private: |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
157 |
|
6200 | 158 |
QPushButton * btnBack; ///< back button |
684 | 159 |
}; |
160 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
161 |
#endif |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
162 |