QTfrontend/togglebutton.h
author nemo
Sun, 24 Jan 2010 16:46:06 +0000
changeset 2712 8f4527c9137c
parent 1932 f586d75c8b6a
child 2948 3f21a9dc93d0
permissions -rw-r--r--
Minor tweak, try to make long flavour text last longer, move the hurt self messages to unused messages group, so they don't get wiped by crate an instant later.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1932
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     1
/*
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     4
 *
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     8
 *
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    13
 *
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    17
 */
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    18
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    19
#ifndef TOGGLEBUTTONWIDGET_H
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    20
#define TOGGLEBUTTONWIDGET_H
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    21
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    22
#include <QWidget>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    23
#include <QPainter>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    24
#include <QPushButton>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    25
#include <QVBoxLayout>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    26
#include <QLabel>
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    27
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    28
class ToggleButtonWidget : public QWidget
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    29
{
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    30
	Q_OBJECT
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    31
public:
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    32
	ToggleButtonWidget(QWidget * parent, QString img);
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    33
	~ToggleButtonWidget();
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    34
	bool isChecked();
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    35
	void setChecked(bool checked);
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    36
	void setText(QString s);
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    37
	QPushButton * button()
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    38
	{
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    39
		return pbMain;
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    40
	}
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    41
private:
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    42
	QLabel * lbMain;
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    43
	QPushButton * pbMain;
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    44
	QPixmap pmChecked;
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    45
	QPixmap pmDisabled;
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    46
private slots:
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    47
	void eventToggled(bool checked);
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    48
};
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    49
f586d75c8b6a New schemes page look by TheXception
unc0rr
parents:
diff changeset
    50
#endif // TOGGLEBUTTONWIDGET_H