author | koda |
Mon, 09 May 2011 16:56:29 +0200 | |
changeset 5204 | e1a5f4d5d86a |
parent 5147 | a2ae7702bb75 |
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 |
||
19 |
#ifndef PAGES_H |
|
20 |
#define PAGES_H |
|
21 |
||
22 |
#include <QWidget> |
|
684 | 23 |
#include <QPushButton> |
24 |
#include <QFont> |
|
25 |
#include <QGridLayout> |
|
1840 | 26 |
#include <QSignalMapper> |
184 | 27 |
|
28 |
#include "binds.h" |
|
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2468
diff
changeset
|
29 |
#include "hwform.h" |
322 | 30 |
#include "mapContainer.h" |
1932 | 31 |
#include "togglebutton.h" |
184 | 32 |
|
33 |
class QPushButton; |
|
34 |
class QGroupBox; |
|
35 |
class QComboBox; |
|
36 |
class QLabel; |
|
37 |
class QToolBox; |
|
38 |
class QLineEdit; |
|
665 | 39 |
class QListWidget; |
40 |
class QCheckBox; |
|
41 |
class QSpinBox; |
|
42 |
class QTextEdit; |
|
43 |
class QRadioButton; |
|
44 |
class QTableView; |
|
1377 | 45 |
class QTextBrowser; |
1399 | 46 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
47 |
class QAction; |
1885 | 48 |
class QDataWidgetMapper; |
1887 | 49 |
class QAbstractItemModel; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2762
diff
changeset
|
50 |
class QSettings; |
3708
64e059b6f9c5
applied from experimental3D, use a slider to set up quality
koda
parents:
3695
diff
changeset
|
51 |
class QSlider; |
665 | 52 |
|
684 | 53 |
class AbstractPage : public QWidget |
54 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
55 |
Q_OBJECT |
1885 | 56 |
|
684 | 57 |
public: |
58 |
||
59 |
protected: |
|
60 |
AbstractPage(QWidget* parent = 0) { |
|
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
61 |
Q_UNUSED(parent); |
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
62 |
|
684 | 63 |
font14 = new QFont("MS Shell Dlg", 14); |
4592
b1fe47b11b99
disable fix for issue 24 in order to fix issue 123, as suggested by koda
sheepluva
parents:
4586
diff
changeset
|
64 |
//setFocusPolicy(Qt::StrongFocus); |
684 | 65 |
} |
66 |
virtual ~AbstractPage() {}; |
|
67 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
68 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
684 | 69 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
70 |
if (!iconed) { |
1148 | 71 |
butt->setFont(*font14); |
72 |
butt->setText(btname); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
73 |
//butt->setStyleSheet("background-color: #0d0544"); |
1148 | 74 |
} else { |
75 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
76 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 77 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
78 |
butt->setFixedSize(sz); |
1148 | 79 |
butt->setIconSize(sz); |
80 |
butt->setFlat(true); |
|
1149 | 81 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 82 |
} |
684 | 83 |
grid->addWidget(butt, wy, wx); |
84 |
return butt; |
|
85 |
}; |
|
86 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
87 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 88 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
89 |
if (!iconed) { |
1148 | 90 |
butt->setFont(*font14); |
91 |
butt->setText(btname); |
|
92 |
} else { |
|
93 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
94 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 95 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
96 |
butt->setFixedSize(sz); |
1148 | 97 |
butt->setIconSize(sz); |
98 |
butt->setFlat(true); |
|
1149 | 99 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 100 |
} |
692 | 101 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
102 |
return butt; |
|
103 |
}; |
|
104 |
||
1443 | 105 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { |
684 | 106 |
QPushButton* butt = new QPushButton(this); |
1443 | 107 |
if (!iconed) { |
108 |
butt->setFont(*font14); |
|
109 |
butt->setText(btname); |
|
110 |
} else { |
|
111 |
const QIcon& lp=QIcon(btname); |
|
112 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
113 |
butt->setIcon(lp); |
|
114 |
butt->setFixedSize(sz); |
|
115 |
butt->setIconSize(sz); |
|
116 |
butt->setFlat(true); |
|
117 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
118 |
} |
|
684 | 119 |
box->addWidget(butt, where); |
120 |
return butt; |
|
121 |
}; |
|
122 |
||
123 |
QFont * font14; |
|
124 |
}; |
|
125 |
||
184 | 126 |
#endif // PAGES_H |