|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2009 Kristian Lehmann <email@thexception.net> |
|
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 TOGGLEBUTTONWIDGET_H |
|
20 #define TOGGLEBUTTONWIDGET_H |
|
21 |
|
22 #include <QWidget> |
|
23 #include <QPainter> |
|
24 #include <QPushButton> |
|
25 #include <QVBoxLayout> |
|
26 #include <QLabel> |
|
27 |
|
28 class ToggleButtonWidget : public QWidget |
|
29 { |
|
30 Q_OBJECT |
|
31 public: |
|
32 ToggleButtonWidget(QWidget * parent, QString img); |
|
33 ~ToggleButtonWidget(); |
|
34 bool isChecked(); |
|
35 void setChecked(bool checked); |
|
36 void setText(QString s); |
|
37 QPushButton * button() |
|
38 { |
|
39 return pbMain; |
|
40 } |
|
41 private: |
|
42 QLabel * lbMain; |
|
43 QPushButton * pbMain; |
|
44 QPixmap pmChecked; |
|
45 QPixmap pmDisabled; |
|
46 private slots: |
|
47 void eventToggled(bool checked); |
|
48 }; |
|
49 |
|
50 #endif // TOGGLEBUTTONWIDGET_H |